DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] service: fix del to reset lcore role to rte
Date: Wed, 20 Dec 2017 11:21:46 +0000	[thread overview]
Message-ID: <1513768907-112647-1-git-send-email-harry.van.haaren@intel.com> (raw)

This patch fixes the reset of the service core,
that when rte_service_lcore_del() is called, the
lcore_role is restored to RTE.

This issue was reported as when running the unit tests, an
error was thrown that "failed to allocate lcore". Investigating
revealed that the state of the service-cores after del() was
not allowing a core to be re-used at a later point in time.

Fixes: 21698354c832 ("service: introduce service cores concept")
+CC stable@dpdk.org

Reported-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

@Stable maintainers; this is an EXPERIMENTAL tagged API, so I'm
not sure what the expectation is in terms of backporting.
---
 lib/librte_eal/common/rte_service.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index ae97e6b..15f63e7 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -583,13 +583,27 @@ rte_service_map_lcore_get(uint32_t id, uint32_t lcore)
 	return ret;
 }
 
+static void
+set_lcore_state(uint32_t lcore, int32_t state)
+{
+	/* mark core state in hugepage backed config */
+	struct rte_config *cfg = rte_eal_get_configuration();
+	cfg->lcore_role[lcore] = state;
+
+	/* mark state in process local lcore_config */
+	lcore_config[lcore].core_role = state;
+
+	/* update per-lcore optimized state tracking */
+	lcore_states[lcore].is_service_core = (state == ROLE_SERVICE);
+}
+
 int32_t rte_service_lcore_reset_all(void)
 {
 	/* loop over cores, reset all to mask 0 */
 	uint32_t i;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		lcore_states[i].service_mask = 0;
-		lcore_states[i].is_service_core = 0;
+		set_lcore_state(i, ROLE_RTE);
 		lcore_states[i].runstate = RUNSTATE_STOPPED;
 	}
 	for (i = 0; i < RTE_SERVICE_NUM_MAX; i++)
@@ -600,20 +614,6 @@ int32_t rte_service_lcore_reset_all(void)
 	return 0;
 }
 
-static void
-set_lcore_state(uint32_t lcore, int32_t state)
-{
-	/* mark core state in hugepage backed config */
-	struct rte_config *cfg = rte_eal_get_configuration();
-	cfg->lcore_role[lcore] = state;
-
-	/* mark state in process local lcore_config */
-	lcore_config[lcore].core_role = state;
-
-	/* update per-lcore optimized state tracking */
-	lcore_states[lcore].is_service_core = (state == ROLE_SERVICE);
-}
-
 int32_t
 rte_service_lcore_add(uint32_t lcore)
 {
-- 
2.7.4

             reply	other threads:[~2017-12-20 11:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 11:21 Harry van Haaren [this message]
2017-12-20 11:21 ` [dpdk-dev] [PATCH 2/2] service: fix service core launch Harry van Haaren
2018-01-04 15:30   ` Pavan Nikhilesh
2018-01-04 15:20 ` [dpdk-dev] [PATCH 1/2] service: fix del to reset lcore role to rte Pavan Nikhilesh
2018-01-08 15:58 ` [dpdk-dev] [PATCH v2 " Harry van Haaren
2018-01-08 15:58   ` [dpdk-dev] [PATCH v2 2/2] service: fix service core launch Harry van Haaren
2018-01-09 11:38   ` [dpdk-dev] [PATCH v3 1/2] service: fix del to reset lcore role to rte Harry van Haaren
2018-01-09 11:38     ` [dpdk-dev] [PATCH v3 2/2] service: fix service core launch Harry van Haaren
2018-01-09 12:14     ` [dpdk-dev] [PATCH v3 1/2] service: fix del to reset lcore role to rte Bruce Richardson
2018-01-09 13:37     ` [dpdk-dev] [PATCH v4 1/2] service: fix lcore role after delete Harry van Haaren
2018-01-09 13:37       ` [dpdk-dev] [PATCH v4 2/2] service: fix service core launch Harry van Haaren
2018-01-10 10:23       ` [dpdk-dev] [PATCH v4 1/2] service: fix lcore role after delete Pavan Nikhilesh
2018-01-11 22:30         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513768907-112647-1-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).