From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2] vhost: fix virtio_net false sharing Date: Mon, 27 Mar 2017 16:33:12 +0800 Message-ID: <20170327083312.GW18844@yliu-dev.sh.intel.com> References: <1489605049-18686-1-git-send-email-ktraynor@redhat.com> <1490283898-23019-1-git-send-email-ktraynor@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Kevin Traynor , dev@dpdk.org, stable@dpdk.org To: Maxime Coquelin Return-path: Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Mar 27, 2017 at 09:34:19AM +0200, Maxime Coquelin wrote: > > > On 03/23/2017 04:44 PM, Kevin Traynor wrote: > >The broadcast_rarp field in the virtio_net struct is checked in the > >dequeue datapath regardless of whether descriptors are available or not. > > > >As it is checked with cmpset leading to a write, false sharing on the > >virtio_net struct can happen between enqueue and dequeue datapaths > >regardless of whether a RARP is requested. In OVS, the issue can cause > >a uni-directional performance drop of up to 15%. > > > >Fix that by only performing the cmpset if a read of broadcast_rarp > >indicates that the cmpset is likely to succeed. > > > >Fixes: a66bcad32240 ("vhost: arrange struct fields for better cache sharing") > >Cc: stable@dpdk.org > > > >Signed-off-by: Kevin Traynor > >--- > > > >V2: > >Change from fixing by moving broadcast_rarp location in virtio_net struct > >to performing a read before cmpset. > > > > lib/librte_vhost/virtio_net.c | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > Nice! > Reviewed-by: Maxime Coquelin Applied to dpdk-next-virtio. Thanks. --yliu > > I'll try to benchmark it with testpmd only to see if we measure the > same gain without OVS. > > Thanks, > Maxime