[dpdk-stable] [PATCH v2] vhost: flush IOTLB cache on new mem table handling

Tiwei Bie tiwei.bie at intel.com
Fri Aug 3 10:37:31 CEST 2018


On Fri, Aug 03, 2018 at 09:54:21AM +0200, Maxime Coquelin wrote:
> On 08/03/2018 04:30 AM, Tiwei Bie wrote:
> > On Thu, Aug 02, 2018 at 07:21:22PM +0200, Maxime Coquelin wrote:
[...]
> >>   
> >>   #endif /* _VHOST_IOTLB_H_ */
> >> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> >> index dc53ff712..a2d4c9ffc 100644
> >> --- a/lib/librte_vhost/vhost_user.c
> >> +++ b/lib/librte_vhost/vhost_user.c
> >> @@ -813,6 +813,11 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)
> >>   		dev->mem = NULL;
> >>   	}
> >>   
> >> +	/* Flush IOTLB cache as previous HVAs are now invalid */
> >> +	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
> >> +		for (i = 0; i < dev->nr_vring; i++)
> >> +			vhost_user_iotlb_flush_all(dev->virtqueue[i]);
> > 
> > Why is the pending list also flushed?
> 
> As it might be asynchronous, I think it is better to flush the pending
> list too.
> 
> For example, the backend request a translation just before the guest
> remove the driver, the IOVA requested might not be valid anymore and
> so no reply will be sent by QEMU. So the request would remain in the
> pending list forever.
> 
> I don't doing that is mandatory, but it does nor hurt IMHO.

Yeah, it doesn't hurt. I was just curious about
why you want to do that. :)

Reviewed-by: Tiwei Bie <tiwei.bie at intel.com>



More information about the stable mailing list