get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 69844,
    "url": "http://patches.dpdk.org/api/patches/69844/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1588778884-13047-2-git-send-email-phil.yang@arm.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": "<1588778884-13047-2-git-send-email-phil.yang@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1588778884-13047-2-git-send-email-phil.yang@arm.com",
    "date": "2020-05-06T15:27:59",
    "name": "[v6,1/6] service: fix race condition for MT unsafe service",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "b49749f502fcadfe42daca25c306af94881d50de",
    "submitter": {
        "id": 833,
        "url": "http://patches.dpdk.org/api/people/833/?format=api",
        "name": "Phil Yang",
        "email": "phil.yang@arm.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/1588778884-13047-2-git-send-email-phil.yang@arm.com/mbox/",
    "series": [
        {
            "id": 9877,
            "url": "http://patches.dpdk.org/api/series/9877/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9877",
            "date": "2020-05-06T15:27:58",
            "name": "use c11 atomics for service core lib",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/9877/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/69844/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/69844/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 00785A034F;\n\tWed,  6 May 2020 17:28:58 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A0F431D977;\n\tWed,  6 May 2020 17:28:57 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 313FB1D966;\n Wed,  6 May 2020 17:28:56 +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 A50F9D6E;\n Wed,  6 May 2020 08:28:55 -0700 (PDT)",
            "from localhost.localdomain (unknown [172.31.20.19])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8663E3F68F;\n Wed,  6 May 2020 08:28:47 -0700 (PDT)"
        ],
        "From": "Phil Yang <phil.yang@arm.com>",
        "To": "dev@dpdk.org,\n\tharry.van.haaren@intel.com",
        "Cc": "thomas@monjalon.net, david.marchand@redhat.com,\n konstantin.ananyev@intel.com, jerinj@marvell.com, hemant.agrawal@nxp.com,\n gage.eads@intel.com, bruce.richardson@intel.com,\n Honnappa.Nagarahalli@arm.com, nd@arm.com,\n Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>, stable@dpdk.org",
        "Date": "Wed,  6 May 2020 23:27:59 +0800",
        "Message-Id": "<1588778884-13047-2-git-send-email-phil.yang@arm.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1588778884-13047-1-git-send-email-phil.yang@arm.com>",
        "References": "<1588760683-11027-1-git-send-email-phil.yang@arm.com>\n <1588778884-13047-1-git-send-email-phil.yang@arm.com>",
        "Subject": "[dpdk-dev] [PATCH v6 1/6] service: fix race condition for MT unsafe\n\tservice",
        "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: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n\nThe MT unsafe service might get configured to run on another core\nwhile the service is running currently. This might result in the\nMT unsafe service running on multiple cores simultaneously. Use\n'execute_lock' always when the service is MT unsafe.\n\nIf the service is known to be mmapped on a single lcore,\nsetting the service capability to MT safe will avoid taking\nthe lock and improve the performance.\n\nFixes: e9139a32f6e8 (\"service: add function to run on app lcore\")\nCc: stable@dpdk.org\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nReviewed-by: Phil Yang <phil.yang@arm.com>\nAcked-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n lib/librte_eal/common/rte_service.c            | 11 +++++------\n lib/librte_eal/include/rte_service.h           |  8 ++++++--\n lib/librte_eal/include/rte_service_component.h |  6 +++++-\n 3 files changed, 16 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 70d17a5..b8c465e 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -50,6 +50,10 @@ struct rte_service_spec_impl {\n \tuint8_t internal_flags;\n \n \t/* per service statistics */\n+\t/* Indicates how many cores the service is mapped to run on.\n+\t * It does not indicate the number of cores the service is running\n+\t * on currently.\n+\t */\n \trte_atomic32_t num_mapped_cores;\n \tuint64_t calls;\n \tuint64_t cycles_spent;\n@@ -370,12 +374,7 @@ service_run(uint32_t i, struct core_state *cs, uint64_t service_mask,\n \n \tcs->service_active_on_lcore[i] = 1;\n \n-\t/* check do we need cmpset, if MT safe or <= 1 core\n-\t * mapped, atomic ops are not required.\n-\t */\n-\tconst int use_atomics = (service_mt_safe(s) == 0) &&\n-\t\t\t\t(rte_atomic32_read(&s->num_mapped_cores) > 1);\n-\tif (use_atomics) {\n+\tif (service_mt_safe(s) == 0) {\n \t\tif (!rte_atomic32_cmpset((uint32_t *)&s->execute_lock, 0, 1))\n \t\t\treturn -EBUSY;\n \ndiff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h\nindex d8701dd..3a1c735 100644\n--- a/lib/librte_eal/include/rte_service.h\n+++ b/lib/librte_eal/include/rte_service.h\n@@ -104,12 +104,16 @@ int32_t rte_service_probe_capability(uint32_t id, uint32_t capability);\n  * Each core can be added or removed from running a specific service. This\n  * function enables or disables *lcore* to run *service_id*.\n  *\n- * If multiple cores are enabled on a service, an atomic is used to ensure that\n- * only one cores runs the service at a time. The exception to this is when\n+ * If multiple cores are enabled on a service, a lock is used to ensure that\n+ * only one core runs the service at a time. The exception to this is when\n  * a service indicates that it is multi-thread safe by setting the capability\n  * called RTE_SERVICE_CAP_MT_SAFE. With the multi-thread safe capability set,\n  * the service function can be run on multiple threads at the same time.\n  *\n+ * If the service is known to be mapped to a single lcore, setting the\n+ * capability of the service to RTE_SERVICE_CAP_MT_SAFE can achieve\n+ * better performance by avoiding the use of lock.\n+ *\n  * @param service_id the service to apply the lcore to\n  * @param lcore The lcore that will be mapped to service\n  * @param enable Zero to unmap or disable the core, non-zero to enable\ndiff --git a/lib/librte_eal/include/rte_service_component.h b/lib/librte_eal/include/rte_service_component.h\nindex 16eab79..b75aba1 100644\n--- a/lib/librte_eal/include/rte_service_component.h\n+++ b/lib/librte_eal/include/rte_service_component.h\n@@ -43,7 +43,7 @@ struct rte_service_spec {\n /**\n  * Register a new service.\n  *\n- * A service represents a component that the requires CPU time periodically to\n+ * A service represents a component that requires CPU time periodically to\n  * achieve its purpose.\n  *\n  * For example the eventdev SW PMD requires CPU cycles to perform its\n@@ -56,6 +56,10 @@ struct rte_service_spec {\n  * *rte_service_component_runstate_set*, which indicates that the service\n  * component is ready to be executed.\n  *\n+ * If the service is known to be mapped to a single lcore, setting the\n+ * capability of the service to RTE_SERVICE_CAP_MT_SAFE can achieve\n+ * better performance.\n+ *\n  * @param spec The specification of the service to register\n  * @param[out] service_id A pointer to a uint32_t, which will be filled in\n  *             during registration of the service. It is set to the integers\n",
    "prefixes": [
        "v6",
        "1/6"
    ]
}