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 A42BAA0518 for ; Fri, 24 Jul 2020 14:07:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C6E81C134; Fri, 24 Jul 2020 14:07:35 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 93F571C1A5 for ; Fri, 24 Jul 2020 14:07:34 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id 184so8059862wmb.0 for ; Fri, 24 Jul 2020 05:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sYzYMsuYSzqYqBN3a/PwfGpt8vJFu2uEtd/FVMKCkek=; b=dUbS1S5fsYDoQBBhXE9cje14gCw5hwzoM3EGAZKuzV/IQJ6qsfXdnr4Kl+YvCN+t2k I4g6/Mmk9GAnxO+/j7+79obrO7iJiovh7eiDFKeysgB5tNLM+avwWlDSxMv9IYA1mysJ wNN7kaUM2RtktG8JudYQQabhRwegKx+DQqOjfkEsCULPAhh7qaU03ZFW5saruad0KZp3 QO773xJshGocyqHOOHaNqIyxrUsayzQqFFFuxbxlzRSyiaFQjMVQQ7Cbp5BSoq6M3Wgh zNy/uLuXiS6jHLFTcFhTe4c8VCmdk/ltsw5BD0dYYEhFssDT8QUzSHLBLu9t7gSY6az4 fMkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sYzYMsuYSzqYqBN3a/PwfGpt8vJFu2uEtd/FVMKCkek=; b=cimX+kSA5Ysu4iAlTVxiyPAkLVjIaW5GEv8r3ys4Ze6Rkfi33+A6BmS6zrtvy9Vmsf uWyDoUBlENE7WmxU/Tw+SAPOq7qT3Ss8VDFmjO/NRSwCjtqJ2ejuRlGhIgp1BAecyxPN GMfo8uP+RC3AQGWiHV9uBTqheqxKkN8bOXhlsg18VT0rLxk3VcdqfdFkYW5i6GB6oRCK ywAcU3885uBMEsoSkqiOy/Y9ymc7qyzNRLSGGN1ZfgjgcAy9fFOfeEndqE3myqnPaXVY TrCeUDXHdNXOgbIukKrFTncjaox3XBr/Zyh399NjnlWgC5AAKDSvD1+T8hlR1xuAqN5L 5xQA== X-Gm-Message-State: AOAM531eNKk3VQxROoclocua2z0Z9P3iWcsW7gLlsxsHNZFNMo5HB4Vv 3J6idybdYAetxdCRzcRHz60= X-Google-Smtp-Source: ABdhPJzGGVYvpaNhkIzg9rEM9zuuUY8bINsKIW85m9ZpIqYDISIuyN+vMHiEabUkb5r/pvqox8kyPA== X-Received: by 2002:a1c:2d89:: with SMTP id t131mr8808994wmt.151.1595592454215; Fri, 24 Jul 2020 05:07:34 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id 62sm1219171wrq.31.2020.07.24.05.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:07:33 -0700 (PDT) From: luca.boccassi@gmail.com To: Lukasz Wojciechowski Cc: Sarosh Arif , Harry van Haaren , dpdk stable Date: Fri, 24 Jul 2020 12:59:02 +0100 Message-Id: <20200724120030.1863487-104-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'service: fix core mapping reset' has been queued to stable release 19.11.4 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 stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/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. Thanks. Luca Boccassi --- >From cc8b7af31f74854edcb7124f56d976487bab7ed9 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 --- app/test/test_service_cores.c | 1 + lib/librte_eal/common/include/rte_service.h | 4 ++++ lib/librte_eal/common/rte_service.c | 2 -- 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/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 3a1c735c5..e2d0a6dd3 100644 --- a/lib/librte_eal/common/include/rte_service.h +++ b/lib/librte_eal/common/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); diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index eca6ccc59..8fcccac85 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -447,8 +447,6 @@ service_runner_func(void *arg) rte_smp_rmb(); } - lcore_config[lcore].state = WAIT; - return 0; } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:52.548982028 +0100 +++ 0104-service-fix-core-mapping-reset.patch 2020-07-24 12:53:48.347007578 +0100 @@ -1,8 +1,10 @@ -From 048db4b6dcccaee9277ce5b4fbb2fe684b212e22 Mon Sep 17 00:00:00 2001 +From cc8b7af31f74854edcb7124f56d976487bab7ed9 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 @@ -25,19 +27,18 @@ Bugzilla ID: 464 Fixes: 21698354c832 ("service: introduce service cores concept") Fixes: f038a81e1c56 ("service: add unit tests") -Cc: stable@dpdk.org Reported-by: Sarosh Arif Signed-off-by: Lukasz Wojciechowski Acked-by: Harry van Haaren --- - app/test/test_service_cores.c | 1 + - lib/librte_eal/common/rte_service.c | 2 -- - lib/librte_eal/include/rte_service.h | 4 ++++ + app/test/test_service_cores.c | 1 + + lib/librte_eal/common/include/rte_service.h | 4 ++++ + lib/librte_eal/common/rte_service.c | 2 -- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c -index 4f003ed1a..ef1d8fcb9 100644 +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) @@ -48,23 +49,10 @@ return TEST_SUCCESS; } -diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c -index e2795f857..6a0e0ff65 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 +diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 3a1c735c5..e2d0a6dd3 100644 ---- a/lib/librte_eal/include/rte_service.h -+++ b/lib/librte_eal/include/rte_service.h +--- a/lib/librte_eal/common/include/rte_service.h ++++ b/lib/librte_eal/common/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. @@ -76,6 +64,19 @@ * @retval 0 Success */ int32_t rte_service_lcore_reset_all(void); +diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c +index eca6ccc59..8fcccac85 100644 +--- a/lib/librte_eal/common/rte_service.c ++++ b/lib/librte_eal/common/rte_service.c +@@ -447,8 +447,6 @@ service_runner_func(void *arg) + rte_smp_rmb(); + } + +- lcore_config[lcore].state = WAIT; +- + return 0; + } + -- 2.20.1