From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 424C91B4E7; Thu, 11 Oct 2018 16:11:59 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 07:11:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="80396004" Received: from btwcube1.sh.intel.com (HELO debian) ([10.67.104.158]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2018 07:11:44 -0700 Date: Thu, 11 Oct 2018 22:10:28 +0800 From: Tiwei Bie To: "Michael S. Tsirkin" Cc: Jason Wang , maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20181011141028.GA11493@debian> References: <20181011130655.5485-1-tiwei.bie@intel.com> <20181011093628-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181011093628-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH] vhost: fix notification for packed ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2018 14:11:59 -0000 On Thu, Oct 11, 2018 at 09:36:48AM -0400, Michael S. Tsirkin wrote: > On Thu, Oct 11, 2018 at 09:34:06PM +0800, Jason Wang wrote: > > > > > > On 2018年10月11日 21:06, Tiwei Bie wrote: > > > The notification can't be disabled in packed ring when > > > application tries to disable notification, because the > > > device event flags field is overwritten by an unexpected > > > value. This patch fixes this issue. > > > > > > Fixes: b1cce26af1dc ("vhost: add notification for packed ring") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Tiwei Bie > > > --- > > > lib/librte_vhost/vhost.c | 7 +++++-- > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > > > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > > > index e62f4c594..c9270bdec 100644 > > > --- a/lib/librte_vhost/vhost.c > > > +++ b/lib/librte_vhost/vhost.c > > > @@ -667,8 +667,10 @@ vhost_enable_notify_packed(struct virtio_net *dev, > > > { > > > uint16_t flags; > > > - if (!enable) > > > - vq->device_event->flags = VRING_EVENT_F_DISABLE; > > > + if (!enable) { > > > + flags = VRING_EVENT_F_DISABLE; > > > + goto out; > > > + } > > > flags = VRING_EVENT_F_ENABLE; > > > if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { > > > @@ -677,6 +679,7 @@ vhost_enable_notify_packed(struct virtio_net *dev, > > > vq->avail_wrap_counter << 15; > > > } > > > +out: > > > rte_smp_wmb(); > > > > It looks to me the barrier is even not needed for !enable. > > > > Thanks > > Good point, I agree. > Besides that > > Reviewed-by: Michael S. Tsirkin > Yeah, it's better to return directly after disabling the interrupt. I will send a new version to do this change. Thanks! > > > > > vq->device_event->flags = flags;