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 A36DBA0547 for ; Mon, 30 Aug 2021 10:04:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9097641125; Mon, 30 Aug 2021 10:04:58 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 3819B406A3; Mon, 30 Aug 2021 10:04:56 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 79F8C31B; Mon, 30 Aug 2021 01:04:55 -0700 (PDT) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 930383F5A1; Mon, 30 Aug 2021 01:04:52 -0700 (PDT) From: Ruifeng Wang To: Harry van Haaren , Vipin Varghese Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, nd@arm.com, honnappa.nagarahalli@arm.com, Ruifeng Wang , stable@dpdk.org Date: Mon, 30 Aug 2021 16:04:12 +0800 Message-Id: <20210830080412.1548336-1-ruifeng.wang@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] examples/service_cores: fix lcore count check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The example has various profiles to run services on specified number of lcores. Due to incorrect boundary condition, service can be dispatched to a core that does not exist. This puts main core into endless wait. Max available number of service cores is all detected lcores excluding main core. Fixes: 7f6ee6aee717 ("examples/service_cores: check cores before run") Cc: stable@dpdk.org Cc: vipin.varghese@intel.com Signed-off-by: Ruifeng Wang --- examples/service_cores/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/service_cores/main.c b/examples/service_cores/main.c index 83915b9a53..9f52082254 100644 --- a/examples/service_cores/main.c +++ b/examples/service_cores/main.c @@ -118,7 +118,7 @@ apply_profile(int profile_id) struct profile *p = &profiles[profile_id]; const uint8_t core_off = 1; - if (p->num_cores > rte_lcore_count() + 1) { + if (p->num_cores > rte_lcore_count() - 1) { printf("insufficent cores to run (%s)", p->name); return; -- 2.25.1