get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 78466,
    "url": "http://patches.dpdk.org/api/patches/78466/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1600827586-73414-2-git-send-email-nicolas.chautru@intel.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": "<1600827586-73414-2-git-send-email-nicolas.chautru@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1600827586-73414-2-git-send-email-nicolas.chautru@intel.com",
    "date": "2020-09-23T02:19:36",
    "name": "[v6,01/11] service: retrieve lcore active state",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e83f32c281730aa66966449445ecadb713037d28",
    "submitter": {
        "id": 1314,
        "url": "http://patches.dpdk.org/api/people/1314/?format=api",
        "name": "Chautru, Nicolas",
        "email": "nicolas.chautru@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1600827586-73414-2-git-send-email-nicolas.chautru@intel.com/mbox/",
    "series": [
        {
            "id": 12417,
            "url": "http://patches.dpdk.org/api/series/12417/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12417",
            "date": "2020-09-23T02:19:35",
            "name": "bbdev PMD ACC100",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/12417/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/78466/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/78466/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 7759AA04B5;\n\tWed, 23 Sep 2020 04:20:39 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F39AA1DBC9;\n\tWed, 23 Sep 2020 04:20:26 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by dpdk.org (Postfix) with ESMTP id 6E7761DB61\n for <dev@dpdk.org>; Wed, 23 Sep 2020 04:20:22 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Sep 2020 19:20:20 -0700",
            "from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210])\n by orsmga002.jf.intel.com with ESMTP; 22 Sep 2020 19:20:19 -0700"
        ],
        "IronPort-SDR": [
            "\n 4fqj5EdMHQvEanUycrk7eAseQFUoXO2tkxc6d8PTokuH5xyE5GVQddQeU2TfnxDUZfNmPsDEvT\n 1801fkivyBmg==",
            "\n Vae5aCq4m+p9z4HBOlz14FgZVNXp36TzDOc2hZBsLasPlaWzmPiwxNUKItl69MODeQ5tbKxtEA\n f3tArgjN1PEw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9752\"; a=\"158137483\"",
            "E=Sophos;i=\"5.77,292,1596524400\"; d=\"scan'208\";a=\"158137483\"",
            "E=Sophos;i=\"5.77,292,1596524400\"; d=\"scan'208\";a=\"322442475\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Nicolas Chautru <nicolas.chautru@intel.com>",
        "To": "dev@dpdk.org,\n\takhil.goyal@nxp.com",
        "Cc": "bruce.richardson@intel.com, rosen.xu@intel.com,\n dave.burley@accelercomm.com, aidan.goddard@accelercomm.com,\n ferruh.yigit@intel.com, tianjiao.liu@intel.com,\n Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Tue, 22 Sep 2020 19:19:36 -0700",
        "Message-Id": "<1600827586-73414-2-git-send-email-nicolas.chautru@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1600827586-73414-1-git-send-email-nicolas.chautru@intel.com>",
        "References": "<1597796731-57841-12-git-send-email-nicolas.chautru@intel.com>\n <1600827586-73414-1-git-send-email-nicolas.chautru@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6 01/11] service: retrieve lcore active state",
        "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": "From: Harry van Haaren <harry.van.haaren@intel.com>\n\nThis commit adds a new experimental API which allows the user\nto retrieve the active state of an lcore. Knowing when the service\nlcore is completed its polling loop can be useful to applications\nto avoid race conditions when e.g. finalizing statistics.\n\nThe service thread itself now has a variable to indicate if its\nthread is active. When zero the service thread has completed its\nservice, and has returned from the service_runner_func() function.\n\nSuggested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\nReviewed-by: Phil Yang <phil.yang@arm.com>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n---\n lib/librte_eal/common/rte_service.c  | 21 +++++++++++++++++++++\n lib/librte_eal/include/rte_service.h | 22 +++++++++++++++++++++-\n lib/librte_eal/rte_eal_version.map   |  1 +\n 3 files changed, 43 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 6a0e0ff..98565bb 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -65,6 +65,7 @@ struct core_state {\n \t/* map of services IDs are run on this core */\n \tuint64_t service_mask;\n \tuint8_t runstate; /* running or stopped */\n+\tuint8_t thread_active; /* indicates when thread is in service_run() */\n \tuint8_t is_service_core; /* set if core is currently a service core */\n \tuint8_t service_active_on_lcore[RTE_SERVICE_NUM_MAX];\n \tuint64_t loops;\n@@ -457,6 +458,8 @@ struct core_state {\n \tconst int lcore = rte_lcore_id();\n \tstruct core_state *cs = &lcore_states[lcore];\n \n+\t__atomic_store_n(&cs->thread_active, 1, __ATOMIC_SEQ_CST);\n+\n \t/* runstate act as the guard variable. Use load-acquire\n \t * memory order here to synchronize with store-release\n \t * in runstate update functions.\n@@ -475,10 +478,28 @@ struct core_state {\n \t\tcs->loops++;\n \t}\n \n+\t/* Use SEQ CST memory ordering to avoid any re-ordering around\n+\t * this store, ensuring that once this store is visible, the service\n+\t * lcore thread really is done in service cores code.\n+\t */\n+\t__atomic_store_n(&cs->thread_active, 0, __ATOMIC_SEQ_CST);\n \treturn 0;\n }\n \n int32_t\n+rte_service_lcore_may_be_active(uint32_t lcore)\n+{\n+\tif (lcore >= RTE_MAX_LCORE || !lcore_states[lcore].is_service_core)\n+\t\treturn -EINVAL;\n+\n+\t/* Load thread_active using ACQUIRE to avoid instructions dependent on\n+\t * the result being re-ordered before this load completes.\n+\t */\n+\treturn __atomic_load_n(&lcore_states[lcore].thread_active,\n+\t\t\t       __ATOMIC_ACQUIRE);\n+}\n+\n+int32_t\n rte_service_lcore_count(void)\n {\n \tint32_t count = 0;\ndiff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h\nindex e2d0a6d..ca9950d 100644\n--- a/lib/librte_eal/include/rte_service.h\n+++ b/lib/librte_eal/include/rte_service.h\n@@ -249,7 +249,11 @@ int32_t rte_service_run_iter_on_app_lcore(uint32_t id,\n  * Stop a service core.\n  *\n  * Stopping a core makes the core become idle, but remains  assigned as a\n- * service core.\n+ * service core. Note that the service lcore thread may not have returned from\n+ * the service it is running when this API returns.\n+ *\n+ * The *rte_service_lcore_may_be_active* API can be used to check if the\n+ * service lcore is * still active.\n  *\n  * @retval 0 Success\n  * @retval -EINVAL Invalid *lcore_id* provided\n@@ -262,6 +266,22 @@ int32_t rte_service_run_iter_on_app_lcore(uint32_t id,\n int32_t rte_service_lcore_stop(uint32_t lcore_id);\n \n /**\n+ * Reports if a service lcore is currently running.\n+ *\n+ * This function returns if the core has finished service cores code, and has\n+ * returned to EAL control. If *rte_service_lcore_stop* has been called but\n+ * the lcore has not returned to EAL yet, it might be required to wait and call\n+ * this function again. The amount of time to wait before the core returns\n+ * depends on the duration of the services being run.\n+ *\n+ * @retval 0 Service thread is not active, and lcore has been returned to EAL.\n+ * @retval 1 Service thread is in the service core polling loop.\n+ * @retval -EINVAL Invalid *lcore_id* provided.\n+ */\n+__rte_experimental\n+int32_t rte_service_lcore_may_be_active(uint32_t lcore_id);\n+\n+/**\n  * Adds lcore to the list of service cores.\n  *\n  * This functions can be used at runtime in order to modify the service core\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex eba868e..c32461c 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -394,6 +394,7 @@ EXPERIMENTAL {\n \trte_lcore_dump;\n \trte_lcore_iterate;\n \trte_mp_disable;\n+\trte_service_lcore_may_be_active;\n \trte_thread_register;\n \trte_thread_unregister;\n };\n",
    "prefixes": [
        "v6",
        "01/11"
    ]
}