Skip to contentSkip to conversation

selftests/futex_requeue: Increase futex timeout to cover slow hardware

PATCH In review Feng Tang 2 participants 3 messages Jul 3 – Jul 6

Subsystems (2)
lore
Share & tools
lore

Feng Tang

author
#0 lore raw

PATCH 1/1 selftests/futex_requeue: Increase futex timeout to cover slow hardware

When running mixed stress tests (stess-ng, kernel selftests etc.) on a slow machine, futex 'requeue_multiple' case failed randomly, with message:
"
waiter failed errno 110
not ok 2 futex_requeue many returned: 0 Success
not ok 3 futex_requeue many returned: 0 Success
# Planned tests != run tests (2 != 3)
# Totals: pass:1 fail:2 xfail:0 xpass:0 skip:0 error:0
"

The process of 'requeue_multiple' case will:
* create 10 pthreads with futex (timeout 30 ms)
* wait 10 ms
* start 'futex_cmp_requeue' case

So there is an assumption that the 10 threads can be created in 20 ms, which is safe enough for normal platforms, while for slow platforms with stress workload, the creation could take more than 20 ms, and some futex will timeout and cause the case to fail.

Increasing the timeout to 100 ms to cover slow platforms, which doesn't hurt normal platforms much.

---
 tools/testing/selftests/futex/functional/futex_requeue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/futex/functional/futex_requeue.c +1 -1
index dcf0d5f2f312..2df9e8dfb04c 100644
@@ -11,7 +11,7 @@
 #include "futextest.h"
 #include "kselftest_harness.h"
 
-#define timeout_ns  30000000
+#define timeout_ns  100000000
 #define WAKE_WAIT_US 10000
 
 volatile futex_t *f1;
Signature · 1 line
2.43.5
maintainer
#1 lore raw
Quoted 16 lines · Feng Tang

When running mixed stress tests (stess-ng, kernel selftests etc.) on a slow machine, futex 'requeue_multiple' case failed randomly, with message:
"
waiter failed errno 110
not ok 2 futex_requeue many returned: 0 Success
not ok 3 futex_requeue many returned: 0 Success
# Planned tests != run tests (2 != 3)
# Totals: pass:1 fail:2 xfail:0 xpass:0 skip:0 error:0
"

The process of 'requeue_multiple' case will:
* create 10 pthreads with futex (timeout 30 ms)
* wait 10 ms
* start 'futex_cmp_requeue' case

Quoted 7 lines

So there is an assumption that the 10 threads can be created in 20 ms, which is safe enough for normal platforms, while for slow platforms with stress workload, the creation could take more than 20 ms, and some futex will timeout and cause the case to fail.

Increasing the timeout to 100 ms to cover slow platforms, which doesn't hurt normal platforms much.

That's just lame and it hurts because it makes testing slower. If you'd had taken the time to search LKML for discusssions about this issue then you'd have noticed that there is work in progress to solve that properly.

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=locking/futex&id=157a9b22ff769e1a657aec6210df3ea896600eec

Thanks,

tglx

author Tested-by
#2 lore raw
Quoted 25 lines · Thomas Gleixner
Quoted 16 lines · Feng Tang

When running mixed stress tests (stess-ng, kernel selftests etc.) on a slow machine, futex 'requeue_multiple' case failed randomly, with message:
"
waiter failed errno 110
not ok 2 futex_requeue many returned: 0 Success
not ok 3 futex_requeue many returned: 0 Success
# Planned tests != run tests (2 != 3)
# Totals: pass:1 fail:2 xfail:0 xpass:0 skip:0 error:0
"

The process of 'requeue_multiple' case will:
* create 10 pthreads with futex (timeout 30 ms)
* wait 10 ms
* start 'futex_cmp_requeue' case

Quoted 7 lines

So there is an assumption that the 10 threads can be created in 20 ms, which is safe enough for normal platforms, while for slow platforms with stress workload, the creation could take more than 20 ms, and some futex will timeout and cause the case to fail.

Increasing the timeout to 100 ms to cover slow platforms, which doesn't hurt normal platforms much.

Quoted 6 lines

That's just lame and it hurts because it makes testing slower. If you'd had taken the time to search LKML for discusssions about this issue then you'd have noticed that there is work in progress to solve that properly.

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=locking/futex&id=157a9b22ff769e1a657aec6210df3ea896600eec

Thanks for the link!

Good to see it merged. Just tried the latest tip tree, and 'futex_requeue' did pass on our slow platform. (the timeout is now 2 seconds, which should cover it well).

I know 157a9b22ff76 ("selftests/futex: Use thread synchronization helpers instead of usleep() ") was merged, but FWIW:

Thanks,
Feng