[PATCH] selftests/sched_ext: Skip cyclic_kick_wait on kernels without deadlock fix
From: Cheng-Yang Chou
Date: Sun Mar 29 2026 - 04:07:05 EST
The cyclic_kick_wait test triggers a deadlock on kernels lacking the
SCX_KICK_WAIT fix, causing the machine to hang or worker threads to
timeout (-110).
Use __COMPAT_struct_has_field() to probe vmlinux BTF for
rq_scx.kick_sync_pending, a field introduced by the SCX_KICK_WAIT
deadlock fix. Skip the test on older kernels that lack the fix rather
than hanging the machine.
Example failure on unpatched kernels:
ERR: cyclic_kick_wait.c:169
Failed to join worker thread 0 (-110)
Fixes: e9b990b76922 ("selftests/sched_ext: Add cyclic SCX_KICK_WAIT stress test")
Signed-off-by: Cheng-Yang Chou <yphbchou0911@xxxxxxxxx>
---
tools/testing/selftests/sched_ext/cyclic_kick_wait.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/sched_ext/cyclic_kick_wait.c b/tools/testing/selftests/sched_ext/cyclic_kick_wait.c
index c2e5aa9de715..b060ffe63ba3 100644
--- a/tools/testing/selftests/sched_ext/cyclic_kick_wait.c
+++ b/tools/testing/selftests/sched_ext/cyclic_kick_wait.c
@@ -88,6 +88,11 @@ static enum scx_test_status setup(void **ctx)
{
struct cyclic_kick_wait *skel;
+ if (!__COMPAT_struct_has_field("rq_scx", "kick_sync_pending")) {
+ fprintf(stderr, "Skipping test: kernel lacks SCX_KICK_WAIT deadlock fix\n");
+ return SCX_TEST_SKIP;
+ }
+
skel = cyclic_kick_wait__open();
SCX_FAIL_IF(!skel, "Failed to open skel");
SCX_ENUM_INIT(skel);
--
2.43.0
--h4pl7b6os4ckbacb--