get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 98509,
    "url": "http://patchwork.dpdk.org/api/patches/98509/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210909231312.2572006-6-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": "<20210909231312.2572006-6-honnappa.nagarahalli@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210909231312.2572006-6-honnappa.nagarahalli@arm.com",
    "date": "2021-09-09T23:13:11",
    "name": "[v2,5/6] eal: ensure memory operations are visible to main",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e0bfbe9fe56c8edd9e345b2ce290a541b3008c84",
    "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/20210909231312.2572006-6-honnappa.nagarahalli@arm.com/mbox/",
    "series": [
        {
            "id": 18807,
            "url": "http://patchwork.dpdk.org/api/series/18807/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18807",
            "date": "2021-09-09T23:13:06",
            "name": "Use correct memory ordering in eal functions",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/18807/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/98509/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/98509/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 9EA22A0547;\n\tFri, 10 Sep 2021 01:14:07 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F16734114F;\n\tFri, 10 Sep 2021 01:13:48 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id AF3A541103\n for <dev@dpdk.org>; Fri, 10 Sep 2021 01:13:42 +0200 (CEST)",
            "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 23C211063;\n Thu,  9 Sep 2021 16:13:42 -0700 (PDT)",
            "from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com\n [10.118.13.211])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1C7583F766;\n Thu,  9 Sep 2021 16:13:42 -0700 (PDT)"
        ],
        "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>",
        "To": "dev@dpdk.org, honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com,\n david.marchand@redhat.com, feifei.wang2@arm.com",
        "Cc": "ruifeng.wang@arm.com,\n\tnd@arm.com,\n\tFeifei Wang <feifei.wang@arm.com>",
        "Date": "Thu,  9 Sep 2021 18:13:11 -0500",
        "Message-Id": "<20210909231312.2572006-6-honnappa.nagarahalli@arm.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210909231312.2572006-1-honnappa.nagarahalli@arm.com>",
        "References": "<20210224212018.17576-1-honnappa.nagarahalli@arm.com>\n <20210909231312.2572006-1-honnappa.nagarahalli@arm.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 5/6] eal: ensure memory operations are visible\n to 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>\nReviewed-by: Feifei Wang <feifei.wang@arm.com>\n---\n lib/eal/common/eal_common_launch.c |  2 --\n lib/eal/freebsd/eal_thread.c       | 22 ++++++++++++++++++----\n lib/eal/linux/eal_thread.c         | 23 ++++++++++++++++++-----\n lib/eal/windows/eal_thread.c       | 21 +++++++++++++++++----\n 4 files changed, 53 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/lib/eal/common/eal_common_launch.c b/lib/eal/common/eal_common_launch.c\nindex 4bc842417a..e95dadffb3 100644\n--- a/lib/eal/common/eal_common_launch.c\n+++ b/lib/eal/common/eal_common_launch.c\n@@ -27,8 +27,6 @@ rte_eal_wait_lcore(unsigned worker_id)\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/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c\nindex e5e3edf79b..3b18030d73 100644\n--- a/lib/eal/freebsd/eal_thread.c\n+++ b/lib/eal/freebsd/eal_thread.c\n@@ -39,7 +39,11 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned 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+\t/* Check if the worker is in 'WAIT' state. Use acquire order\n+\t * since 'state' variable is used as the guard variable.\n+\t */\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@@ -115,7 +119,11 @@ 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/* Set the state to 'RUNNING'. Use release order\n+\t\t * since 'state' variable is used as the guard variable.\n+\t\t */\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,8 +147,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/eal/linux/eal_thread.c b/lib/eal/linux/eal_thread.c\nindex c79e09c9ad..c7f0f9b2f7 100644\n--- a/lib/eal/linux/eal_thread.c\n+++ b/lib/eal/linux/eal_thread.c\n@@ -39,13 +39,17 @@ 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+\t/* Check if the worker is in 'WAIT' state. Use acquire order\n+\t * since 'state' variable is used as the guard variable.\n+\t */\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 +119,11 @@ 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/* Set the state to 'RUNNING'. Use release order\n+\t\t * since 'state' variable is used as the guard variable.\n+\t\t */\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 +147,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/eal/windows/eal_thread.c b/lib/eal/windows/eal_thread.c\nindex 977911905e..54fa93fa62 100644\n--- a/lib/eal/windows/eal_thread.c\n+++ b/lib/eal/windows/eal_thread.c\n@@ -29,7 +29,11 @@ rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int worker_id)\n \tint m2w = lcore_config[worker_id].pipe_main2worker[1];\n \tint w2m = lcore_config[worker_id].pipe_worker2main[0];\n \n-\tif (lcore_config[worker_id].state != WAIT)\n+\t/* Check if the worker is in 'WAIT' state. Use acquire order\n+\t * since 'state' variable is used as the guard variable.\n+\t */\n+\tif (__atomic_load_n(&lcore_config[worker_id].state,\n+\t\t\t\t\t__ATOMIC_ACQUIRE) != WAIT)\n \t\treturn -EBUSY;\n \n \tlcore_config[worker_id].arg = arg;\n@@ -99,7 +103,11 @@ eal_thread_loop(void *arg __rte_unused)\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/* Set the state to 'RUNNING'. Use release order\n+\t\t * since 'state' variable is used as the guard variable.\n+\t\t */\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@@ -123,9 +131,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": [
        "v2",
        "5/6"
    ]
}