From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 42D2E1E900 for ; Tue, 12 Jun 2018 08:41:52 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 23:41:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,213,1526367600"; d="scan'208";a="56383761" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.228]) by fmsmga002.fm.intel.com with ESMTP; 11 Jun 2018 23:41:51 -0700 Date: Tue, 12 Jun 2018 14:41:58 +0800 From: Tiwei Bie To: Maxime Coquelin Cc: zhihong.wang@intel.com, dev@dpdk.org Message-ID: <20180612064157.GB14993@debian> References: <20180607143826.23647-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180607143826.23647-1-maxime.coquelin@redhat.com> User-Agent: Mutt/1.9.5 (2018-04-13) Subject: Re: [dpdk-dev] [PATCH] vhost: use SMP memory barrier before kicking guest 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: Tue, 12 Jun 2018 06:41:53 -0000 On Thu, Jun 07, 2018 at 04:38:26PM +0200, Maxime Coquelin wrote: > vhost_vring_call() used rte_mb(), which translates into > mfence instruction on x86. > > This patch changes to use rte_smp_mb(), which changed recently > to translate into a locked ADD instruction for performance > reason. > > The measured gain is up to 3% with the testpmd benchmarks. > > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/vhost.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index 58c425a5c..1bc99ed3c 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -591,7 +591,7 @@ static __rte_always_inline void > vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq) > { > /* Flush used->idx update before we read avail->flags. */ > - rte_mb(); > + rte_smp_mb(); > > /* Don't kick guest if we don't reach index specified by guest. */ > if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { > -- > 2.14.3 > Reviewed-by: Tiwei Bie