From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 5C3C01B173 for ; Wed, 24 Jan 2018 16:36:18 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0F7A822308; Wed, 24 Jan 2018 10:36:18 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:36:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=3NCUmu9nfDrudDifY 91G+1cPhbc8gL4+T4/ve1qCFng=; b=I/NVQQjIWBohTXTJQk/lr2PMgDlu+gM17 vpIiyMUBPaGiCijvmVrxx7YcXrTUj23wsh4l94E6UIJxmxezF242w4V+Fn3ciWMA OcPsizTFg8lSKNiY2tt9iDpFgpbVQnmbiJfsUJLLOhJD/XxxgYZIzLwzeXZcQcCx AUy+glq5GvCrHmi8gsqnboslQRmV4c8syQcfHbVia9fBLe6g1ddg5CAJ9y9g/WXd V0PuoEK/cvIQc5ubZgi7UUPv7PKZP3euZHoIXtwLTqcpda3avDdP4avrKb2LIPCL QweloC13oM7zwDZwudybm+xAqfreqsfRBfJeLRjwFuqubAkoEgRwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=3NCUmu9nfDrudDifY91G+1cPhbc8gL4+T4/ve1qCFng=; b=eT6JN8v0 NG9CmRPLioN20oph3+8nCiIttq47QyDnOn2Uuan1VfwcA7Mbj/cV90phjpu9FEjX bmSO5yiJweOVybH6R1s7pKTnCMHTkscb56Y2iDpGRKMGVs/h7JDKqMfMDaUOklk1 tVgHtF7FcNIX/yq5+WFqsqWec8Bi1K+co6HUmKbucfmcV/j952chGxB8hsgbGg8W kSoRxGOp9GS2nH95K+5/D6CLwrbJZqX+Mo7RweSgPjBvC+8MMxrXgBj0bGC9sl2+ UYl6GayhE2k9EMp+C6rAVe/1Irwe3fzrOY+gxCC/qgU7i0ZLwzvG/PO3mrYbXeB2 wCiofZ9YIqFZ+Q== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id CEF847E1A2; Wed, 24 Jan 2018 10:36:15 -0500 (EST) From: Yuanhan Liu To: Harry van Haaren Cc: Pavan Nikhilesh , dpdk stable Date: Wed, 24 Jan 2018 23:31:18 +0800 Message-Id: <1516808026-25523-10-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'service: fix service core launch' has been queued to LTS release 17.11.1 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: , X-List-Received-Date: Wed, 24 Jan 2018 15:36:18 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/26/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 5f08be4f43eb9ed21378092de389344a100588a0 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Tue, 9 Jan 2018 13:37:41 +0000 Subject: [PATCH] service: fix service core launch [ upstream commit 72e6d1b94bd7c173af0500369e5bc34be8e58ec1 ] This patch fixes a potential bug, which was not consistently showing up in the unit tests. The issue was that the service- lcore being started was not in a "WAIT" state, and hence EAL would return -EBUSY instead of launching the lcore. In order to ensure a core is in a launch-ready state, the application must call rte_eal_wait_lcore, to ensure that the core has completed its previous task, and that EAL is ready to re-launch it. The call to rte_eal_wait_lcore() is explicitly not in the service core function, to make it visible to the application. Requiring an explicit function call ensures the developer sees that a lcore could block in the rte_eal_wait_lcore() function if the core hasn't returned from its previous function. >>From a usability perspective, hiding the wait_lcore() inside service cores would cause confusion. This patch adds rte_eal_wait_lcore() calls to the unit tests, to ensure that the lcores for testing functionality are ready to run the test. Fixes: 21698354c832 ("service: introduce service cores concept") Signed-off-by: Harry van Haaren Acked-by: Pavan Nikhilesh --- lib/librte_eal/common/include/rte_service.h | 4 +++- test/test/test_service_cores.c | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h index 9272440..495b531 100644 --- a/lib/librte_eal/common/include/rte_service.h +++ b/lib/librte_eal/common/include/rte_service.h @@ -274,7 +274,9 @@ int32_t rte_service_run_iter_on_app_lcore(uint32_t id, * Start a service core. * * Starting a core makes the core begin polling. Any services assigned to it - * will be run as fast as possible. + * will be run as fast as possible. The application must ensure that the lcore + * is in a launchable state: e.g. call *rte_eal_lcore_wait* on the lcore_id + * before calling this function. * * @retval 0 Success * @retval -EINVAL Failed to start core. The *lcore_id* passed in is not diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c index 311c704..ebff8b0 100644 --- a/test/test/test_service_cores.c +++ b/test/test/test_service_cores.c @@ -348,6 +348,7 @@ service_lcore_en_dis_able(void) /* call remote_launch to verify that app can launch ex-service lcore */ service_remote_launch_flag = 0; + rte_eal_wait_lcore(slcore_id); int ret = rte_eal_remote_launch(service_remote_launch_func, NULL, slcore_id); TEST_ASSERT_EQUAL(0, ret, "Ex-service core remote launch failed."); @@ -362,7 +363,7 @@ static int service_lcore_running_check(void) { uint64_t tick = service_tick; - rte_delay_ms(SERVICE_DELAY * 10); + rte_delay_ms(SERVICE_DELAY * 100); /* if (tick != service_tick) we know the lcore as polled the service */ return tick != service_tick; } @@ -505,6 +506,10 @@ service_threaded_test(int mt_safe) if (!mt_safe) test_params[1] = 1; + /* wait for lcores before start() */ + rte_eal_wait_lcore(slcore_1); + rte_eal_wait_lcore(slcore_2); + rte_service_lcore_start(slcore_1); rte_service_lcore_start(slcore_2); @@ -518,6 +523,8 @@ service_threaded_test(int mt_safe) TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), "Failed to stop MT Safe service"); + rte_eal_wait_lcore(slcore_1); + rte_eal_wait_lcore(slcore_2); unregister_all(); /* return the value of the callback pass_test variable to caller */ @@ -611,6 +618,7 @@ service_app_lcore_poll_impl(const int mt_safe) rte_service_runstate_set(id, 1); uint32_t app_core2 = rte_get_next_lcore(slcore_id, 1, 1); + rte_eal_wait_lcore(app_core2); int app_core2_ret = rte_eal_remote_launch(service_run_on_app_core_func, &id, app_core2); -- 2.7.4