Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/69659/?format=api
http://patches.dpdk.org/api/patches/69659/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200502000245.11071-3-honnappa.nagarahalli@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": "<20200502000245.11071-3-honnappa.nagarahalli@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200502000245.11071-3-honnappa.nagarahalli@arm.com", "date": "2020-05-02T00:02:41", "name": "[v3,2/6] service: identify service running on another core correctly", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "198d659ce63088158aac1eb4d5556684775395ad", "submitter": { "id": 1045, "url": "http://patches.dpdk.org/api/people/1045/?format=api", "name": "Honnappa Nagarahalli", "email": "honnappa.nagarahalli@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/20200502000245.11071-3-honnappa.nagarahalli@arm.com/mbox/", "series": [ { "id": 9787, "url": "http://patches.dpdk.org/api/series/9787/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9787", "date": "2020-05-02T00:02:39", "name": "use c11 atomics for service core lib", "version": 3, "mbox": "http://patches.dpdk.org/series/9787/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/69659/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/69659/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 76822A04B2;\n\tSat, 2 May 2020 02:03:22 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 160D51D9C6;\n\tSat, 2 May 2020 02:03:07 +0200 (CEST)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 22C601D99E;\n Sat, 2 May 2020 02:03:04 +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 A04E7106F;\n Fri, 1 May 2020 17:03:03 -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 8D3203F305;\n Fri, 1 May 2020 17:03:03 -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": "Fri, 1 May 2020 19:02:41 -0500", "Message-Id": "<20200502000245.11071-3-honnappa.nagarahalli@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200502000245.11071-1-honnappa.nagarahalli@arm.com>", "References": "<1587659482-27133-1-git-send-email-phil.yang@arm.com>\n <20200502000245.11071-1-honnappa.nagarahalli@arm.com>", "Subject": "[dpdk-dev] [PATCH v3 2/6] service: identify service running on\n\tanother core correctly", "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 logic to identify if the MT unsafe service is running on another\ncore can return -EBUSY spuriously. In such cases, running the service\nbecomes costlier than using atomic operations. Assume that the\napplication passes the right parameters and reduces the number of\ninstructions for all cases.\n\nCc: stable@dpdk.org\nFixes: 8d39d3e237c2 (\"service: fix race in service on app lcore function\")\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nReviewed-by: Phil Yang <phil.yang@arm.com>\n---\n lib/librte_eal/common/rte_service.c | 26 ++++++++------------------\n 1 file changed, 8 insertions(+), 18 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex b8c465eb9..c89472b83 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -360,7 +360,7 @@ rte_service_runner_do_callback(struct rte_service_spec_impl *s,\n /* Expects the service 's' is valid. */\n static int32_t\n service_run(uint32_t i, struct core_state *cs, uint64_t service_mask,\n-\t struct rte_service_spec_impl *s)\n+\t struct rte_service_spec_impl *s, uint32_t serialize_mt_unsafe)\n {\n \tif (!s)\n \t\treturn -EINVAL;\n@@ -374,7 +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-\tif (service_mt_safe(s) == 0) {\n+\tif ((service_mt_safe(s) == 0) && (serialize_mt_unsafe == 1)) {\n \t\tif (!rte_atomic32_cmpset((uint32_t *)&s->execute_lock, 0, 1))\n \t\t\treturn -EBUSY;\n \n@@ -412,24 +412,14 @@ rte_service_run_iter_on_app_lcore(uint32_t id, uint32_t serialize_mt_unsafe)\n \n \tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n \n-\t/* Atomically add this core to the mapped cores first, then examine if\n-\t * we can run the service. This avoids a race condition between\n-\t * checking the value, and atomically adding to the mapped count.\n+\t/* Increment num_mapped_cores to indicate that the service\n+\t * is running on a core.\n \t */\n-\tif (serialize_mt_unsafe)\n-\t\trte_atomic32_inc(&s->num_mapped_cores);\n+\trte_atomic32_inc(&s->num_mapped_cores);\n \n-\tif (service_mt_safe(s) == 0 &&\n-\t\t\trte_atomic32_read(&s->num_mapped_cores) > 1) {\n-\t\tif (serialize_mt_unsafe)\n-\t\t\trte_atomic32_dec(&s->num_mapped_cores);\n-\t\treturn -EBUSY;\n-\t}\n-\n-\tint ret = service_run(id, cs, UINT64_MAX, s);\n+\tint ret = service_run(id, cs, UINT64_MAX, s, serialize_mt_unsafe);\n \n-\tif (serialize_mt_unsafe)\n-\t\trte_atomic32_dec(&s->num_mapped_cores);\n+\trte_atomic32_dec(&s->num_mapped_cores);\n \n \treturn ret;\n }\n@@ -449,7 +439,7 @@ rte_service_runner_func(void *arg)\n \t\t\tif (!service_valid(i))\n \t\t\t\tcontinue;\n \t\t\t/* return value ignored as no change to code flow */\n-\t\t\tservice_run(i, cs, service_mask, service_get(i));\n+\t\t\tservice_run(i, cs, service_mask, service_get(i), 1);\n \t\t}\n \n \t\tcs->loops++;\n", "prefixes": [ "v3", "2/6" ] }{ "id": 69659, "url": "