get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74759,
    "url": "http://patches.dpdk.org/api/patches/74759/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200724124503.96282-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": "<20200724124503.96282-1-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200724124503.96282-1-harry.van.haaren@intel.com",
    "date": "2020-07-24T12:45:02",
    "name": "[v4,1/2] service: add API to retrieve service core active",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c33e852bf61e4da5efcff083f95b43e01d179500",
    "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/20200724124503.96282-1-harry.van.haaren@intel.com/mbox/",
    "series": [
        {
            "id": 11286,
            "url": "http://patches.dpdk.org/api/series/11286/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11286",
            "date": "2020-07-24T12:45:02",
            "name": "[v4,1/2] service: add API to retrieve service core active",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/11286/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74759/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/74759/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 1DB16A0526;\n\tFri, 24 Jul 2020 14:44:02 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F282A1C01E;\n\tFri, 24 Jul 2020 14:44:01 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 8352F1C012\n for <dev@dpdk.org>; Fri, 24 Jul 2020 14:44:00 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 Jul 2020 05:43:59 -0700",
            "from silpixa00399779.ir.intel.com (HELO\n silpixa00399779.ger.corp.intel.com) ([10.237.222.209])\n by orsmga004.jf.intel.com with ESMTP; 24 Jul 2020 05:43:57 -0700"
        ],
        "IronPort-SDR": [
            "\n 3H9urRcO4/vZu3Zv+QBGCmNSdcP57Xlat3QowdKiS5BvTjoo/pUTvs55Gn12Z34j9p4Tor1oTe\n FGITfSPR+xyw==",
            "\n /Pwkm+pgFx+ovZqmUzQ+eOsCavqJ3S5J/+dOdzrGvKW7sYAOrwM3yYL8IA6knEG392KQUlcHM0\n BQ+FFh9oLiiQ=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9691\"; a=\"138198804\"",
            "E=Sophos;i=\"5.75,390,1589266800\"; d=\"scan'208\";a=\"138198804\"",
            "E=Sophos;i=\"5.75,390,1589266800\"; d=\"scan'208\";a=\"433073208\""
        ],
        "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": "Fri, 24 Jul 2020 13:45:02 +0100",
        "Message-Id": "<20200724124503.96282-1-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200722103701.7244-1-harry.van.haaren@intel.com>",
        "References": "<20200722103701.7244-1-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 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>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n\n---\n\nv4:\n- Use _may_be_ style API for lcore_active (Honnappa)\n- Fix missing tab indent (Honnappa)\n- Add 'lcore' to doxygen retval description (Honnappa)\n\n@Honnappa: Please note i did not update the doxygen title of the\nlcore_may_be_active() function, as the current description is more\naccurate than making it more consistent with other functions. The\nfunction returns core active state - and I don't want to confuse\nmappings of services to lcores with what the function returns.\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  | 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 6a0e0ff65..35f1887fd 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 @@ 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_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 dependant 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..09f0d08b1 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_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 serivce 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@@ -261,6 +265,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 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  *\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex bf0c17c23..39826ef91 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_may_be_active;\n \trte_thread_register;\n \trte_thread_unregister;\n };\n",
    "prefixes": [
        "v4",
        "1/2"
    ]
}