From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E6F0A00C2 for ; Thu, 3 Nov 2022 10:31:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 534E341156; Thu, 3 Nov 2022 10:31:54 +0100 (CET) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id 6650040693 for ; Thu, 3 Nov 2022 10:31:52 +0100 (CET) Received: by mail-wr1-f47.google.com with SMTP id l14so1749166wrw.2 for ; Thu, 03 Nov 2022 02:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=itnFp8dtqIivuZe4RfmkBt1vUuu3oxGSZTlAoi+MzzM=; b=e/CuUJgqGrFY1xmdTqyr2iDDdLw7V3zk/p1f0gHbMEoH2eKMzCBj1wlSYDXXys1vYN 1+YY3s3ayy1Wueky3bTDj+RHXerY6ibjAELAnyr/ixkgeDiDxDhZ3pF0EEPr8BdxmZMn naR6Kj+M2gEKC7h6pEaInpNZrENXYhKxb+dTZd2oy0kNMrRtyxM04ArvH4/o84utn2HM bwio5x+fsfingbbGb8tZwZP8JrXvHcrZXJGF2rcoEQe82FZ9PGI7NA2TRQuWHdyCNCp5 4r/0AKP3Z9YQ+E8WnSviaTQJP+QWm4XEI1jHnrUzkw0gEY4IqbtMhy92hxi9m7q0D3Bp //vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=itnFp8dtqIivuZe4RfmkBt1vUuu3oxGSZTlAoi+MzzM=; b=cfHovFnfubkCh7TwyxM0t4fIsYee/goVKV9qoGM/3OkQ0aWtCp+UU2+mExikcXXUGX 9yq8PAByxGQI+Bx2Nj/rWDP+8pF55pJDQITAkdxAI1lZs8d1zAkypMnKj+Nr1X9+Z43h Wj5d1k7sIvlyzBdHJwe40lGnNTFjySZ5cYQLDI3OX5A5MVYDPWra6ajhgQwrm/b/ilqK UPXDaGI34VwrlANwjBYkWWYCGuCRXgykyt1JQ1ZTg+/GWr75CE8yjZ0vQVyXS+zOKU1o D61d03uSt6t+GnCuVDuC+KF+cF/vQve6VXUD+37b1cQ5HHprM53SYxUVLy8+gylUgsoT cnWg== X-Gm-Message-State: ACrzQf0VKgkD8wbJgJFwdq2iY9AbdJFb6Psb5427yPyn88pV+R6pxIXI S6B1e5VdB6FwYkmxv2fyQgc= X-Google-Smtp-Source: AMsMyM48grsVUzbuUU3JUcQCnA2GhOQrpP1ritBjIR4NarXQWE562SsGp4xYN/zxRd28ucXqZMzhSA== X-Received: by 2002:a5d:544a:0:b0:236:77f4:6e15 with SMTP id w10-20020a5d544a000000b0023677f46e15mr18123760wrv.117.1667467912158; Thu, 03 Nov 2022 02:31:52 -0700 (PDT) Received: from localhost ([137.220.119.58]) by smtp.gmail.com with ESMTPSA id d15-20020adffd8f000000b00236488f62d6sm327015wrr.79.2022.11.03.02.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 02:31:51 -0700 (PDT) From: luca.boccassi@gmail.com To: Harry van Haaren Cc: David Marchand , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , =?UTF-8?q?Morten=20Br=C3=B8rup?= , dpdk stable Subject: patch 'test/service: fix spurious failures by extending timeout' has been queued to stable release 20.11.7 Date: Thu, 3 Nov 2022 09:27:26 +0000 Message-Id: <20221103092758.1099402-68-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103092758.1099402-1-luca.boccassi@gmail.com> References: <20221103092758.1099402-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 20.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/05/22. 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 This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/fa67204c3d10bb105b0a801a0601e26f0c255b19 Thanks. Luca Boccassi --- >From fa67204c3d10bb105b0a801a0601e26f0c255b19 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Thu, 6 Oct 2022 12:52:47 +0000 Subject: [PATCH] test/service: fix spurious failures by extending timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 6caffbb319ce8847696b9da1b05df8b631390835 ] This commit extends the timeout for service_may_be_active() from 100ms to 1000ms. Local testing on a idle and loaded system (compiling DPDK with all cores) always completes after 1 ms. The wait time for a service-lcore to finish is also extended from 100ms to 1000ms. The same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication. Reported-by: David Marchand Suggested-by: Mattias Rönnblom Signed-off-by: Harry van Haaren Acked-by: Morten Brørup Reviewed-by: Mattias Rönnblom --- app/test/test_service_cores.c | 49 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index 0aee8c04e3..4f4f450df1 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -22,6 +22,7 @@ static uint64_t service_tick; static uint32_t service_remote_launch_flag; #define SERVICE_DELAY 1 +#define TIMEOUT_MS 1000 #define DUMMY_SERVICE_NAME "dummy_service" #define MT_SAFE_SERVICE_NAME "mt_safe_service" @@ -119,15 +120,15 @@ unregister_all(void) return TEST_SUCCESS; } -/* Wait until service lcore not active, or for 100x SERVICE_DELAY */ +/* Wait until service lcore not active, or for TIMEOUT_MS */ static void wait_slcore_inactive(uint32_t slcore_id) { int i; for (i = 0; rte_service_lcore_may_be_active(slcore_id) == 1 && - i < 100; i++) - rte_delay_ms(SERVICE_DELAY); + i < TIMEOUT_MS; i++) + rte_delay_ms(1); } /* register a single dummy service */ @@ -903,12 +904,25 @@ service_lcore_start_stop(void) return unregister_all(); } +static int +service_ensure_stopped_with_timeout(uint32_t sid) +{ + /* give the service time to stop running */ + int i; + for (i = 0; i < TIMEOUT_MS; i++) { + if (!rte_service_may_be_active(sid)) + break; + rte_delay_ms(1); + } + + return rte_service_may_be_active(sid); +} + /* stop a service and wait for it to become inactive */ static int service_may_be_active(void) { const uint32_t sid = 0; - int i; /* expected failure cases */ TEST_ASSERT_EQUAL(-EINVAL, rte_service_may_be_active(10000), @@ -928,19 +942,11 @@ service_may_be_active(void) TEST_ASSERT_EQUAL(1, service_lcore_running_check(), "Service core expected to poll service but it didn't"); - /* stop the service */ + /* stop the service, and wait for not-active with timeout */ TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), "Error: Service stop returned non-zero"); - - /* give the service 100ms to stop running */ - for (i = 0; i < 100; i++) { - if (!rte_service_may_be_active(sid)) - break; - rte_delay_ms(SERVICE_DELAY); - } - - TEST_ASSERT_EQUAL(0, rte_service_may_be_active(sid), - "Error: Service not stopped after 100ms"); + TEST_ASSERT_EQUAL(0, service_ensure_stopped_with_timeout(sid), + "Error: Service not stopped after timeout period."); return unregister_all(); } @@ -954,7 +960,6 @@ service_active_two_cores(void) return TEST_SKIPPED; const uint32_t sid = 0; - int i; uint32_t lcore = rte_get_next_lcore(/* start core */ -1, /* skip main */ 1, @@ -984,16 +989,8 @@ service_active_two_cores(void) /* stop the service */ TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), "Error: Service stop returned non-zero"); - - /* give the service 100ms to stop running */ - for (i = 0; i < 100; i++) { - if (!rte_service_may_be_active(sid)) - break; - rte_delay_ms(SERVICE_DELAY); - } - - TEST_ASSERT_EQUAL(0, rte_service_may_be_active(sid), - "Error: Service not stopped after 100ms"); + TEST_ASSERT_EQUAL(0, service_ensure_stopped_with_timeout(sid), + "Error: Service not stopped after timeout period."); return unregister_all(); } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-03 09:27:29.483709777 +0000 +++ 0068-test-service-fix-spurious-failures-by-extending-time.patch 2022-11-03 09:27:25.489424686 +0000 @@ -1 +1 @@ -From 6caffbb319ce8847696b9da1b05df8b631390835 Mon Sep 17 00:00:00 2001 +From fa67204c3d10bb105b0a801a0601e26f0c255b19 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 6caffbb319ce8847696b9da1b05df8b631390835 ] + @@ -29 +31 @@ -index 359b6dcd8b..637fcd7cf9 100644 +index 0aee8c04e3..4f4f450df1 100644 @@ -40 +42 @@ -@@ -123,15 +124,15 @@ unregister_all(void) +@@ -119,15 +120,15 @@ unregister_all(void) @@ -59 +61 @@ -@@ -921,12 +922,25 @@ service_lcore_start_stop(void) +@@ -903,12 +904,25 @@ service_lcore_start_stop(void) @@ -86 +88 @@ -@@ -946,19 +960,11 @@ service_may_be_active(void) +@@ -928,19 +942,11 @@ service_may_be_active(void) @@ -109 +111 @@ -@@ -972,7 +978,6 @@ service_active_two_cores(void) +@@ -954,7 +960,6 @@ service_active_two_cores(void) @@ -117 +119 @@ -@@ -1002,16 +1007,8 @@ service_active_two_cores(void) +@@ -984,16 +989,8 @@ service_active_two_cores(void)