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 16C6CA0547; Fri, 10 Sep 2021 01:13:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44D4E410FE; Fri, 10 Sep 2021 01:13:44 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id A4997410DA for ; Fri, 10 Sep 2021 01:13:42 +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 1E7651042; Thu, 9 Sep 2021 16:13:42 -0700 (PDT) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.13.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 17E2E3F73D; Thu, 9 Sep 2021 16:13:42 -0700 (PDT) From: Honnappa Nagarahalli To: dev@dpdk.org, honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com, david.marchand@redhat.com, feifei.wang2@arm.com Cc: ruifeng.wang@arm.com, nd@arm.com, Feifei Wang Date: Thu, 9 Sep 2021 18:13:10 -0500 Message-Id: <20210909231312.2572006-5-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210909231312.2572006-1-honnappa.nagarahalli@arm.com> References: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> <20210909231312.2572006-1-honnappa.nagarahalli@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 4/6] eal: update rte_eal_wait_lcore definition 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 Sender: "dev" Since the FINISHED state is removed, the API rte_eal_wait_lcore is updated to always return the status of the last function that ran in the worker core. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Feifei Wang --- lib/eal/common/eal_common_launch.c | 6 ++---- lib/eal/include/rte_launch.h | 12 +++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/eal/common/eal_common_launch.c b/lib/eal/common/eal_common_launch.c index 78fd940267..4bc842417a 100644 --- a/lib/eal/common/eal_common_launch.c +++ b/lib/eal/common/eal_common_launch.c @@ -23,10 +23,8 @@ int rte_eal_wait_lcore(unsigned worker_id) { - if (lcore_config[worker_id].state == WAIT) - return 0; - - while (lcore_config[worker_id].state != WAIT) + while (__atomic_load_n(&lcore_config[worker_id].state, + __ATOMIC_ACQUIRE) != WAIT) rte_pause(); rte_rmb(); diff --git a/lib/eal/include/rte_launch.h b/lib/eal/include/rte_launch.h index ed0bb4762a..f2d386e6e2 100644 --- a/lib/eal/include/rte_launch.h +++ b/lib/eal/include/rte_launch.h @@ -119,18 +119,16 @@ enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned int worker_id); * * To be executed on the MAIN lcore only. * - * If the worker lcore identified by the worker_id is in a FINISHED state, - * switch to the WAIT state. If the lcore is in RUNNING state, wait until - * the lcore finishes its job and moves to the FINISHED state. + * If the lcore identified by the worker_id is in RUNNING state, wait until + * the lcore finishes its job and moves to the WAIT state. * * @param worker_id * The identifier of the lcore. * @return - * - 0: If the lcore identified by the worker_id is in a WAIT state. + * - 0: If the remote launch function was never called on the lcore + * identified by the worker_id. * - The value that was returned by the previous remote launch - * function call if the lcore identified by the worker_id was in a - * FINISHED or RUNNING state. In this case, it changes the state - * of the lcore to WAIT. + * function call. */ int rte_eal_wait_lcore(unsigned worker_id); -- 2.25.1