Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/65758/?format=api
http://patches.dpdk.org/api/patches/65758/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200212092456.29433-3-joyce.kong@arm.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20200212092456.29433-3-joyce.kong@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200212092456.29433-3-joyce.kong@arm.com", "date": "2020-02-12T09:24:56", "name": "[v1,2/2] virtio: one way barrier for split vring avail idx", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "cf16e4317d9220aec8984dd32b2c5dadde62e8a2", "submitter": { "id": 970, "url": "http://patches.dpdk.org/api/people/970/?format=api", "name": "Joyce Kong", "email": "joyce.kong@arm.com" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200212092456.29433-3-joyce.kong@arm.com/mbox/", "series": [ { "id": 8511, "url": "http://patches.dpdk.org/api/series/8511/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8511", "date": "2020-02-12T09:24:54", "name": "one way barrier for split vring idx", "version": 1, "mbox": "http://patches.dpdk.org/series/8511/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/65758/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/65758/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 70049A0530;\n\tWed, 12 Feb 2020 10:25:53 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 662DD1BDFD;\n\tWed, 12 Feb 2020 10:25:41 +0100 (CET)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id DE9071BC25\n for <dev@dpdk.org>; Wed, 12 Feb 2020 10:25:39 +0100 (CET)", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6146B1045;\n Wed, 12 Feb 2020 01:25:39 -0800 (PST)", "from net-arm-thunderx2-03.shanghai.arm.com\n (net-arm-thunderx2-03.shanghai.arm.com [10.169.41.185])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CEEEA3F6CF;\n Wed, 12 Feb 2020 01:25:36 -0800 (PST)" ], "From": "Joyce Kong <joyce.kong@arm.com>", "To": "dev@dpdk.org", "Cc": "nd@arm.com, maxime.coquelin@redhat.com, tiwei.bie@intel.com,\n zhihong.wang@intel.com, thomas@monjalon.net, jerinj@marvell.com,\n yinan.wang@intel.com, honnappa.nagarahalli@arm.com, gavin.hu@arm.com", "Date": "Wed, 12 Feb 2020 17:24:56 +0800", "Message-Id": "<20200212092456.29433-3-joyce.kong@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200212092456.29433-1-joyce.kong@arm.com>", "References": "<20200212092456.29433-1-joyce.kong@arm.com>", "Subject": "[dpdk-dev] [PATCH v1 2/2] virtio: one way barrier for split vring\n\tavail idx", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend\nand backend are assumed to be implemented in software, that is they can\nrun on identical CPUs in an SMP configuration.\nThus a weak form of memory barriers like rte_smp_r/wmb, other than\nrte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)\nand yields better performance.\nFor the above case, this patch helps yielding even better performance\nby replacing the two-way barriers with C11 one-way barriers for avail\nindex in split ring.\n\nSigned-off-by: Joyce Kong <joyce.kong@arm.com>\nReviewed-by: Gavin Hu <gavin.hu@arm.com>\n---\n drivers/net/virtio/virtqueue.h | 19 +++++++++++++++++--\n lib/librte_vhost/virtio_net.c | 14 +++++---------\n 2 files changed, 22 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex 13fdcb13a..bbe36c107 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -496,8 +496,23 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx,\n static inline void\n vq_update_avail_idx(struct virtqueue *vq)\n {\n-\tvirtio_wmb(vq->hw->weak_barriers);\n-\tvq->vq_split.ring.avail->idx = vq->vq_avail_idx;\n+\tif (vq->hw->weak_barriers) {\n+/* x86 prefers to using rte_smp_wmb over __atomic_store_n as it reports\n+ * a slightly better perf, which comes from the saved branch by the compiler.\n+ * The if and else branches are identical with the smp and cio barriers both\n+ * defined as compiler barriers on x86.\n+ */\n+#ifdef RTE_ARCH_X86_64\n+\t\trte_smp_wmb();\n+\t\tvq->vq_split.ring.avail->idx = vq->vq_avail_idx;\n+#else\n+\t\t__atomic_store_n(&vq->vq_split.ring.avail->idx,\n+\t\t\t\t vq->vq_avail_idx, __ATOMIC_RELEASE);\n+#endif\n+\t} else {\n+\t\trte_cio_wmb();\n+\t\tvq->vq_split.ring.avail->idx = vq->vq_avail_idx;\n+\t}\n }\n \n static inline void\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 7f6e7f2c1..4c5380bc1 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -991,13 +991,11 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct buf_vector buf_vec[BUF_VECTOR_MAX];\n \tuint16_t avail_head;\n \n-\tavail_head = *((volatile uint16_t *)&vq->avail->idx);\n-\n \t/*\n \t * The ordering between avail index and\n \t * desc reads needs to be enforced.\n \t */\n-\trte_smp_rmb();\n+\tavail_head = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE);\n \n \trte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]);\n \n@@ -1712,16 +1710,14 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t}\n \t}\n \n-\tfree_entries = *((volatile uint16_t *)&vq->avail->idx) -\n-\t\t\tvq->last_avail_idx;\n-\tif (free_entries == 0)\n-\t\treturn 0;\n-\n \t/*\n \t * The ordering between avail index and\n \t * desc reads needs to be enforced.\n \t */\n-\trte_smp_rmb();\n+\tfree_entries = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE) -\n+\t\t\tvq->last_avail_idx;\n+\tif (free_entries == 0)\n+\t\treturn 0;\n \n \trte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]);\n \n", "prefixes": [ "v1", "2/2" ] }{ "id": 65758, "url": "