Skip to content

Test suite hardening, correctness fixes, and BPF optimization

Wander Lairson Costa linux-rt-users 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest52 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/52stalld: Reject --force_fifo in single-threaded modesrc/utils.c tests/functional/test_force_fifo.sh+4 -230 replies
2/52tests: Introduce test_section() helpertests/functional/test_affinity.sh tests/functional/test_backend_selection.sh tests/functional/test_boost_duration.sh +17 more+124 -4150 replies
3/52tests: Introduce cleanup_scenario() helpertests/functional/test_boost_duration.sh tests/functional/test_boost_period.sh tests/functional/test_boost_restoration.sh +12 more+71 -1770 replies
4/52tests: Introduce starvation and boost assertstests/functional/test_boost_duration.sh tests/functional/test_boost_period.sh tests/functional/test_boost_runtime.sh +4 more+54 -880 replies
5/52tests: Introduce find_starved_child() helpertests/functional/test_boost_restoration.sh tests/functional/test_deadline_boosting.sh tests/functional/test_fifo_boosting.sh +4 more+79 -1310 replies
6/52tests: Fix task exit timing in test_boost_restorationtests/functional/test_boost_restoration.sh tests/functional/test_runqueue_parsing.sh+11 -110 replies
7/52tests: Consolidate and adopt init_functional_test()tests/functional/test_affinity.sh tests/functional/test_boost_duration.sh tests/functional/test_boost_period.sh +12 more+64 -5180 replies
8/52tests: Introduce assert_stalld_rejects() helpertests/functional/test_affinity.sh tests/functional/test_boost_duration.sh tests/functional/test_boost_period.sh +5 more+33 -1380 replies
9/52tests: Fix boost verification in runtime and duration teststests/functional/test_boost_duration.sh tests/functional/test_boost_runtime.sh+24 -240 replies
10/52tests: Fix subshell swallowing test resultstests/functional/test_starvation_detection.sh+15 -200 replies
11/52tests: Fix repeated log match finding same linetests/functional/test_fifo_priority_starvation.sh tests/helpers/test_helpers.sh+23 -80 replies
12/52chore: Remove legacy test infrastructure and stale docs.claude/CLAUDE.md .claude/agents/agent-prompt-engineer.md .claude/agents/c-expert.md +24 more+12 -73050 replies
13/52tests: Add assertions to SCHED_OTHER restoration testtests/functional/test_boost_restoration.sh+32 -50 replies
14/52tests: Fix CPU selection grep substring matchestests/functional/test_cpu_selection.sh+13 -90 replies
15/52tests: Add idle CPU skipping assertiontests/functional/test_idle_detection.sh+17 -150 replies
16/52tests: Remove redundant pkill from cleanuptests/helpers/test_helpers.sh+0 -40 replies
17/52tests: Introduce and adopt assert_log_contains() helpertests/functional/test_backend_selection.sh tests/functional/test_deadline_boosting.sh tests/functional/test_fifo_boosting.sh +8 more+66 -1490 replies
18/52tests: Remove weak, redundant, and assertion-free test blockstests/functional/test_affinity.sh tests/functional/test_boost_period.sh tests/functional/test_boost_restoration.sh +7 more+29 -10450 replies
19/52tests: Introduce and adopt assert_success() helpertests/functional/test_affinity.sh tests/functional/test_boost_restoration.sh tests/functional/test_cpu_selection.sh +7 more+71 -1730 replies
20/52tests: Replace wait conditionals with assertstests/functional/test_deadline_boosting.sh tests/functional/test_fifo_boosting.sh tests/functional/test_fifo_priority_starvation.sh +1 more+10 -460 replies
21/52tests: Remove if-wrappers around assert callstests/functional/test_foreground.sh tests/functional/test_logging_destinations.sh tests/functional/test_pidfile.sh +1 more+29 -730 replies
22/52tests: Abort immediately on test failuretests/helpers/test_helpers.sh+11 -300 replies
23/52tests: Remove dead code after making fail() fataltests/functional/test_affinity.sh tests/functional/test_backend_selection.sh tests/functional/test_boost_duration.sh +13 more+0 -840 replies
24/52tests: Introduce and adopt process helperstests/functional/test_boost_restoration.sh tests/functional/test_starvation_detection.sh tests/helpers/test_helpers.sh +1 more+39 -310 replies
25/52tests: Extract wait_for_process_exit helpertests/helpers/test_helpers.sh+42 -430 replies
26/52tests: Reduce default wait timeoutstests/functional/test_boost_duration.sh tests/helpers/test_helpers.sh+7 -70 replies
27/52tests: Reduce starvation_gen durationstests/functional/test_boost_duration.sh tests/functional/test_boost_restoration.sh tests/functional/test_deadline_boosting.sh +5 more+18 -180 replies
28/52tests: Replace init sleeps in test_affinitytests/functional/test_affinity.sh+12 -120 replies
29/52tests: Drop redundant sleeps in test_pidfiletests/functional/test_pidfile.sh+0 -70 replies
30/52tests: Remove redundant sleeps after start_stalldtests/functional/test_foreground.sh tests/functional/test_logging_destinations.sh+0 -40 replies
31/52tests: Reduce timing and replace sleeps with event waitstests/functional/test_deadline_boosting.sh tests/functional/test_fifo_boosting.sh tests/functional/test_fifo_priority_starvation.sh +4 more+13 -150 replies
32/52tests: Fix async-signal-unsafe handlertests/helpers/starvation_gen.c+1 -10 replies
33/52bpf: Replace linear task scan with hash mapbpf/stalld.bpf.c src/queue_track.c src/queue_track.h+131 -2770 replies
34/52stalld: fix data race on thread_runningsrc/stalld.h+2 -10 replies
35/52stalld: fix inverted DAEMON_UMASK valuesrc/stalld.h+1 -10 replies
36/52stalld: fix uninitialized buffer use in find_debugfs_mount_pointsrc/utils.c+4 -30 replies
37/52stalld: fix buffer underflow in read_proc_statsrc/utils.c+2 -10 replies
38/52stalld: fix buffer underflow in sched_debug_getsrc/sched_debug.c+2 -10 replies
39/52stalld: check pthread_create return in aggressive_mainsrc/stalld.c+10 -50 replies
40/52stalld: check pthread_create return in conservative_mainsrc/stalld.c+5 -10 replies
41/52stalld: fix signed integer overflow in set_reservationsrc/stalld.h src/utils.c+7 -60 replies
42/52stalld: fix data race on config_buffer_sizesrc/stalld.c src/stalld.h+2 -20 replies
43/52stalld: remove async-signal-unsafe calls from signal handlersrc/stalld.c src/stalld.h src/utils.c+5 -30 replies
44/52stalld: use CLOCK_MONOTONIC for starvation detectionsrc/queue_track.c src/sched_debug.c src/stalld.c +1 more+18 -100 replies
45/52stalld: fix format string type mismatch for time_tsrc/stalld.c+4 -40 replies
46/52stalld: fix type mismatches in detect_task_formatsrc/sched_debug.c+5 -50 replies
47/52stalld: remove NULL deref in fill_waiting_task error handlersrc/sched_debug.c+0 -10 replies
48/52stalld: guard nextline() returns in sched_debug parsingsrc/sched_debug.c+18 -50 replies
49/52stalld: fix missing null-termination in is_runnablesrc/sched_debug.c+2 -30 replies
50/52stalld: fix snprintf truncation check in is_runnablesrc/sched_debug.c+1 -10 replies
51/52stalld: fix error return in queue_track_get_cpusrc/queue_track.c+1 -10 replies
52/52stalld: fix format string type mismatch in set_cpu_affinitysrc/utils.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH stalld 00/52] Test suite hardening, correctness fixes, and BPF optimization

This series improves stalld reliability across three areas: the test infrastructure, the BPF backend, and the core daemon code.

The test suite is overhauled to eliminate false-passing tests and reduce runtime. An assertion framework replaces ad-hoc conditional checks, sleep-based synchronization gives way to event-driven waits, and helpers for common patterns like starvation detection and process lifecycle reduce boilerplate. Tests that silently swallowed failures in subshells or matched stale log lines are fixed. The cumulative effect is a suite that fails fast on real regressions and completes in a fraction of the previous wall-clock time.

The BPF queue_track backend replaces its per-CPU linear array with a hash map keyed by CPU and PID, turning the O(n) task lookup on every sched_wakeup into O(1). This eliminates a 2us latency penalty that consumed a significant portion of the 10us real-time budget on Telco workloads.

The remaining patches address a range of correctness issues in the
daemon: data races on shared variables are fixed with C11 atomics, buffer underflows and uninitialized buffer uses are guarded, the signal handler is made async-signal-safe, starvation timing is migrated from wall-clock time to CLOCK_MONOTONIC, format string mismatches and NULL pointer dereferences are corrected, pthread_create return values are checked, and a signed integer overflow in the SCHED_DEADLINE period calculation is resolved.

Wander Lairson Costa (52):
stalld: Reject --force_fifo in single-threaded mode
tests: Introduce test_section() helper
tests: Introduce cleanup_scenario() helper
tests: Introduce starvation and boost asserts
tests: Introduce find_starved_child() helper
tests: Fix task exit timing in test_boost_restoration
tests: Consolidate and adopt init_functional_test()
tests: Introduce assert_stalld_rejects() helper
tests: Fix boost verification in runtime and duration tests
tests: Fix subshell swallowing test results
tests: Fix repeated log match finding same line
chore: Remove legacy test infrastructure and stale docs
tests: Add assertions to SCHED_OTHER restoration test
tests: Fix CPU selection grep substring matches
tests: Add idle CPU skipping assertion
tests: Remove redundant pkill from cleanup
tests: Introduce and adopt assert_log_contains() helper
tests: Remove weak, redundant, and assertion-free test blocks
tests: Introduce and adopt assert_success() helper
tests: Replace wait conditionals with asserts
tests: Remove if-wrappers around assert calls
tests: Abort immediately on test failure
tests: Remove dead code after making fail() fatal
tests: Introduce and adopt process helpers
tests: Extract wait_for_process_exit helper
tests: Reduce default wait timeouts
tests: Reduce starvation_gen durations
tests: Replace init sleeps in test_affinity
tests: Drop redundant sleeps in test_pidfile
tests: Remove redundant sleeps after start_stalld
tests: Reduce timing and replace sleeps with event waits
tests: Fix async-signal-unsafe handler
bpf: Replace linear task scan with hash map
stalld: fix data race on thread_running
stalld: fix inverted DAEMON_UMASK value
stalld: fix uninitialized buffer use in find_debugfs_mount_point
stalld: fix buffer underflow in read_proc_stat
stalld: fix buffer underflow in sched_debug_get
stalld: check pthread_create return in aggressive_main
stalld: check pthread_create return in conservative_main
stalld: fix signed integer overflow in set_reservation
stalld: fix data race on config_buffer_size
stalld: remove async-signal-unsafe calls from signal handler
stalld: use CLOCK_MONOTONIC for starvation detection
stalld: fix format string type mismatch for time_t
stalld: fix type mismatches in detect_task_format
stalld: remove NULL deref in fill_waiting_task error handler
stalld: guard nextline() returns in sched_debug parsing
stalld: fix missing null-termination in is_runnable
stalld: fix snprintf truncation check in is_runnable
stalld: fix error return in queue_track_get_cpu
stalld: fix format string type mismatch in set_cpu_affinity

 .claude/CLAUDE.md                             |  585 ---------
 .claude/agents/agent-prompt-engineer.md       |  135 --
 .claude/agents/c-expert.md                    |   53 -
 .claude/agents/code-reviewer.md               |  104 --
 .claude/agents/get-agent-hash                 |   99 --
 .claude/agents/git-scm-master.md              | 1154 -----------------
 .claude/agents/kernel-hacker.md               |  231 ----
 .claude/agents/plan-validator.md              |  130 --
 .claude/agents/project-historian.md           |  285 ----
 .claude/agents/project-librarian.md           |  604 ---------
 .claude/agents/project-manager.md             |  388 ------
 .claude/agents/project-scope-guardian.md      |  326 -----
 .claude/agents/python-expert.md               |   57 -
 .claude/agents/test-specialist.md             |  656 ----------
 .claude/agents/update-agent-hashes            |   96 --
 .claude/context-snapshot.json                 |  103 --
 .claude/rules                                 |   42 -
 .gitignore                                    |    5 +-
 bpf/stalld.bpf.c                              |  206 ++-
 src/queue_track.c                             |   99 +-
 src/queue_track.h                             |  107 +-
 src/sched_debug.c                             |   46 +-
 src/stalld.c                                  |   51 +-
 src/stalld.h                                  |   20 +-
 src/utils.c                                   |   33 +-
 tests/BACKEND_USAGE.md                        |  269 ----
 tests/CONTEXT_SNAPSHOT_2025-10-31.md          |  231 ----
 tests/Makefile                                |   29 +-
 tests/README.md                               |   29 +-
 tests/TODO.md                                 |  727 -----------
 tests/functional/test_affinity.sh             |  178 +--
 tests/functional/test_backend_selection.sh    |   24 +-
 tests/functional/test_boost_duration.sh       |  164 +--
 tests/functional/test_boost_period.sh         |  151 +--
 tests/functional/test_boost_restoration.sh    |  310 +----
 tests/functional/test_boost_runtime.sh        |  179 +--
 tests/functional/test_cpu_selection.sh        |   76 +-
 tests/functional/test_deadline_boosting.sh    |  266 +---
 tests/functional/test_fifo_boosting.sh        |  269 +---
 .../test_fifo_priority_starvation.sh          |  197 +--
 tests/functional/test_force_fifo.sh           |  196 +--
 tests/functional/test_foreground.sh           |   65 +-
 tests/functional/test_idle_detection.sh       |  195 +--
 tests/functional/test_log_only.sh             |   30 +-
 tests/functional/test_logging_destinations.sh |   38 +-
 tests/functional/test_pidfile.sh              |  166 +--
 tests/functional/test_runqueue_parsing.sh     |  417 ------
 tests/functional/test_starvation_detection.sh |  281 +---
 tests/functional/test_starvation_threshold.sh |  138 +-
 tests/functional/test_task_merging.sh         |  161 +--
 tests/helpers/starvation_gen.c                |    2 +-
 tests/helpers/test_helpers.sh                 |  356 +++--
 tests/legacy/README.md                        |  169 ---
 tests/legacy/test01.c                         |  506 --------
 tests/legacy/test01_wrapper.sh                |  161 ---
 tests/run_tests.sh                            |  149 +--
 56 files changed, 964 insertions(+), 10780 deletions(-)
 delete mode 100644 .claude/CLAUDE.md
 delete mode 100644 .claude/agents/agent-prompt-engineer.md
 delete mode 100644 .claude/agents/c-expert.md
 delete mode 100644 .claude/agents/code-reviewer.md
 delete mode 100755 .claude/agents/get-agent-hash
 delete mode 100644 .claude/agents/git-scm-master.md
 delete mode 100644 .claude/agents/kernel-hacker.md
 delete mode 100644 .claude/agents/plan-validator.md
 delete mode 100644 .claude/agents/project-historian.md
 delete mode 100644 .claude/agents/project-librarian.md
 delete mode 100644 .claude/agents/project-manager.md
 delete mode 100644 .claude/agents/project-scope-guardian.md
 delete mode 100644 .claude/agents/python-expert.md
 delete mode 100644 .claude/agents/test-specialist.md
 delete mode 100755 .claude/agents/update-agent-hashes
 delete mode 100644 .claude/context-snapshot.json
 delete mode 100644 .claude/rules
 delete mode 100644 tests/BACKEND_USAGE.md
 delete mode 100644 tests/CONTEXT_SNAPSHOT_2025-10-31.md
 delete mode 100644 tests/TODO.md
 delete mode 100755 tests/functional/test_runqueue_parsing.sh
 delete mode 100644 tests/legacy/README.md
 delete mode 100644 tests/legacy/test01.c
 delete mode 100755 tests/legacy/test01_wrapper.sh
Signature · 1 line
2.54.0