From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] vhost: flush IOTLB cache on new mem table handling Date: Sun, 05 Aug 2018 01:49:16 +0200 Message-ID: <10745847.ZKOuvd1ovp@xps> References: <20180802172122.25923-1-maxime.coquelin@redhat.com> <20180803083731.GA46621@debian.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Tiwei Bie , zhihong.wang@intel.com, jfreimann@redhat.com, stable@dpdk.org To: Maxime Coquelin Return-path: In-Reply-To: <20180803083731.GA46621@debian.sh.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Applied, thanks