get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88180,
    "url": "http://patchwork.dpdk.org/api/patches/88180/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210224212018.17576-5-honnappa.nagarahalli@arm.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20210224212018.17576-5-honnappa.nagarahalli@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210224212018.17576-5-honnappa.nagarahalli@arm.com",
    "date": "2021-02-24T21:20:17",
    "name": "[RFC,4/5] eal: ensure memory operations are visible to main",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8be8aee234e6e9b585dcc22d3015fc6e5b97da15",
    "submitter": {
        "id": 1045,
        "url": "http://patchwork.dpdk.org/api/people/1045/?format=api",
        "name": "Honnappa Nagarahalli",
        "email": "honnappa.nagarahalli@arm.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patchwork.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210224212018.17576-5-honnappa.nagarahalli@arm.com/mbox/",
    "series": [
        {
            "id": 15367,
            "url": "http://patchwork.dpdk.org/api/series/15367/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=15367",
            "date": "2021-02-24T21:20:13",
            "name": "Use correct memory ordering in eal functions",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/15367/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/88180/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/88180/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id BBBF8A034F;\n\tWed, 24 Feb 2021 22:20:59 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C5300160778;\n\tWed, 24 Feb 2021 22:20:50 +0100 (CET)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id 1665D160774\n for <dev@dpdk.org>; Wed, 24 Feb 2021 22:20:49 +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 88CB8ED1;\n Wed, 24 Feb 2021 13:20:48 -0800 (PST)",
            "from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com\n [10.118.12.44])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BFE33F73D;\n Wed, 24 Feb 2021 13:20:48 -0800 (PST)"
        ],
        "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>",
        "To": "Bruce Richardson <bruce.richardson@intel.com>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,\n Dmitry Malloy <dmitrym@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>",
        "Cc": "dev@dpdk.org, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com,\n feifei.wang@arm.com, nd@arm.com",
        "Date": "Wed, 24 Feb 2021 15:20:17 -0600",
        "Message-Id": "<20210224212018.17576-5-honnappa.nagarahalli@arm.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210224212018.17576-1-honnappa.nagarahalli@arm.com>",
        "References": "<20210224212018.17576-1-honnappa.nagarahalli@arm.com>",
        "Subject": "[dpdk-dev] [RFC 4/5] eal: ensure memory operations are visible to\n main",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "Ensure that the memory operations in worker thread, that happen\nbefore it returns the status of the assigned function, are\nvisible to the main thread.\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n---\n lib/librte_eal/common/eal_common_launch.c |  8 ++++----\n lib/librte_eal/freebsd/eal_thread.c       | 10 ++++++++--\n lib/librte_eal/linux/eal_thread.c         | 17 ++++++++++++-----\n lib/librte_eal/windows/eal_thread.c       |  9 +++++++--\n 4 files changed, 31 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c\nindex 78fd94026..9cc71801a 100644\n--- a/lib/librte_eal/common/eal_common_launch.c\n+++ b/lib/librte_eal/common/eal_common_launch.c\n@@ -23,14 +23,14 @@\n int\n rte_eal_wait_lcore(unsigned worker_id)\n {\n-\tif (lcore_config[worker_id].state == WAIT)\n+\tif (__atomic_load_n(&lcore_config[worker_id].state,\n+\t\t\t\t\t__ATOMIC_ACQUIRE) == WAIT)\n \t\treturn 0;\n \n-\twhile (lcore_config[worker_id].state != WAIT)\n+\twhile (__atomic_load_n(&lcore_config[worker_id].state,\n+\t\t\t\t\t__ATOMIC_ACQUIRE) != WAIT)\n \t\trte_pause();\n \n-\trte_rmb();\n-\n \treturn lcore_config[worker_id].ret;\n }\n \ndiff --git a/lib/librte_eal/freebsd/eal_thread.c b/lib/librte_eal/freebsd/eal_thread.c\nindex 6d6f1e2fd..58c8502de 100644\n--- a/lib/librte_eal/freebsd/eal_thread.c\n+++ b/lib/librte_eal/freebsd/eal_thread.c\n@@ -139,8 +139,14 @@ eal_thread_loop(__rte_unused void *arg)\n \t\tlcore_config[lcore_id].ret = ret;\n \t\tlcore_config[lcore_id].f = NULL;\n \t\tlcore_config[lcore_id].arg = NULL;\n-\t\trte_wmb();\n-\t\tlcore_config[lcore_id].state = WAIT;\n+\n+\t\t/* Store the state with release order to ensure that\n+\t\t * the memory operations from the worker thread\n+\t\t * are completed before the state is updated.\n+\t\t * Use 'state' as the guard variable.\n+\t\t */\n+\t\t__atomic_store_n(&lcore_config[lcore_id].state, WAIT,\n+\t\t\t\t\t__ATOMIC_RELEASE);\n \t}\n \n \t/* never reached */\ndiff --git a/lib/librte_eal/linux/eal_thread.c b/lib/librte_eal/linux/eal_thread.c\nindex 7b9463df3..eab6fa652 100644\n--- a/lib/librte_eal/linux/eal_thread.c\n+++ b/lib/librte_eal/linux/eal_thread.c\n@@ -39,13 +39,14 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned int worker_id)\n \tint w2m = lcore_config[worker_id].pipe_worker2main[0];\n \tint rc = -EBUSY;\n \n-\tif (lcore_config[worker_id].state != WAIT)\n+\tif (__atomic_load_n(&lcore_config[worker_id].state,\n+\t\t\t\t\t__ATOMIC_ACQUIRE) != WAIT)\n \t\tgoto finish;\n \n \tlcore_config[worker_id].arg = arg;\n \t/* Ensure that all the memory operations are completed\n \t * before the worker thread starts running the function.\n-\t * Use worker thread function as the guard variable.\n+\t * Use worker thread function pointer as the guard variable.\n \t */\n \t__atomic_store_n(&lcore_config[worker_id].f, f, __ATOMIC_RELEASE);\n \n@@ -115,7 +116,8 @@ eal_thread_loop(__rte_unused void *arg)\n \t\tif (n <= 0)\n \t\t\trte_panic(\"cannot read on configuration pipe\\n\");\n \n-\t\tlcore_config[lcore_id].state = RUNNING;\n+\t\t__atomic_store_n(&lcore_config[lcore_id].state, RUNNING,\n+\t\t\t\t\t__ATOMIC_RELEASE);\n \n \t\t/* send ack */\n \t\tn = 0;\n@@ -139,9 +141,14 @@ eal_thread_loop(__rte_unused void *arg)\n \t\tlcore_config[lcore_id].ret = ret;\n \t\tlcore_config[lcore_id].f = NULL;\n \t\tlcore_config[lcore_id].arg = NULL;\n-\t\trte_wmb();\n \n-\t\tlcore_config[lcore_id].state = WAIT;\n+\t\t/* Store the state with release order to ensure that\n+\t\t * the memory operations from the worker thread\n+\t\t * are completed before the state is updated.\n+\t\t * Use 'state' as the guard variable.\n+\t\t */\n+\t\t__atomic_store_n(&lcore_config[lcore_id].state, WAIT,\n+\t\t\t\t\t__ATOMIC_RELEASE);\n \t}\n \n \t/* never reached */\ndiff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c\nindex 35d059a30..fb1ec4b4f 100644\n--- a/lib/librte_eal/windows/eal_thread.c\n+++ b/lib/librte_eal/windows/eal_thread.c\n@@ -123,9 +123,14 @@ eal_thread_loop(void *arg __rte_unused)\n \t\tlcore_config[lcore_id].ret = ret;\n \t\tlcore_config[lcore_id].f = NULL;\n \t\tlcore_config[lcore_id].arg = NULL;\n-\t\trte_wmb();\n \n-\t\tlcore_config[lcore_id].state = WAIT;\n+\t\t/* Store the state with release order to ensure that\n+\t\t * the memory operations from the worker thread\n+\t\t * are completed before the state is updated.\n+\t\t * Use 'state' as the guard variable.\n+\t\t */\n+\t\t__atomic_store_n(&lcore_config[lcore_id].state, WAIT,\n+\t\t\t\t\t__ATOMIC_RELEASE);\n \t}\n }\n \n",
    "prefixes": [
        "RFC",
        "4/5"
    ]
}