From patchwork Tue Apr 28 01:21:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 69418 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F28D2A00BE; Tue, 28 Apr 2020 03:22:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D669D1D567; Tue, 28 Apr 2020 03:22:08 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id B129D1D55E for ; Tue, 28 Apr 2020 03:22:06 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200428012205euoutp01a1314f150063f4b8142bc5df36af791d~J1yuVrT6Z0302803028euoutp01H for ; Tue, 28 Apr 2020 01:22:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200428012205euoutp01a1314f150063f4b8142bc5df36af791d~J1yuVrT6Z0302803028euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1588036925; bh=HHf+dm2nkGv7gs0Y8F4mQnlCdoc5gJa3i3AxfbzZ1Ac=; h=From:To:Cc:Subject:Date:References:From; b=GvJeLTNBGxpgDAnUpVcfzdR7RTw2SJwKaXQTg2W7doe/1w1QudUUC5SiUXS+B0FAM denSe1vUnzuT49tu+iUFwAMeJHGvkKqdy+v0zPjjULZ07KGoESuScSXafwU5LMP3Dr IXqvu8XaG4Hoc0xMLq8WzDig2wVdA8OzTE0KnN/o= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200428012205eucas1p2108f1e26f4f9c4fbd2b6b09fd75c0bb9~J1yt22J102775327753eucas1p2S; Tue, 28 Apr 2020 01:22:05 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AD.48.60698.D3587AE5; Tue, 28 Apr 2020 02:22:05 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200428012204eucas1p120a84e501d0d64145c21476cd2562f36~J1ytIL0ym3127531275eucas1p1b; Tue, 28 Apr 2020 01:22:04 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200428012204eusmtrp10c5148dd74b8bf1daf135ddd06a5e39d~J1ytHqJyr2246022460eusmtrp1G; Tue, 28 Apr 2020 01:22:04 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-73-5ea7853d77a9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7B.0B.07950.C3587AE5; Tue, 28 Apr 2020 02:22:04 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200428012203eusmtip21b0835b25f860377465f46fdbf6018a9~J1ysdTJ_B0451704517eusmtip2C; Tue, 28 Apr 2020 01:22:03 +0000 (GMT) From: Lukasz Wojciechowski To: Harry van Haaren , Jerin Jacob Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Tue, 28 Apr 2020 03:21:39 +0200 Message-Id: <20200428012139.32196-1-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsWy7djP87q2rcvjDDad4LF492k7k0Vj/zcW i4mTTCye9axjtPjX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fhwSQCiRljiz7UuNoiaj4wSjZcWMYIk 2ARsJY7M/MoKYosIJErcvz8DLM4s4C6xZfFUZhBbWEBTov3ENjCbRUBV4sHqR0wgNq+Aq8TX 3vnsEAvkJVZvOMA8gZFnASPDKkaR1NLi3PTcYiO94sTc4tK8dL3k/NxNjMAg23bs55YdjF3v gg8xCnAwKvHwPti/LE6INbGsuDL3EKMEB7OSCO+jDKAQb0piZVVqUX58UWlOavEhRlOg5ROZ pUST84ERkFcSb2hqaG5haWhubG5sZqEkztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgTHtkQif YiPPtz+PIiSmOKtueX1xe238lE/7M2N/clyMvijs29fystLvjuiBl06R7+cv0rV235Tb27x3 2evXFbO3b5RbenqjvhEH394s/a//5wi/WeURLFTgJ2cxa4F+qM48Nxs/vfSqRbsd2OZv+cgl Xvz7QVx3t8BWo32xudsf+D952HX9r7ESS3FGoqEWc1FxIgDQoutfSAIAAA== X-CMS-MailID: 20200428012204eucas1p120a84e501d0d64145c21476cd2562f36 X-Msg-Generator: CA X-RootMTR: 20200428012204eucas1p120a84e501d0d64145c21476cd2562f36 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200428012204eucas1p120a84e501d0d64145c21476cd2562f36 References: Subject: [dpdk-dev] [PATCH] eal: fix lcore state bug 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The rte_service_lcore_reset_all function stops execution of services on all lcores and switches them back from ROLE_SERVICE to ROLE_RTE. However the thread loop for slave lcores (eal_thread_loop) distincts these roles to set lcore state after processing delegated function. It sets WAIT state for ROLE_SERVICE, but FINISHED for ROLE_RTE. So changing the role to RTE before stopping work in slave lcores causes lcores to end in FINISHED state. That is why the rte_eal_lcore_wait must be run after rte_service_lcore_reset_all to bring back lcores to launchable (WAIT) state. This has been fixed in test app and clarified in API documentation. Setting the state to WAIT in rte_service_runner_func is premature as the rte_service_runner_func function is still a part of the lcore function delegated to slave lcore. The state is overwritten anyway in slave lcore thread loop. This premature setting state to WAIT might however cause rte_eal_lcore_wait, that was called by the application, to return before slave lcore thread set the FINISHED state. That's why it is removed from librte_eal rte_service_runner_func function. Bugzilla ID: 464 Fixes: 21698354c832 ("service: introduce service cores concept") Fixes: f038a81e1c56 ("service: add unit tests") Cc: harry.van.haaren@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Tested-by: Ruifeng Wang Reviewed-by: Phil Yang --- app/test/test_service_cores.c | 1 + lib/librte_eal/common/rte_service.c | 2 -- lib/librte_eal/include/rte_service.h | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index a922c7ddc..2a4978e29 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -114,6 +114,7 @@ unregister_all(void) } rte_service_lcore_reset_all(); + rte_eal_mp_wait_lcore(); return TEST_SUCCESS; } diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 70d17a5d7..018876199 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -458,8 +458,6 @@ rte_service_runner_func(void *arg) rte_smp_rmb(); } - lcore_config[lcore].state = WAIT; - return 0; } diff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h index d8701dd4c..acdda8c54 100644 --- a/lib/librte_eal/include/rte_service.h +++ b/lib/librte_eal/include/rte_service.h @@ -300,6 +300,10 @@ int32_t rte_service_lcore_count(void); * from duty, just unmaps all services / cores, and stops() the service cores. * The runstate of services is not modified. * + * The cores that are stopped with this call, are in FINISHED state and + * the application must take care of bringing them back to a launchable state: + * e.g. call *rte_eal_lcore_wait* on the lcore_id. + * * @retval 0 Success */ int32_t rte_service_lcore_reset_all(void);