test/service: fix spurious failures by extending timeout
PATCH 1/1 test/service: fix spurious failures by extending timeout
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 same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication.
--- app/test/test_service_cores.c | 43 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 23 deletions(-)
app/test/test_service_cores.c +20 -23
@@ -921,12 +921,26 @@ 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 */ +int32_t timeout_ms =1000 ; +int i; +for (i =0 ; i < timeout_ms; i++) { +if (!rte_service_may_be_active (sid)) +break ; +rte_delay_ms (SERVICE_DELAY ); + } + +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),
@@ -946,19 +960,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 (); }
@@ -972,7 +978,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,
@@ -1002,16 +1007,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 (); }
Signature · 1 line
2.34.1
PATCH v2 1/1 test/service: fix spurious failures by extending timeout
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.
---
Apologies for the quick respin noise; only the first diff-section is added, no changes to the rest of the patch.
v2:
- v1 addressed only testcase 15 issue, v2 also addresses test case 5, which has an service-lcore wait code-path.
--- app/test/test_service_cores.c | 47 ++++++++++++++++------------------- 1 file changed, 22 insertions(+), 25 deletions(-)
app/test/test_service_cores.c +22 -25
@@ -123,14 +123,14 @@ 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 N times SERVICE_DELAY */ 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++) + i <1000 ; i++)rte_delay_ms (SERVICE_DELAY ); }
@@ -921,12 +921,26 @@ 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 */ +int32_t timeout_ms =1000 ; +int i; +for (i =0 ; i < timeout_ms; i++) { +if (!rte_service_may_be_active (sid)) +break ; +rte_delay_ms (SERVICE_DELAY ); + } + +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),
@@ -946,19 +960,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 (); }
@@ -972,7 +978,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,
@@ -1002,16 +1007,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 (); }
Signature · 1 line
2.34.1
Quoted 8 lines · Harry van Haaren
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.
Quoted 6 lines
The same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication.
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>
Just to be sure, do we want such a timeout in the test logic itself? Is it that you want to make sure that the synchronisation happens in a "reasonable" (subject to discussion ;-)) amount of time?
Otherwise, the unit tests run in the CI are themselves subject to a 10s x mutiplier timeout (-t meson test option).
And then I would rely on this overall timeout.
Signature · 1 line
David Marchand
Quoted 10 lines · David Marchand
Quoted 8 lines · Harry van Haaren
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.
Quoted 8 lines
Quoted 6 lines
The same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication.
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>Just to be sure, do we want such a timeout in the test logic itself?
I think it depends on how quickly you want to produce a failure, and also if there are some follow-up tests in the same autotest that you want to proceed with, regardless of the outcome.
Quoted 8 lines
Is it that you want to make sure that the synchronisation happens in a "reasonable" (subject to discussion ;-)) amount of time?
Otherwise, the unit tests run in the CI are themselves subject to a 10s x mutiplier timeout (-t meson test option).
And then I would rely on this overall timeout.
Quoted 19 lines · Harry van Haaren
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 same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication.
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>--- app/test/test_service_cores.c | 43 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 23 deletions(-)app/test/test_service_cores.c +0
-0
app/test/test_service_cores.c service_lcore_start_stop(void) · line 928
Quoted 8 lines
app/test/test_service_cores.c +5
-0@@ -921,12 +921,26 @@ 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 */ + int32_t timeout_ms = 1000; > + int i;
i and timeout_ms should have the same type. Or better, have timeout_ms as a #define (in ms).
1 s timeout seems reasonable to me.
app/test/test_service_cores.c service_lcore_start_stop(void) · line 933
Quoted 4 lines
app/test/test_service_cores.c +4
-0+for (i =0 ; i < timeout_ms; i++) { +if (!rte_service_may_be_active (sid)) +break ; +rte_delay_ms (SERVICE_DELAY );
rte_delay_ms(1);
Quoted 64 lines
app/test/test_service_cores.c +10
-23+ } + +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),@@ -946,19 +960,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 (); }@@ -972,7 +978,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,@@ -1002,16 +1007,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 (); }
PATCH v3 1/1 test/service: fix spurious failures by extending timeout
In reply to Harry van HaarenThis 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.
---
v3:
- Use #define for timeout, and delay(1) (Mattias)
- Rework slcore-wait to use TIMEOUT_MS as well.
v2:
- v1 addressed only testcase 15 issue, v2 also addresses test case 5, which has an service-lcore wait code-path.
--- app/test/test_service_cores.c | 49 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 26 deletions(-)
app/test/test_service_cores.c +23 -26
@@ -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"
@@ -123,15 +124,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 */
@@ -921,12 +922,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),
@@ -946,19 +960,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 (); }
@@ -972,7 +978,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,
@@ -1002,16 +1007,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 (); }
Signature · 1 line
2.34.1
Quoted 10 lines
From: Harry van Haaren [mailto:[email protected]]
Sent: Thursday, 6 October 2022 14.53This 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.
Quoted 8 lines
The same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication.
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>---
David Marchand
Reviewed-by Mattias RönnblomQuoted 7 lines · Morten Brørup
Quoted 7 lines
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.
Quoted 7 lines
Quoted 6 lines
The same timeout waiting code was duplicated in two tests, and is now refactored to a standalone function avoiding duplication.
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>Acked-by Morten Brørup <[email protected]>
Ok, let's see if the situation gets better with this. Applied, thanks.
Signature · 1 line
David Marchand
Hello Harry,
Quoted 12 lines · David Marchand
Quoted 10 lines · Morten Brørup
Quoted 10 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>Acked-by Morten Brørup <[email protected]>Reviewed-by Mattias Rönnblom <[email protected]>Ok, let's see if the situation gets better with this. Applied, thanks.
I took a look at the january month failures at UNH.
Downloads/dpdk_31608e4db568_2023-01-03_06-58-00_NA/out/testlog.txt:EAL:
Test assert service_lcore_attr_get line 422 failed: Service lcore not stopped after waiting.
Extending the timeout just made it less likely.
On a similar note, other parts are failing every once in a while:
Downloads/dpdk_2a211079a92e_25064_2023-01-24_15-08-50_NA/out/testlog.txt:EAL:
Test assert service_attr_get line 319 failed: attr_get() failed to get cycles (expected > zero) Downloads/dpdk_2a211079a92e_25074_2023-01-25_05-40-46_NA/out/testlog.txt:EAL:
Test assert service_lcore_start_stop line 900 failed: Service core expected to poll service but it didn't Downloads/dpdk_2a211079a92e_25075_2023-01-25_09-15-58_NA/out/testlog.txt:EAL:
Test assert service_lcore_start_stop line 900 failed: Service core expected to poll service but it didn't Downloads/dpdk_373f4c7de8ff_24866_2023-01-03_22-56-01_NA/out/testlog.txt:EAL:
Test assert service_lcore_start_stop line 900 failed: Service core expected to poll service but it didn't Downloads/dpdk_83397b9f0739_25030_2023-01-18_18-30-19_NA/out/testlog.txt:EAL:
Test assert service_lcore_start_stop line 901 failed: Service core expected to poll service but it didn't
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?
Thanks.
Signature · 1 line
David Marchand
Quoted 11 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, January 26, 2023 9:30 AM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; mattias.ronnblom <[email protected]>; [email protected]; Morten Brørup <[email protected]>; Tyler Retzlaff <[email protected]>; Aaron Conole <[email protected]>
Subject: Re: [PATCH v3] test/service: fix spurious failures by extending timeout
Quoted 1 line
Hello Harry,
Hi David,
Quoted 24 lines
Quoted 2 lines · David Marchand
On Thu, Oct 6, 2022 at 3:27 PM Morten Brørup <[email protected]>
Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 10 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Reported-by David Marchand <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>Acked-by Morten Brørup <[email protected]>Reviewed-by Mattias Rönnblom <[email protected]>Ok, let's see if the situation gets better with this. Applied, thanks.
Quoted 6 lines
I took a look at the january month failures at UNH.
Downloads/dpdk_31608e4db568_2023-01-03_06-58-00_NA/out/testlog.txt:EAL:
Test assertservice_lcore_attr_getline 422 failed: Service lcore not stopped after waiting.
Extending the timeout just made it less likely.
Aha, okay.
<snip>
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?
I'll investigate various approaches on Thursday and reply here with suggested next steps.
Regards, -Harry
Quoted 10 lines
-----Original Message-----
From: Van Haaren, Harry
Sent: Tuesday, January 31, 2023 5:25 PM
To: David Marchand <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; mattias.ronnblom <[email protected]>; [email protected]; Morten Brørup <[email protected]>; Tyler Retzlaff <[email protected]>; Aaron Conole <[email protected]>
Subject: RE: [PATCH v3] test/service: fix spurious failures by extending timeout
<snip>
Quoted 8 lines
<snip>
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?I'll investigate various approaches on Thursday and reply here with suggested next steps.
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the "failure".
Option 1)
One option is to while(1) loop, waiting for the service-thread to be scheduled. This can be seen as "increasing the timeout", however in this case the test-case would be errored not in the test-code, but in the meson-test runner as a timeout (with a 10sec default?) The benefit here is that massively increasing (~1sec or less to 10 sec) will cover all/many of the CI timeouts.
Option 2)
Move to perf-tests, and not run these in a noisy-CI environment where the results are not consistent enough to have value. This would mean that the tests are not run in CI for the 3 checks in question are below, they all *require* the service core to be scheduled:service_attr_get() -> requires service core to run for service stats to increment service_lcore_attr_get() -> requires service core to run for lcore stats to increment service_lcore_start_stop() -> requires service to run to to ensure service-func itself executes.
I don't see how we can "improve" option 2 to not require the service-thread to be scheduled by the OS.. And the only way to make the OS schedule it in the CI more consistently is to give it more time?
Thoughts and input welcomed, I'm happy to make the code changes themselves, its small effort For both option 1 & 2.
Regards, -Harry
Quoted 19 lines · Harry
Quoted 10 lines
-----Original Message-----
From: Van Haaren, Harry
Sent: Tuesday, January 31, 2023 5:25 PM
To: David Marchand <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; mattias.ronnblom <[email protected]>; [email protected]; Morten Brørup <[email protected]>; Tyler Retzlaff <[email protected]>; Aaron Conole <[email protected]>
Subject: RE: [PATCH v3] test/service: fix spurious failures by extending timeout<snip>
Quoted 6 lines
<snip>
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?
Quoted 7 lines
Quoted 2 lines
I'll investigate various approaches on Thursday and reply here with suggested next steps.
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the "failure".
For me, the question is - why hasn't the service-core been scheduled? Can we use sched-yield or some other mechanism to force a wakeup of it?
/Bruce
03/02/2023 16:12, Bruce Richardson:
Quoted 13 lines · Harry
Quoted 12 lines
From: Van Haaren, Harry
<snip>
Quoted 7 lines
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?I'll investigate various approaches on Thursday and reply here with suggested next steps.
Quoted 6 lines
Quoted 3 lines
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the "failure".For me, the question is - why hasn't the service-core been scheduled? Can we use sched-yield or some other mechanism to force a wakeup of it?
Harry, you didn't reply to this question please.
Quoted 29 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, February 23, 2023 8:11 PM
To: Van Haaren, Harry <[email protected]>; [email protected]
Cc: David Marchand <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; mattias.ronnblom <[email protected]>; Morten Brørup <[email protected]>; Tyler Retzlaff <[email protected]>; Aaron Conole <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [PATCH v3] test/service: fix spurious failures by extending timeout03/02/2023 16:12, Bruce Richardson:
Quoted 10 lines · Harry
Quoted 9 lines
From: Van Haaren, Harry
<snip>
Quoted 5 lines
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
I'll investigate various approaches on Thursday and reply here with suggested next steps.
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the
Quoted 6 lines
"failure".
Quoted 3 lines
For me, the question is - why hasn't the service-core been scheduled? Can we use sched-yield or some other mechanism to force a wakeup of it?
Harry, you didn't reply to this question please.
Same answer as similar topic in the other thread:
Quoted 4 lines
Quoted 4 lines
I'm not aware of a way to make *a specific other pthread* wakeup. We could sacrifice the current lcore that's waiting for the service-lcore, with a
sched_yield()as you suggest. It would potentially "churn" the scheduler enough to give the service core some CPU? It's a guess/gamble in the end, kind of like the timeouts we have today..
Patch sent as requested in other email.
03/02/2023 16:03, Van Haaren, Harry:
Quoted 28 lines
From: Van Haaren, Harry
Quoted 7 lines
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?I'll investigate various approaches on Thursday and reply here with suggested next steps.
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the "failure".Option 1)
One option is to while(1) loop, waiting for the service-thread to be scheduled. This can be seen as "increasing the timeout", however in this case the test-case would be errored not in the test-code, but in the meson-test runner as a timeout (with a 10sec default?) The benefit here is that massively increasing (~1sec or less to 10 sec) will cover all/many of the CI timeouts.Option 2)
Move to perf-tests, and not run these in a noisy-CI environment where the results are not consistent enough to have value. This would mean that the tests are not run in CI for the 3 checks in question are below, they all *require* the service core to be scheduled:service_attr_get()-> requires service core to run for service stats to incrementservice_lcore_attr_get()-> requires service core to run for lcore stats to incrementservice_lcore_start_stop()-> requires service to run to to ensure service-func itself executes.
Quoted 2 lines
I don't see how we can "improve" option 2 to not require the service-thread to be scheduled by the OS.. And the only way to make the OS schedule it in the CI more consistently is to give it more time?
We are talking about seconds.
There are setups where scheduling a thread is taking seconds?
Quoted 2 lines
Thoughts and input welcomed, I'm happy to make the code changes themselves, its small effort For both option 1 & 2.
For time-sensitive tests, yes they should be in perf tests category. As David said earlier, no timeout approach in functional tests.
Quoted 51 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, February 3, 2023 3:16 PM
To: David Marchand <[email protected]>; Van Haaren, Harry <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; mattias.ronnblom <[email protected]>; Morten Brørup <[email protected]>; Tyler Retzlaff <[email protected]>; Aaron Conole <[email protected]>
Subject: Re: [PATCH v3] test/service: fix spurious failures by extending timeout03/02/2023 16:03, Van Haaren, Harry:
Quoted 6 lines
From: Van Haaren, Harry
Quoted 5 lines
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?Quoted 6 lines
Quoted 2 lines
I'll investigate various approaches on Thursday and reply here with suggested next steps.
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the"failure".
Quoted 3 lines
Option 1)
One option is to while(1) loop, waiting for the service-thread to be scheduled.This can be
Quoted 1 line
seen as "increasing the timeout", however in this case the test-case would be
errored
Quoted 1 line
not in the test-code, but in the meson-test runner as a timeout (with a 10sec
default?)
Quoted 1 line
The benefit here is that massively increasing (~1sec or less to 10 sec) will cover
all/many
Quoted 4 lines
of the CI timeouts.
Option 2)
Move to perf-tests, and not run these in a noisy-CI environment where theresults are not
Quoted 1 line
consistent enough to have value. This would mean that the tests are not run in
CI for the
Quoted 1 line
3 checks in question are below, they all *require* the service core to be
scheduled:
Quoted 2 lines
service_attr_get()-> requires service core to run for service stats to incrementservice_lcore_attr_get()-> requires service core to run for lcore stats toincrement
Quoted 1 line
service_lcore_start_stop()-> requires service to run to to ensure service-funcitself executes.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
I don't see how we can "improve" option 2 to not require the service-thread to
be scheduled by the OS..
Quoted 1 line
And the only way to make the OS schedule it in the CI more consistently is to
give it more time?
We are talking about seconds.
There are setups where scheduling a thread is taking seconds?
Apparently so - otherwise these tests would always pass.
They *only* fail at random runs in CI, and reliably pass everywhere else.. I've not had them fail locally, and that includes running in a loop for hours with a busy system.. but not a low-priority CI VM in a busy datacenter.
[Bruce wrote in separate mail]
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
For me, the question is - why hasn't the service-core been scheduled? Can we use sched-yield or some other mechanism to force a wakeup of it?
I'm not aware of a way to make *a specific other pthread* wakeup. We could sacrifice the current lcore that's waiting for the service-lcore, with a sched_yield() as you suggest. It would potentially "churn" the scheduler enough to give the service core some CPU? It's a guess/gamble in the end, kind of like the timeouts we have today..
Quoted 6 lines
Quoted 1 line
Thoughts and input welcomed, I'm happy to make the code changes
themselves, its small effort
Quoted 1 line
For both option 1 & 2.
For time-sensitive tests, yes they should be in perf tests category. As David said earlier, no timeout approach in functional tests.
Ok, as before, option 1) is to while(1) and wait for "success". Then there's no timeout in the test code, but our meson test runner will time-out/fail after ~10sec IIRC.
Or we move the tests perf-tests, as per Option 2), and these simply won't run in CI.
I'm OK with all 3 (including testing with sched_yield() for a month or two and if that helps?)
03/02/2023 17:09, Van Haaren, Harry:
Quoted 48 lines
From: Thomas Monjalon <[email protected]>
Quoted 39 lines
03/02/2023 16:03, Van Haaren, Harry:
Quoted 6 lines
From: Van Haaren, Harry
Quoted 5 lines
Quoted 4 lines
The timeout approach just does not have its place in a functional test. Either this test is rewritten, or it must go to the performance tests list so that we stop getting false positives.
Can you work on this?Quoted 6 lines
Quoted 2 lines
I'll investigate various approaches on Thursday and reply here with suggested next steps.
I've identified 3 checks that fail in CI (from the above log outputs), all 3 cases Have different dlays: 100 ms delay, 200 ms delay and 1000ms.
In the CI, the service-core just hasn't been scheduled (yet) and causes the"failure".
Quoted 3 lines
Option 1)
One option is to while(1) loop, waiting for the service-thread to be scheduled.This can be
Quoted 1 line
seen as "increasing the timeout", however in this case the test-case would be
errored
Quoted 1 line
not in the test-code, but in the meson-test runner as a timeout (with a 10sec
default?)
Quoted 1 line
The benefit here is that massively increasing (~1sec or less to 10 sec) will cover
all/many
Quoted 4 lines
of the CI timeouts.
Option 2)
Move to perf-tests, and not run these in a noisy-CI environment where theresults are not
Quoted 1 line
consistent enough to have value. This would mean that the tests are not run in
CI for the
Quoted 1 line
3 checks in question are below, they all *require* the service core to be
scheduled:
Quoted 2 lines
service_attr_get()-> requires service core to run for service stats to incrementservice_lcore_attr_get()-> requires service core to run for lcore stats toincrement
Quoted 1 line
service_lcore_start_stop()-> requires service to run to to ensure service-funcitself executes.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
I don't see how we can "improve" option 2 to not require the service-thread to
be scheduled by the OS..
Quoted 1 line
And the only way to make the OS schedule it in the CI more consistently is to
give it more time?
We are talking about seconds.
There are setups where scheduling a thread is taking seconds?
Quoted 8 lines
Apparently so - otherwise these tests would always pass.
They *only* fail at random runs in CI, and reliably pass everywhere else.. I've not had them fail locally, and that includes running in a loop for hours with a busy system.. but not a low-priority CI VM in a busy datacenter.
[Bruce wrote in separate mail]
Bruce was not Cc'ed in this reply.
Quoted 15 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
For me, the question is - why hasn't the service-core been scheduled? Can we use sched-yield or some other mechanism to force a wakeup of it?
I'm not aware of a way to make *a specific other pthread* wakeup. We could sacrifice the current lcore that's waiting for the service-lcore, with a
sched_yield()as you suggest. It would potentially "churn" the scheduler enough to give the service core some CPU? It's a guess/gamble in the end, kind of like the timeouts we have today..Quoted 6 lines
Quoted 1 line
Thoughts and input welcomed, I'm happy to make the code changes
themselves, its small effort
Quoted 1 line
For both option 1 & 2.
For time-sensitive tests, yes they should be in perf tests category. As David said earlier, no timeout approach in functional tests.
Quoted 6 lines
Ok, as before, option 1) is to while(1) and wait for "success". Then there's no timeout in the test code, but our meson test runner will time-out/fail after ~10sec IIRC.
Or we move the tests perf-tests, as per Option 2), and these simply won't run in CI.
I'm OK with all 3 (including testing with
sched_yield()for a month or two and if that helps?)
Did you send a patch to go in a direction or another?
If not, please move the test to perf-test as suggested before. We are still hitting the issues in the CI and it is *very* annoying. It is consuming time of a lot of people for a lot of patches, just to check it is again an issue with this test.
Please let's remove this test from the CI now.
Quoted 11 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, February 23, 2023 8:15 PM
To: Van Haaren, Harry <[email protected]>
Cc: David Marchand <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; mattias.ronnblom <[email protected]>; Morten Brørup <[email protected]>; Tyler Retzlaff <[email protected]>; Aaron Conole <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [PATCH v3] test/service: fix spurious failures by extending timeout
<snip>
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
We are talking about seconds.
There are setups where scheduling a thread is taking seconds?Apparently so - otherwise these tests would always pass.
They *only* fail at random runs in CI, and reliably pass everywhere else.. I've not
Quoted 8 lines
had
Quoted 5 lines
them fail locally, and that includes running in a loop for hours with a busy system.. but not a low-priority CI VM in a busy datacenter.
[Bruce wrote in separate mail]
Bruce was not Cc'ed in this reply.
Correct, I missed that he wasn't on the thread already, thanks for adding him on CC.
Quoted 28 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
For me, the question is - why hasn't the service-core been scheduled? Can we use sched-yield or some other mechanism to force a wakeup of it?
I'm not aware of a way to make *a specific other pthread* wakeup. We could
sacrifice
Quoted 1 line
the current lcore that's waiting for the service-lcore, with a
sched_yield()as yousuggest.
Quoted 1 line
It would potentially "churn" the scheduler enough to give the service core some
CPU?
Quoted 11 lines
It's a guess/gamble in the end, kind of like the timeouts we have today..
Quoted 6 lines
Quoted 1 line
Thoughts and input welcomed, I'm happy to make the code changes
themselves, its small effort
Quoted 1 line
For both option 1 & 2.
For time-sensitive tests, yes they should be in perf tests category. As David said earlier, no timeout approach in functional tests.
Ok, as before, option 1) is to while(1) and wait for "success". Then there's no timeout in the test code, but our meson test runner will time-out/fail after
~10sec IIRC.
Quoted 2 lines
Or we move the tests perf-tests, as per Option 2), and these simply won't run in
CI.
Quoted 2 lines
I'm OK with all 3 (including testing with
sched_yield()for a month or two and ifthat helps?)
Quoted 7 lines
Did you send a patch to go in a direction or another?
If not, please move the test to perf-test as suggested before. We are still hitting the issues in the CI and it is *very* annoying. It is consuming time of a lot of people for a lot of patches, just to check it is again an issue with this test.Please let's remove this test from the CI now.
Patch sent: http://patches.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 125 lines · Harry van Haaren
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 <[email protected]>Suggested-by Mattias Ronnblom <[email protected]>Signed-off-by Harry van Haaren <[email protected]>---
v3:
- Use #define for timeout, and delay(1) (Mattias)
- Rework slcore-wait to useTIMEOUT_MSas well.v2:
- v1 addressed only testcase 15 issue, v2 also addresses test case 5, which has an service-lcore wait code-path.--- app/test/test_service_cores.c | 49 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 26 deletions(-)app/test/test_service_cores.c +21
-21@@ -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"@@ -123,15 +124,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 */ @@ -921,12 +922,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),@@ -946,19 +960,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 (); }@@ -972,7 +978,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,@@ -1002,16 +1007,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 ;
app/test/test_service_cores.c service_active_two_cores(void) · line 1014
Quoted 10 lines
app/test/test_service_cores.c +2
-5-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 (); }