From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 96A624C93; Wed, 27 Feb 2019 11:22:44 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB0B230BC75B; Wed, 27 Feb 2019 10:22:43 +0000 (UTC) Received: from [10.36.112.64] (ovpn-112-64.ams2.redhat.com [10.36.112.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08DB15DA9A; Wed, 27 Feb 2019 10:22:42 +0000 (UTC) To: Tiwei Bie Cc: dev@dpdk.org, stable@dpdk.org References: <20190227085428.13666-1-maxime.coquelin@redhat.com> <20190227101032.GA32256@dpdk-tbie.sh.intel.com> From: Maxime Coquelin Message-ID: Date: Wed, 27 Feb 2019 11:22:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190227101032.GA32256@dpdk-tbie.sh.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 27 Feb 2019 10:22:43 +0000 (UTC) Subject: Re: [dpdk-stable] [PATCH] 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: , X-List-Received-Date: Wed, 27 Feb 2019 10:22:44 -0000 On 2/27/19 11:10 AM, Tiwei Bie wrote: > On Wed, Feb 27, 2019 at 09:54:28AM +0100, 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 extranl NIC or another guest. > > s/extranl/external/ > >> >> 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 >> >> 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..ef947b90c 100644 >> --- a/lib/librte_vhost/vhost_user.c >> +++ b/lib/librte_vhost/vhost_user.c >> @@ -1336,6 +1336,10 @@ vhost_user_set_vring_enable(struct virtio_net **pdev, >> "set queue enable: %d to qp idx: %d\n", >> enable, index); >> >> + /* On disable, rings have to be stopped being processed. */ >> + if (!enable && dev->dequeue_zero_copy) >> + drain_zmbuf_list(dev->virtqueue[index]); > > It might be better to drain the zmbufs list after calling > application's vring_state_changed() callback, so there will > be a chance for applications to take some actions first if > they want. Good point, I'll fix it in v2. > Overall this looks good to me, > > Reviewed-by: Tiwei Bie > > Thanks! > Tiwei >