From patchwork Thu Jun 11 03:32:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joyce Kong X-Patchwork-Id: 71219 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B574CA00BE; Thu, 11 Jun 2020 05:33:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4DAF329D6; Thu, 11 Jun 2020 05:33:14 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 0F58D1C01 for ; Thu, 11 Jun 2020 05:33:13 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 83DE255D; Wed, 10 Jun 2020 20:33:12 -0700 (PDT) Received: from net-arm-thunderx2-03.shanghai.arm.com (net-arm-thunderx2-03.shanghai.arm.com [10.169.41.185]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DF7323F66F; Wed, 10 Jun 2020 20:33:09 -0700 (PDT) From: Joyce Kong To: maxime.coquelin@redhat.com, jerinj@marvell.com, zhihong.wang@intel.com, xiaolong.ye@intel.com, honnappa.nagarahalli@arm.com, phil.yang@arm.com, ruifeng.wang@arm.com Cc: dev@dpdk.org Date: Thu, 11 Jun 2020 11:32:47 +0800 Message-Id: <20200611033248.39049-2-joyce.kong@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200611033248.39049-1-joyce.kong@arm.com> References: <20200611033248.39049-1-joyce.kong@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 1/2] net/virtio: restrict pointer aliasing for NEON vpmd 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" Restrict pointer aliasing to allow the compiler to vectorize loops more aggressively. With this patch, a 9.6% improvement is observed in throughput for the virtio-net PVP case, and a 2.4% perf improvement in throughput for the virtio-user PVP case. All performance data are measured under the 0.001% acceptable packet loss with 2 cores on the vhost side. Signed-off-by: Joyce Kong Reviewed-by: Phil Yang --- drivers/net/virtio/virtio_rxtx_simple_neon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c index 363e2b330..c08dd51fb 100644 --- a/drivers/net/virtio/virtio_rxtx_simple_neon.c +++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c @@ -36,8 +36,8 @@ * - nb_pkts < RTE_VIRTIO_DESC_PER_LOOP, just return no packet */ uint16_t -virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf + **__restrict rx_pkts, uint16_t nb_pkts) { struct virtnet_rx *rxvq = rx_queue; struct virtqueue *vq = rxvq->vq; From patchwork Thu Jun 11 03:32:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joyce Kong X-Patchwork-Id: 71220 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1270CA00BE; Thu, 11 Jun 2020 05:33:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 911CA2B93; Thu, 11 Jun 2020 05:33:17 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 1D61A2B89 for ; Thu, 11 Jun 2020 05:33:16 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A511D6E; Wed, 10 Jun 2020 20:33:15 -0700 (PDT) Received: from net-arm-thunderx2-03.shanghai.arm.com (net-arm-thunderx2-03.shanghai.arm.com [10.169.41.185]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0B47F3F66F; Wed, 10 Jun 2020 20:33:12 -0700 (PDT) From: Joyce Kong To: maxime.coquelin@redhat.com, jerinj@marvell.com, zhihong.wang@intel.com, xiaolong.ye@intel.com, honnappa.nagarahalli@arm.com, phil.yang@arm.com, ruifeng.wang@arm.com Cc: dev@dpdk.org Date: Thu, 11 Jun 2020 11:32:48 +0800 Message-Id: <20200611033248.39049-3-joyce.kong@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200611033248.39049-1-joyce.kong@arm.com> References: <20200611033248.39049-1-joyce.kong@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 2/2] lib/vhost: restrict pointer aliasing for packed path 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" Restrict pointer aliasing to allow the compiler to vectorize loops more aggressively. With this patch, a 9.6% improvement is observed in throughput for the packed virtio-net PVP case, and a 2.8% improvement in throughput for the packed virtio-user PVP case. All performance data are measured under 0.001% acceptable packet loss with 1 core on both vhost and virtio side. Signed-off-by: Joyce Kong Reviewed-by: Phil Yang --- lib/librte_vhost/virtio_net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 751c1f373..39c92e7e1 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1133,8 +1133,8 @@ virtio_dev_rx_single_packed(struct virtio_net *dev, static __rte_noinline uint32_t virtio_dev_rx_packed(struct virtio_net *dev, - struct vhost_virtqueue *vq, - struct rte_mbuf **pkts, + struct vhost_virtqueue *__restrict vq, + struct rte_mbuf **__restrict pkts, uint32_t count) { uint32_t pkt_idx = 0; @@ -1219,7 +1219,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id, uint16_t rte_vhost_enqueue_burst(int vid, uint16_t queue_id, - struct rte_mbuf **pkts, uint16_t count) + struct rte_mbuf **__restrict pkts, uint16_t count) { struct virtio_net *dev = get_device(vid); @@ -2124,9 +2124,9 @@ free_zmbuf(struct vhost_virtqueue *vq) static __rte_noinline uint16_t virtio_dev_tx_packed_zmbuf(struct virtio_net *dev, - struct vhost_virtqueue *vq, + struct vhost_virtqueue *__restrict vq, struct rte_mempool *mbuf_pool, - struct rte_mbuf **pkts, + struct rte_mbuf **__restrict pkts, uint32_t count) { uint32_t pkt_idx = 0; @@ -2160,9 +2160,9 @@ virtio_dev_tx_packed_zmbuf(struct virtio_net *dev, static __rte_noinline uint16_t virtio_dev_tx_packed(struct virtio_net *dev, - struct vhost_virtqueue *vq, + struct vhost_virtqueue *__restrict vq, struct rte_mempool *mbuf_pool, - struct rte_mbuf **pkts, + struct rte_mbuf **__restrict pkts, uint32_t count) { uint32_t pkt_idx = 0;