From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 48D40A00E6 for ; Thu, 21 Mar 2019 10:11:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B2571B45E; Thu, 21 Mar 2019 10:11:42 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 6471449E0; Thu, 21 Mar 2019 10:11:38 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9CCD67E427; Thu, 21 Mar 2019 09:11:37 +0000 (UTC) Received: from [10.36.112.59] (ovpn-112-59.ams2.redhat.com [10.36.112.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF31419C57; Thu, 21 Mar 2019 09:11:36 +0000 (UTC) To: tiwei.bie@intel.com, dev@dpdk.org Cc: stable@dpdk.org References: <20190228175704.27948-1-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <96c409db-537a-f55f-5e36-79f2e350427a@redhat.com> Date: Thu, 21 Mar 2019 10:11:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190228175704.27948-1-maxime.coquelin@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 21 Mar 2019 09:11:37 +0000 (UTC) Subject: Re: [dpdk-stable] [PATCH v2] vhost: prevent disabled rings to be processed with zero-copy X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 2/28/19 6:57 PM, Maxime Coquelin wrote: > The vhost-user spec says that once the vring is disabled, the > client has to stop processing it. But it can happen when > dequeue zero-copy is enabled if outstanding descriptors buffers > are still being processed by an external NIC or another guest. > > The fix consists in draining the zmbufs list to ensure no more > descriptors buffers are in the wild. > > Note that this fix is only working in the case REPLY_ACK > protocol feature is enabled, which is not the case by default > for now (it is only enabled when IOMMU feature is enabled in > the vhost library). > > Fixes: b0a985d1f340 ("vhost: add dequeue zero copy") > Cc: stable@dpdk.org > > Reviewed-by: Tiwei Bie > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/vhost_user.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index 36c0c676d..555d09ad9 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1345,6 +1345,10 @@ vhost_user_set_vring_enable(struct virtio_net **pdev, > dev->notify_ops->vring_state_changed(dev->vid, > index, enable); > > + /* On disable, rings have to be stopped being processed. */ > + if (!enable && dev->dequeue_zero_copy) > + drain_zmbuf_list(dev->virtqueue[index]); > + > dev->virtqueue[index]->enabled = enable; > > return RTE_VHOST_MSG_RESULT_OK; > Applied to dpdk-next-virtio/master. Maxime