From patchwork Wed Mar 15 19:10:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Traynor X-Patchwork-Id: 21813 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 4C01E2C28; Wed, 15 Mar 2017 20:11:39 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2FABB1396; Wed, 15 Mar 2017 20:11:37 +0100 (CET) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 74438C0092D0; Wed, 15 Mar 2017 19:11:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 74438C0092D0 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ktraynor@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 74438C0092D0 Received: from ktraynor.remote.csb (ovpn-116-193.ams2.redhat.com [10.36.116.193]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FJBZWO008374; Wed, 15 Mar 2017 15:11:35 -0400 From: Kevin Traynor To: yuanhan.liu@linux.intel.com, maxime.coquelin@redhat.com Cc: dev@dpdk.org, Kevin Traynor , stable@dpdk.org Date: Wed, 15 Mar 2017 19:10:49 +0000 Message-Id: <1489605049-18686-1-git-send-email-ktraynor@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 15 Mar 2017 19:11:37 +0000 (UTC) Subject: [dpdk-dev] [PATCH] vhost: fix virtio_net cache sharing of broadcast_rarp 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The virtio_net structure is used in both enqueue and dequeue datapaths. broadcast_rarp is checked with cmpset in the dequeue datapath regardless of whether descriptors are available or not. It is observed in some cases where dequeue and enqueue are performed by different cores and no packets are available on the dequeue datapath (i.e. uni-directional traffic), the frequent checking of broadcast_rarp in dequeue causes performance degradation for the enqueue datapath. In OVS the issue can cause a uni-directional performance drop of up to 15%. Fix that by moving broadcast_rarp to a different cache line in virtio_net struct. Fixes: a66bcad32240 ("vhost: arrange struct fields for better cache sharing") Cc: stable@dpdk.org Signed-off-by: Kevin Traynor --- lib/librte_vhost/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 22564f1..a254328 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -156,6 +156,4 @@ struct virtio_net { uint32_t flags; uint16_t vhost_hlen; - /* to tell if we need broadcast rarp packet */ - rte_atomic16_t broadcast_rarp; uint32_t virt_qp_nb; int dequeue_zero_copy; @@ -167,4 +165,6 @@ struct virtio_net { uint64_t log_addr; struct ether_addr mac; + /* to tell if we need broadcast rarp packet */ + rte_atomic16_t broadcast_rarp; uint32_t nr_guest_pages;