get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88178,
    "url": "http://patchwork.dpdk.org/api/patches/88178/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210224212018.17576-3-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-3-honnappa.nagarahalli@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210224212018.17576-3-honnappa.nagarahalli@arm.com",
    "date": "2021-02-24T21:20:15",
    "name": "[RFC,2/5] eal: ensure memory operations are visible to worker",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a9b1ca17884db6aa925aab3c9604b5de4ec26b6e",
    "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-3-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/88178/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/88178/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 E86F4A034F;\n\tWed, 24 Feb 2021 22:20:46 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4407C16075A;\n\tWed, 24 Feb 2021 22:20:45 +0100 (CET)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id 5EECD160758\n for <dev@dpdk.org>; Wed, 24 Feb 2021 22:20:43 +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 D57C7101E;\n Wed, 24 Feb 2021 13:20:42 -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 C0F3D3F73D;\n Wed, 24 Feb 2021 13:20:42 -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:15 -0600",
        "Message-Id": "<20210224212018.17576-3-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 2/5] eal: ensure memory operations are visible to\n worker",
        "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 before the call to\nrte_eal_remote_launch are visible to the worker thread.\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nReviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>\n---\n lib/librte_eal/freebsd/eal_thread.c | 19 +++++++++++++++----\n lib/librte_eal/linux/eal_thread.c   | 19 +++++++++++++++----\n lib/librte_eal/windows/eal_thread.c | 19 +++++++++++++++----\n 3 files changed, 45 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal_thread.c b/lib/librte_eal/freebsd/eal_thread.c\nindex bbc3a8e98..17b8f3996 100644\n--- a/lib/librte_eal/freebsd/eal_thread.c\n+++ b/lib/librte_eal/freebsd/eal_thread.c\n@@ -42,8 +42,12 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned worker_id)\n \tif (lcore_config[worker_id].state != WAIT)\n \t\tgoto finish;\n \n-\tlcore_config[worker_id].f = f;\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 */\n+\t__atomic_store_n(&lcore_config[worker_id].f, f, __ATOMIC_RELEASE);\n \n \t/* send message */\n \tn = 0;\n@@ -100,6 +104,7 @@ eal_thread_loop(__rte_unused void *arg)\n \n \t/* read on our pipe to get commands */\n \twhile (1) {\n+\t\tlcore_function_t *f;\n \t\tvoid *fct_arg;\n \n \t\t/* wait command */\n@@ -119,12 +124,18 @@ eal_thread_loop(__rte_unused void *arg)\n \t\tif (n < 0)\n \t\t\trte_panic(\"cannot write on configuration pipe\\n\");\n \n-\t\tif (lcore_config[lcore_id].f == NULL)\n-\t\t\trte_panic(\"NULL function pointer\\n\");\n+\t\t/* Load 'f' with acquire order to ensure that\n+\t\t * the memory operations from the main thread\n+\t\t * are accessed only after update to 'f' is visible.\n+\t\t * Wait till the update to 'f' is visible to the worker.\n+\t\t */\n+\t\twhile ((f = __atomic_load_n(&lcore_config[lcore_id].f,\n+\t\t\t__ATOMIC_ACQUIRE)) == NULL)\n+\t\t\trte_pause();\n \n \t\t/* call the function and store the return value */\n \t\tfct_arg = lcore_config[lcore_id].arg;\n-\t\tret = lcore_config[lcore_id].f(fct_arg);\n+\t\tret = f(fct_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;\ndiff --git a/lib/librte_eal/linux/eal_thread.c b/lib/librte_eal/linux/eal_thread.c\nindex 8f3c0dafd..a0a009104 100644\n--- a/lib/librte_eal/linux/eal_thread.c\n+++ b/lib/librte_eal/linux/eal_thread.c\n@@ -42,8 +42,12 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned int worker_id)\n \tif (lcore_config[worker_id].state != WAIT)\n \t\tgoto finish;\n \n-\tlcore_config[worker_id].f = f;\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 */\n+\t__atomic_store_n(&lcore_config[worker_id].f, f, __ATOMIC_RELEASE);\n \n \t/* send message */\n \tn = 0;\n@@ -100,6 +104,7 @@ eal_thread_loop(__rte_unused void *arg)\n \n \t/* read on our pipe to get commands */\n \twhile (1) {\n+\t\tlcore_function_t *f;\n \t\tvoid *fct_arg;\n \n \t\t/* wait command */\n@@ -119,12 +124,18 @@ eal_thread_loop(__rte_unused void *arg)\n \t\tif (n < 0)\n \t\t\trte_panic(\"cannot write on configuration pipe\\n\");\n \n-\t\tif (lcore_config[lcore_id].f == NULL)\n-\t\t\trte_panic(\"NULL function pointer\\n\");\n+\t\t/* Load 'f' with acquire order to ensure that\n+\t\t * the memory operations from the main thread\n+\t\t * are accessed only after update to 'f' is visible.\n+\t\t * Wait till the update to 'f' is visible to the worker.\n+\t\t */\n+\t\twhile ((f = __atomic_load_n(&lcore_config[lcore_id].f,\n+\t\t\t__ATOMIC_ACQUIRE)) == NULL)\n+\t\t\trte_pause();\n \n \t\t/* call the function and store the return value */\n \t\tfct_arg = lcore_config[lcore_id].arg;\n-\t\tret = lcore_config[lcore_id].f(fct_arg);\n+\t\tret = f(fct_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;\ndiff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c\nindex b69672fe0..7a9277c51 100644\n--- a/lib/librte_eal/windows/eal_thread.c\n+++ b/lib/librte_eal/windows/eal_thread.c\n@@ -32,8 +32,12 @@ rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int worker_id)\n \tif (lcore_config[worker_id].state != WAIT)\n \t\treturn -EBUSY;\n \n-\tlcore_config[worker_id].f = f;\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 */\n+\t__atomic_store_n(&lcore_config[worker_id].f, f, __ATOMIC_RELEASE);\n \n \t/* send message */\n \tn = 0;\n@@ -84,6 +88,7 @@ eal_thread_loop(void *arg __rte_unused)\n \n \t/* read on our pipe to get commands */\n \twhile (1) {\n+\t\tlcore_function_t *f;\n \t\tvoid *fct_arg;\n \n \t\t/* wait command */\n@@ -103,12 +108,18 @@ eal_thread_loop(void *arg __rte_unused)\n \t\tif (n < 0)\n \t\t\trte_panic(\"cannot write on configuration pipe\\n\");\n \n-\t\tif (lcore_config[lcore_id].f == NULL)\n-\t\t\trte_panic(\"NULL function pointer\\n\");\n+\t\t/* Load 'f' with acquire order to ensure that\n+\t\t * the memory operations from the main thread\n+\t\t * are accessed only after update to 'f' is visible.\n+\t\t * Wait till the update to 'f' is visible to the worker.\n+\t\t */\n+\t\twhile ((f = __atomic_load_n(&lcore_config[lcore_id].f,\n+\t\t\t__ATOMIC_ACQUIRE)) == NULL)\n+\t\t\trte_pause();\n \n \t\t/* call the function and store the return value */\n \t\tfct_arg = lcore_config[lcore_id].arg;\n-\t\tret = lcore_config[lcore_id].f(fct_arg);\n+\t\tret = f(fct_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",
    "prefixes": [
        "RFC",
        "2/5"
    ]
}