From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 77CDF1B01A for ; Wed, 20 Dec 2017 12:21:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 03:21:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,431,1508828400"; d="scan'208";a="15146549" Received: from silpixa00398672.ir.intel.com ([10.237.223.128]) by fmsmga001.fm.intel.com with ESMTP; 20 Dec 2017 03:21:33 -0800 From: Harry van Haaren To: dev@dpdk.org Cc: Harry van Haaren Date: Wed, 20 Dec 2017 11:21:46 +0000 Message-Id: <1513768907-112647-1-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH 1/2] service: fix del to reset lcore role to rte X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2017 11:21:35 -0000 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 Signed-off-by: Harry van Haaren --- @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