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 10AE8A04AF for ; Thu, 20 Aug 2020 17:34:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 081E71C0BC; Thu, 20 Aug 2020 17:34:24 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 88CAD1BEC4 for ; Thu, 20 Aug 2020 17:34:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597937662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QD7ut6mt5aaS7byyPu7CtT8aXa/17xCr2/iKd7V9ojI=; b=C0M9qjBZBnWyXnkgHzxHOXNo2t8F3qfPUkIUlCwUiH5An30OV/rHFpoj/rIeFKnJWEYafd tCe7VmRDIh+i5js+cbYw7ScVNo4IElW68e+o9XKZHISVbFXdmZfB7vMCU9QiigjotNnJYP r33clQAxVGQFYKJKTsGMvYNXDMW3CKg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-74-4vvL6xnvPOurZAbHTGfQ5w-1; Thu, 20 Aug 2020 11:34:16 -0400 X-MC-Unique: 4vvL6xnvPOurZAbHTGfQ5w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B5E68030B9; Thu, 20 Aug 2020 15:34:15 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10EC110027A6; Thu, 20 Aug 2020 15:34:13 +0000 (UTC) From: Kevin Traynor To: Lukasz Wojciechowski Cc: Sarosh Arif , Harry van Haaren , dpdk stable Date: Thu, 20 Aug 2020 16:33:15 +0100 Message-Id: <20200820153341.171927-10-ktraynor@redhat.com> In-Reply-To: <20200820153341.171927-1-ktraynor@redhat.com> References: <20200820153341.171927-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'service: fix core mapping reset' has been queued to LTS release 18.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" Hi, FYI, your patch has been queued to LTS release 18.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/25/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/369c28238f9bd69e530f527217cb502e3fd11916 Thanks. Kevin. --- >From 369c28238f9bd69e530f527217cb502e3fd11916 Mon Sep 17 00:00:00 2001 From: Lukasz Wojciechowski Date: Wed, 8 Jul 2020 15:37:33 +0200 Subject: [PATCH] service: fix core mapping reset [ upstream commit 048db4b6dcccaee9277ce5b4fbb2fe684b212e22 ] 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") Reported-by: Sarosh Arif Signed-off-by: Lukasz Wojciechowski Acked-by: Harry van Haaren --- lib/librte_eal/common/include/rte_service.h | 4 ++++ lib/librte_eal/common/rte_service.c | 2 -- test/test/test_service_cores.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 21002209bc..200e028778 100644 --- a/lib/librte_eal/common/include/rte_service.h +++ b/lib/librte_eal/common/include/rte_service.h @@ -308,4 +308,8 @@ int32_t rte_service_lcore_count(void); * 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 */ diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 607f9a0407..af1733eb09 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -447,6 +447,4 @@ service_runner_func(void *arg) } - lcore_config[lcore].state = WAIT; - return 0; } diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c index aa2174a332..c5150b6378 100644 --- a/test/test/test_service_cores.c +++ b/test/test/test_service_cores.c @@ -115,4 +115,5 @@ unregister_all(void) rte_service_lcore_reset_all(); + rte_eal_mp_wait_lcore(); return TEST_SUCCESS; -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-08-20 16:26:16.264728042 +0100 +++ 0010-service-fix-core-mapping-reset.patch 2020-08-20 16:26:15.778323907 +0100 @@ -1 +1 @@ -From 048db4b6dcccaee9277ce5b4fbb2fe684b212e22 Mon Sep 17 00:00:00 2001 +From 369c28238f9bd69e530f527217cb502e3fd11916 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 048db4b6dcccaee9277ce5b4fbb2fe684b212e22 ] + @@ -28 +29,0 @@ -Cc: stable@dpdk.org @@ -34,3 +35,3 @@ - app/test/test_service_cores.c | 1 + - lib/librte_eal/common/rte_service.c | 2 -- - lib/librte_eal/include/rte_service.h | 4 ++++ + lib/librte_eal/common/include/rte_service.h | 4 ++++ + lib/librte_eal/common/rte_service.c | 2 -- + test/test/test_service_cores.c | 1 + @@ -39,10 +40,13 @@ -diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c -index 4f003ed1af..ef1d8fcb9b 100644 ---- a/app/test/test_service_cores.c -+++ b/app/test/test_service_cores.c -@@ -115,4 +115,5 @@ unregister_all(void) - - rte_service_lcore_reset_all(); -+ rte_eal_mp_wait_lcore(); - - return TEST_SUCCESS; +diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h +index 21002209bc..200e028778 100644 +--- a/lib/librte_eal/common/include/rte_service.h ++++ b/lib/librte_eal/common/include/rte_service.h +@@ -308,4 +308,8 @@ int32_t rte_service_lcore_count(void); + * 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 + */ @@ -50 +54 @@ -index e2795f857e..6a0e0ff65d 100644 +index 607f9a0407..af1733eb09 100644 @@ -53 +57 @@ -@@ -476,6 +476,4 @@ service_runner_func(void *arg) +@@ -447,6 +447,4 @@ service_runner_func(void *arg) @@ -60,13 +64,10 @@ -diff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h -index 3a1c735c58..e2d0a6dd32 100644 ---- a/lib/librte_eal/include/rte_service.h -+++ b/lib/librte_eal/include/rte_service.h -@@ -305,4 +305,8 @@ int32_t rte_service_lcore_count(void); - * 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 - */ +diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c +index aa2174a332..c5150b6378 100644 +--- a/test/test/test_service_cores.c ++++ b/test/test/test_service_cores.c +@@ -115,4 +115,5 @@ unregister_all(void) + + rte_service_lcore_reset_all(); ++ rte_eal_mp_wait_lcore(); + + return TEST_SUCCESS;