Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/69783/?format=api
http://patchwork.dpdk.org/api/patches/69783/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200505211732.25291-2-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": "<20200505211732.25291-2-honnappa.nagarahalli@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200505211732.25291-2-honnappa.nagarahalli@arm.com", "date": "2020-05-05T21:17:27", "name": "[v4,1/6] service: fix race condition for MT unsafe service", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "b49749f502fcadfe42daca25c306af94881d50de", "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/20200505211732.25291-2-honnappa.nagarahalli@arm.com/mbox/", "series": [ { "id": 9845, "url": "http://patchwork.dpdk.org/api/series/9845/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=9845", "date": "2020-05-05T21:17:26", "name": "use c11 atomics for service core lib", "version": 4, "mbox": "http://patchwork.dpdk.org/series/9845/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/69783/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/69783/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 34B18A0352;\n\tTue, 5 May 2020 23:17:55 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0C1461D69C;\n\tTue, 5 May 2020 23:17:51 +0200 (CEST)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 310A41D69A;\n Tue, 5 May 2020 23:17:49 +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 7AF6F31B;\n Tue, 5 May 2020 14:17:48 -0700 (PDT)", "from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com\n [10.118.14.48])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 652CB3F305;\n Tue, 5 May 2020 14:17:48 -0700 (PDT)" ], "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>", "To": "dev@dpdk.org,\n\tphil.yang@arm.com,\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, stable@dpdk.org", "Date": "Tue, 5 May 2020 16:17:27 -0500", "Message-Id": "<20200505211732.25291-2-honnappa.nagarahalli@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200505211732.25291-1-honnappa.nagarahalli@arm.com>", "References": "<1587659482-27133-1-git-send-email-phil.yang@arm.com>\n <20200505211732.25291-1-honnappa.nagarahalli@arm.com>", "Subject": "[dpdk-dev] [PATCH v4 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": "The 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 70d17a5d7..b8c465eb9 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 d8701dd4c..3a1c735c5 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 16eab79ee..b75aba11b 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": [ "v4", "1/6" ] }{ "id": 69783, "url": "