get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/66517/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 66517,
    "url": "http://patches.dpdk.org/api/patches/66517/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1583862551-2049-4-git-send-email-phil.yang@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": "<1583862551-2049-4-git-send-email-phil.yang@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1583862551-2049-4-git-send-email-phil.yang@arm.com",
    "date": "2020-03-10T17:49:04",
    "name": "[03/10] vhost: optimize broadcast rarp sync with c11 atomic",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fbe74b6ab0f93809ac254f06dc75fbb48da42db5",
    "submitter": {
        "id": 833,
        "url": "http://patches.dpdk.org/api/people/833/?format=api",
        "name": "Phil Yang",
        "email": "phil.yang@arm.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1583862551-2049-4-git-send-email-phil.yang@arm.com/mbox/",
    "series": [
        {
            "id": 8875,
            "url": "http://patches.dpdk.org/api/series/8875/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8875",
            "date": "2020-03-10T17:49:01",
            "name": "generic rte atomic APIs deprecate proposal",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8875/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/66517/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/66517/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 CA5A7A0566;\n\tTue, 10 Mar 2020 18:50:23 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3F3CB1C05C;\n\tTue, 10 Mar 2020 18:50:08 +0100 (CET)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 7CB7E1C038\n for <dev@dpdk.org>; Tue, 10 Mar 2020 18:50:06 +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 E294B1FB;\n Tue, 10 Mar 2020 10:50:05 -0700 (PDT)",
            "from phil-VirtualBox.arm.com (A010647.Arm.com [10.170.243.28])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 57F783F534;\n Tue, 10 Mar 2020 10:50:02 -0700 (PDT)"
        ],
        "From": "Phil Yang <phil.yang@arm.com>",
        "To": "thomas@monjalon.net, harry.van.haaren@intel.com,\n konstantin.ananyev@intel.com, stephen@networkplumber.org,\n maxime.coquelin@redhat.com, dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, jerinj@marvell.com, hemant.agrawal@nxp.com,\n Honnappa.Nagarahalli@arm.com, gavin.hu@arm.com, ruifeng.wang@arm.com,\n joyce.kong@arm.com, nd@arm.com",
        "Date": "Wed, 11 Mar 2020 01:49:04 +0800",
        "Message-Id": "<1583862551-2049-4-git-send-email-phil.yang@arm.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1583862551-2049-1-git-send-email-phil.yang@arm.com>",
        "References": "<1583862551-2049-1-git-send-email-phil.yang@arm.com>",
        "Subject": "[dpdk-dev] [PATCH 03/10] vhost: optimize broadcast rarp sync with\n\tc11 atomic",
        "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": "The rarp packet broadcast flag is synchronized with rte_atomic_XX APIs\nwhich is a full barrier, DMB, on aarch64. This patch optimized it with\nc11 atomic one-way barrier.\n\nSigned-off-by: Phil Yang <phil.yang@arm.com>\nReviewed-by: Gavin Hu <gavin.hu@arm.com>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nReviewed-by: Joyce Kong <joyce.kong@arm.com>\n---\n lib/librte_vhost/vhost.h      |  2 +-\n lib/librte_vhost/vhost_user.c |  7 +++----\n lib/librte_vhost/virtio_net.c | 16 +++++++++-------\n 3 files changed, 13 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 2087d14..0e22125 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -350,7 +350,7 @@ struct virtio_net {\n \tuint32_t\t\tflags;\n \tuint16_t\t\tvhost_hlen;\n \t/* to tell if we need broadcast rarp packet */\n-\trte_atomic16_t\t\tbroadcast_rarp;\n+\tint16_t\t\t\tbroadcast_rarp;\n \tuint32_t\t\tnr_vring;\n \tint\t\t\tdequeue_zero_copy;\n \tint\t\t\textbuf;\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex bd1be01..857187d 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -2145,11 +2145,10 @@ vhost_user_send_rarp(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t * Set the flag to inject a RARP broadcast packet at\n \t * rte_vhost_dequeue_burst().\n \t *\n-\t * rte_smp_wmb() is for making sure the mac is copied\n-\t * before the flag is set.\n+\t * __ATOMIC_RELEASE ordering is for making sure the mac is\n+\t * copied before the flag is set.\n \t */\n-\trte_smp_wmb();\n-\trte_atomic16_set(&dev->broadcast_rarp, 1);\n+\t__atomic_store_n(&dev->broadcast_rarp, 1, __ATOMIC_RELEASE);\n \tdid = dev->vdpa_dev_id;\n \tvdpa_dev = rte_vdpa_get_device(did);\n \tif (vdpa_dev && vdpa_dev->ops->migration_done)\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 37c47c7..d20f60c 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -2203,6 +2203,7 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,\n \tstruct virtio_net *dev;\n \tstruct rte_mbuf *rarp_mbuf = NULL;\n \tstruct vhost_virtqueue *vq;\n+\tint success = 1;\n \n \tdev = get_device(vid);\n \tif (!dev)\n@@ -2249,16 +2250,17 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,\n \t *\n \t * broadcast_rarp shares a cacheline in the virtio_net structure\n \t * with some fields that are accessed during enqueue and\n-\t * rte_atomic16_cmpset() causes a write if using cmpxchg. This could\n-\t * result in false sharing between enqueue and dequeue.\n+\t * __atomic_compare_exchange_n causes a write if performed compare\n+\t * and exchange. This could result in false sharing between enqueue\n+\t * and dequeue.\n \t *\n \t * Prevent unnecessary false sharing by reading broadcast_rarp first\n-\t * and only performing cmpset if the read indicates it is likely to\n-\t * be set.\n+\t * and only performing compare and exchange if the read indicates it\n+\t * is likely to be set.\n \t */\n-\tif (unlikely(rte_atomic16_read(&dev->broadcast_rarp) &&\n-\t\t\trte_atomic16_cmpset((volatile uint16_t *)\n-\t\t\t\t&dev->broadcast_rarp.cnt, 1, 0))) {\n+\tif (unlikely(__atomic_load_n(&dev->broadcast_rarp, __ATOMIC_ACQUIRE) &&\n+\t\t\t__atomic_compare_exchange_n(&dev->broadcast_rarp,\n+\t\t\t&success, 0, 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED))) {\n \n \t\trarp_mbuf = rte_net_make_rarp_packet(mbuf_pool, &dev->mac);\n \t\tif (rarp_mbuf == NULL) {\n",
    "prefixes": [
        "03/10"
    ]
}