]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests/sched_ext: Fix exit selftest hang on UP
authorAndrea Righi <arighi@nvidia.com>
Tue, 1 Jul 2025 06:08:45 +0000 (08:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2025 06:56:30 +0000 (08:56 +0200)
[ Upstream commit 7980ad7e4ca80f6c255f4473fba82a475342035a ]

On single-CPU systems, ops.select_cpu() is never called, causing the
EXIT_SELECT_CPU test case to wait indefinitely.

Avoid the stall by skipping this specific sub-test when only one CPU is
available.

Reported-by: Phil Auld <pauld@redhat.com>
Fixes: a5db7817af780 ("sched_ext: Add selftests")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Phil Auld <pauld@redhat.com>
Tested-by: Phil Auld <pauld@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/sched_ext/exit.c

index 31bcd06e21cd3d1d12a255be31c510e9db358f60..2c084ded296808623f5192bbedc6b3541fecfad3 100644 (file)
@@ -22,6 +22,14 @@ static enum scx_test_status run(void *ctx)
                struct bpf_link *link;
                char buf[16];
 
+               /*
+                * On single-CPU systems, ops.select_cpu() is never
+                * invoked, so skip this test to avoid getting stuck
+                * indefinitely.
+                */
+               if (tc == EXIT_SELECT_CPU && libbpf_num_possible_cpus() == 1)
+                       continue;
+
                skel = exit__open();
                skel->rodata->exit_point = tc;
                exit__load(skel);