From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 483C6A0542; Tue, 5 Jul 2022 15:32:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 362F84021D; Tue, 5 Jul 2022 15:32:20 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 3D840400D7 for ; Tue, 5 Jul 2022 15:32:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657027939; x=1688563939; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Vqf1tPkjaVKioKOk+JlbFsD4Al53aH/IEBlt0Uly1tI=; b=QXfgc6yy9rgoUFX9aSRCV1+jtZqsN9yEoHSOD7tH3BWESyvYiYB+Xlaj fbaAzTuOM4PATrzzSD9HXQHFhPfijVcc7+nwSeVWG4Eqi6y5hytnBnrq1 JKCppXE8GgpoKzIdgmC9kYSahOaY1U9IqPj7XIw+D1KUP1pJxq/BeBITR p5m0d5VzRoPT8+8n+G25Jkh5zFEfx2zzFZAkZEVMn13C6Wsos2UUSQt1+ 8eRRREl2voJ4AQLYGfSiY1QMGNzDi0jLQky2JZTfBjyVJVAJ0/pqbrqnB Sc5/wC5qbSJMhPOjKtWoEpWTVIimXymUim+aCwHsnfpDAF6T/Eq5cmqZy Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10398"; a="284466209" X-IronPort-AV: E=Sophos;i="5.92,247,1650956400"; d="scan'208";a="284466209" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 06:32:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,247,1650956400"; d="scan'208";a="660557282" Received: from silpixa00401454.ir.intel.com ([10.55.128.122]) by fmsmga004.fm.intel.com with ESMTP; 05 Jul 2022 06:32:16 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: Harry van Haaren , "S . V . Naga Harish" Subject: [PATCH] service: debug and fix lingering might_be_active() result Date: Tue, 5 Jul 2022 13:32:07 +0000 Message-Id: <20220705133207.2853345-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This commit fixes an issue where calling rte_service_lcore_stop() would result in a service's "active on lcore" status becoming stale. The stale status would result in rte_service_may_be_active() always returning "1", indiciating that the service is not certainly stopped. This is fixed by ensuring the "active on lcore" status of each service is set to 0 when an lcore is stopped. Fixes: e30dd31847d2 ("service: add mechanism for quiescing") Fixes: 8929de043eb4 ("service: retrieve lcore active state") Reported-by: S. V. Naga Harish Signed-off-by: Harry van Haaren --- lib/eal/common/rte_service.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c index ef31b1f63c..d2b7275ac0 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -758,7 +758,9 @@ rte_service_lcore_stop(uint32_t lcore) return -EALREADY; uint32_t i; - uint64_t service_mask = lcore_states[lcore].service_mask; + struct core_state *cs = &lcore_states[lcore]; + uint64_t service_mask = cs->service_mask; + for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { int32_t enabled = service_mask & (UINT64_C(1) << i); int32_t service_running = rte_service_runstate_get(i); @@ -766,6 +768,11 @@ rte_service_lcore_stop(uint32_t lcore) __atomic_load_n(&rte_services[i].num_mapped_cores, __ATOMIC_RELAXED)); + /* Switch off this core for all services, to ensure that future + * calls to may_be_active() know this core is switched off. + */ + cs->service_active_on_lcore[i] = 0; + /* if the core is mapped, and the service is running, and this * is the only core that is mapped, the service would cease to * run if this core stopped, so fail instead. -- 2.32.0