From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88658A0526; Wed, 8 Jul 2020 15:37:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 86EF01D6F7; Wed, 8 Jul 2020 15:37:51 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 921A71D6F6 for ; Wed, 8 Jul 2020 15:37:50 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200708133749euoutp02286f5b9e1656cddde252163ede0c892c~fyoXzqVfE0728407284euoutp02X for ; Wed, 8 Jul 2020 13:37:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200708133749euoutp02286f5b9e1656cddde252163ede0c892c~fyoXzqVfE0728407284euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594215469; bh=AK2r3wVpGx/3zdcp8dtIclwTnKYEcbzU7S+40t8ZyYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FeEw5OP9yXPGZiOy0d2SdLTzcAImoXVSkCEYbhmqatW2p17aJbXbpOlL+lQofTfSZ gXQuB/JGtUfeKe8iio4awxh4HJ/sLicASNCGiaRhZFztuEAgy8upCf1cHBFwtTLKKm OAOaSrqpOr+PA/DNccieQ4qsTojBoebt409p+SrA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200708133749eucas1p1b79cca1a51871dbf4483cd5c42039553~fyoXi7Hht2906129061eucas1p1o; Wed, 8 Jul 2020 13:37:49 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id FF.88.06318.D2CC50F5; Wed, 8 Jul 2020 14:37:49 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200708133748eucas1p2dbe34d8605d8f618559daee9cbeaa73d~fyoXBexvS0380103801eucas1p2s; Wed, 8 Jul 2020 13:37:48 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200708133748eusmtrp269d5ed781cf21215dd6c6438821dc3fb~fyoXA6dLP1120011200eusmtrp2r; Wed, 8 Jul 2020 13:37:48 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-a9-5f05cc2d3878 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A6.55.06017.C2CC50F5; Wed, 8 Jul 2020 14:37:48 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200708133748eusmtip287b5ad338918b99712f553ed8abf4308~fyoWd9pvW1415614156eusmtip2a; Wed, 8 Jul 2020 13:37:48 +0000 (GMT) From: Lukasz Wojciechowski To: Harry van Haaren , Jerin Jacob Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 8 Jul 2020 15:37:33 +0200 Message-Id: <20200708133733.29468-1-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200428012139.32196-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFIsWRmVeSWpSXmKPExsWy7djP87q6Z1jjDWYvkLB492k7k0Vj/zcW i4mTTCye9axjtPjX8YfdgdVjw4l+Vo9fC5ayeize85LJ4+C7PUwBLFFcNimpOZllqUX6dglc GX/fCxcsEa/o37GZuYHxhHAXIyeHhICJxJ4jE9i6GLk4hARWMEqsWrCOEcL5wigxbXMTK4T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ADOIzSngJvG75wo7iC0EVLN/RRvrBEa+BYwMqxhFUkuLc9Nzi430ihNzi0vz 0vWS83M3MQIDctuxn1t2MHa9Cz7EKMDBqMTD+2ITa7wQa2JZcWXuIUYJDmYlEV6ns6fjhHhT EiurUovy44tKc1KLDzGaAh01kVlKNDkfGC15JfGGpobmFpaG5sbmxmYWSuK8HQIHY4QE0hNL UrNTUwtSi2D6mDg4pRoYjzLN/vvc5GnB6bOvtoefmVXpt2pmy7yqSt/repFH2euTM+WrvKY1 7w9L3bQh91xaY9yrEvt9Ei5f34jzHDxyUiS98uenzT6vNr49f+T727lid3fp8pTmG/fyvZ1p sWZLodWXvsdPJqZcFr7/hLfqrJr30o6r/7m2BTmzsf9VfZd4dPaKpWVvRJVYijMSDbWYi4oT AfbkEgxeAgAA X-CMS-MailID: 20200708133748eucas1p2dbe34d8605d8f618559daee9cbeaa73d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200708133748eucas1p2dbe34d8605d8f618559daee9cbeaa73d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200708133748eucas1p2dbe34d8605d8f618559daee9cbeaa73d References: <20200428012139.32196-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v2] 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 --- 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 981e21213..6764a5d2c 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 6123a2124..b16698f21 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -475,8 +475,6 @@ service_runner_func(void *arg) cs->loops++; } - 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 3a1c735c5..e2d0a6dd3 100644 --- a/lib/librte_eal/include/rte_service.h +++ b/lib/librte_eal/include/rte_service.h @@ -304,6 +304,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); -- 2.17.1