mirror-linux/tools/testing/selftests/sched_ext
Ihor Solodrai 0b82cc331d selftests/sched_ext: Fix rt_stall flaky failure
The rt_stall test measures the runtime ratio between an EXT and an RT
task pinned to the same CPU, verifying that the deadline server prevents
RT tasks from starving SCHED_EXT tasks. It expects the EXT task to get
at least 4% of CPU time.

The test is flaky because sched_stress_test() calls sleep(RUN_TIME)
immediately after fork(), without waiting for the RT child to complete
its setup (set_affinity + set_sched). If the RT child experiences
scheduling latency before completing setup, that delay eats into the
measurement window: the RT child runs for less than RUN_TIME seconds,
and the EXT task's measured ratio drops below the 4% threshold.

For example, in the failing CI run [1]:
  EXT=0.140s RT=4.750s total=4.890s (expected ~5.0s)
  ratio=2.86% < 4% → FAIL

The 110ms gap (5.0 - 4.89) corresponds to the RT child's setup time
being counted inside the measurement window, during which fewer
deadline server ticks fire for the EXT task.

Fix by using pipes to synchronize: each child signals the parent after
completing its setup, and the parent waits for both signals before
starting sleep(RUN_TIME). This ensures the measurement window only
counts time when both tasks are fully configured and competing.

[1] https://github.com/kernel-patches/bpf/actions/runs/21961895809/job/63442490449

Fixes: be621a7634 ("selftests/sched_ext: Add test for sched_ext dl_server")
Assisted-by: claude-opus-4-6-v1
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2026-02-13 09:09:39 -10:00
..
.gitignore
Makefile selftests/sched_ext: Add test for DL server total_bw consistency 2026-02-03 12:04:18 +01:00
allowed_cpus.bpf.c selftests/sched_ext: Add test for scx_bpf_select_cpu_and() via test_run 2025-05-20 10:24:17 -10:00
allowed_cpus.c selftests/sched_ext: Add test for scx_bpf_select_cpu_and() via test_run 2025-05-20 10:24:17 -10:00
config sched/debug: Remove CONFIG_SCHED_DEBUG from self-test config files 2025-03-19 22:23:24 +01:00
create_dsq.bpf.c
create_dsq.c
ddsp_bogus_dsq_fail.bpf.c
ddsp_bogus_dsq_fail.c
ddsp_vtimelocal_fail.bpf.c
ddsp_vtimelocal_fail.c
dsp_local_on.bpf.c sched_ext: selftests/dsp_local_on: Fix selftest on UP systems 2025-01-27 09:00:09 -10:00
dsp_local_on.c
enq_last_no_enq_fails.bpf.c
enq_last_no_enq_fails.c
enq_select_cpu.bpf.c selftests/sched_ext: Update test enq_select_cpu_fails 2025-05-21 07:35:58 -10:00
enq_select_cpu.c selftests/sched_ext: Update test enq_select_cpu_fails 2025-05-21 07:35:58 -10:00
exit.bpf.c
exit.c selftests/sched_ext: Fix exit selftest hang on UP 2025-07-03 06:44:13 -10:00
exit_test.h
hotplug.bpf.c
hotplug.c selftests/sched_ext: Remove duplicate sched.h header 2025-08-11 08:24:08 -10:00
hotplug_test.h
init_enable_count.bpf.c
init_enable_count.c selftests/sched_ext: Fix init_enable_count flakiness 2026-02-02 09:45:09 -10:00
maximal.bpf.c sched_ext: Add support for cgroup bandwidth control interface 2025-06-20 17:03:51 -10:00
maximal.c
maybe_null.bpf.c
maybe_null.c sched_ext: selftests: Fix grammar in tests description 2025-02-13 06:46:22 -10:00
maybe_null_fail_dsp.bpf.c
maybe_null_fail_yld.bpf.c
minimal.bpf.c
minimal.c
numa.bpf.c selftests/sched_ext: Add NUMA-aware scheduler test 2025-02-26 08:49:02 -10:00
numa.c selftests/sched_ext: Add NUMA-aware scheduler test 2025-02-26 08:49:02 -10:00
peek_dsq.bpf.c sched_ext: Add a selftest for scx_bpf_dsq_peek 2025-10-15 06:46:36 -10:00
peek_dsq.c sched_ext: Add a selftest for scx_bpf_dsq_peek 2025-10-15 06:46:36 -10:00
prog_run.bpf.c
prog_run.c
reload_loop.c
rt_stall.bpf.c selftests/sched_ext: Add test for sched_ext dl_server 2026-02-03 12:04:18 +01:00
rt_stall.c selftests/sched_ext: Fix rt_stall flaky failure 2026-02-13 09:09:39 -10:00
runner.c selftests/sched_ext: flush stdout before test to avoid log spam 2025-12-12 08:18:32 -10:00
scx_test.h
select_cpu_dfl.bpf.c
select_cpu_dfl.c
select_cpu_dfl_nodispatch.bpf.c
select_cpu_dfl_nodispatch.c
select_cpu_dispatch.bpf.c
select_cpu_dispatch.c
select_cpu_dispatch_bad_dsq.bpf.c
select_cpu_dispatch_bad_dsq.c
select_cpu_dispatch_dbl_dsp.bpf.c
select_cpu_dispatch_dbl_dsp.c
select_cpu_vtime.bpf.c
select_cpu_vtime.c
test_example.c
total_bw.c selftests/sched_ext: Add test for DL server total_bw consistency 2026-02-03 12:04:18 +01:00
util.c
util.h