get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74613,
    "url": "http://patches.dpdk.org/api/patches/74613/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200722103701.7244-1-harry.van.haaren@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": "<20200722103701.7244-1-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200722103701.7244-1-harry.van.haaren@intel.com",
    "date": "2020-07-22T10:37:00",
    "name": "[v3,1/2] service: add API to retrieve service core active",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2bc4b80229e4db289b65f3472df353f65faeaf9f",
    "submitter": {
        "id": 317,
        "url": "http://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200722103701.7244-1-harry.van.haaren@intel.com/mbox/",
    "series": [
        {
            "id": 11234,
            "url": "http://patches.dpdk.org/api/series/11234/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11234",
            "date": "2020-07-22T10:37:00",
            "name": "[v3,1/2] service: add API to retrieve service core active",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/11234/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74613/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/74613/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 BDB8EA0526;\n\tWed, 22 Jul 2020 12:36:13 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 789461BFFF;\n\tWed, 22 Jul 2020 12:36:12 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by dpdk.org (Postfix) with ESMTP id A54381BFFE\n for <dev@dpdk.org>; Wed, 22 Jul 2020 12:36:10 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Jul 2020 03:36:09 -0700",
            "from silpixa00399779.ir.intel.com (HELO\n silpixa00399779.ger.corp.intel.com) ([10.237.222.209])\n by orsmga002.jf.intel.com with ESMTP; 22 Jul 2020 03:36:06 -0700"
        ],
        "IronPort-SDR": [
            "\n tQtv8wW6ryrFSDFdgZxU0ZmkghzgWhv4zbUwQjYyOGZmm+/PgN8L6u7N7DQ2Xtrk4cZwpAUv6Q\n ajmsS2MY593Q==",
            "\n X0xtXl4WMpJYpC+LeyuTm51psBVOoiZfBoqjEvPjTwLWzwG/irSFggW7E4ZjyT7bGGf6iLpf4Z\n Yi2UIjD7vLBg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9689\"; a=\"149470011\"",
            "E=Sophos;i=\"5.75,381,1589266800\"; d=\"scan'208\";a=\"149470011\"",
            "E=Sophos;i=\"5.75,381,1589266800\"; d=\"scan'208\";a=\"301910581\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, igor.romanov@oktetlabs.ru,\n honnappa.nagarahalli@arm.com, ferruh.yigit@intel.com, nd@arm.com,\n aconole@redhat.com, l.wojciechow@partner.samsung.com, phil.yang@arm.com,\n Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Wed, 22 Jul 2020 11:37:00 +0100",
        "Message-Id": "<20200722103701.7244-1-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200720143829.46280-1-harry.van.haaren@intel.com>",
        "References": "<20200720143829.46280-1-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 1/2] service: add API to retrieve service core\n\tactive",
        "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": "This 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>\n\n---\n\nv3:\n- Change service lcore stores to SEQ_CST (Honnappa, David)\n- Change control thread load to ACQ (Honnappa, David)\n- Comment reasons for SEQ_CST/ACQ (Honnappa, David)\n- Add comments to Doxygen for _stop() and _lcore_active() (Honnappa, David)\n- Add Phil's review tag from ML\n---\n lib/librte_eal/common/rte_service.c  | 23 ++++++++++++++++++++++-\n lib/librte_eal/include/rte_service.h | 20 +++++++++++++++++++-\n lib/librte_eal/rte_eal_version.map   |  1 +\n 3 files changed, 42 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 6a0e0ff65..b0cf7c4ab 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@@ -422,7 +423,7 @@ rte_service_may_be_active(uint32_t id)\n \t\treturn -EINVAL;\n \n \tfor (i = 0; i < lcore_count; i++) {\n-\t\tif (lcore_states[ids[i]].service_active_on_lcore[id])\n+\tif (lcore_states[ids[i]].service_active_on_lcore[id])\n \t\t\treturn 1;\n \t}\n \n@@ -457,6 +458,8 @@ service_runner_func(void *arg)\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,9 +478,27 @@ service_runner_func(void *arg)\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_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 {\ndiff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h\nindex e2d0a6dd3..84245020d 100644\n--- a/lib/librte_eal/include/rte_service.h\n+++ b/lib/librte_eal/include/rte_service.h\n@@ -249,7 +249,9 @@ int32_t rte_service_lcore_start(uint32_t lcore_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. To check if the service\n+ * lcore is still active, the *rte_service_lcore_active* API is added.\n  *\n  * @retval 0 Success\n  * @retval -EINVAL Invalid *lcore_id* provided\n@@ -261,6 +263,22 @@ int32_t rte_service_lcore_start(uint32_t lcore_id);\n  */\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 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_active(uint32_t lcore_id);\n+\n /**\n  * Adds lcore to the list of service cores.\n  *\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex bf0c17c23..d53d5d5b9 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -401,6 +401,7 @@ EXPERIMENTAL {\n \trte_lcore_dump;\n \trte_lcore_iterate;\n \trte_mp_disable;\n+\trte_service_lcore_active;\n \trte_thread_register;\n \trte_thread_unregister;\n };\n",
    "prefixes": [
        "v3",
        "1/2"
    ]
}