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

Thomas Monjalon thomas at monjalon.net
Sun Aug 5 01:49:16 CEST 2018


03/08/2018 10:37, Tiwei Bie:
> 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>

Applied, thanks





More information about the dev mailing list