[PATCH stalld 01/52] stalld: Reject --force_fifo in single-threaded mode
Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:31:11 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
When --force_fifo (-F) was combined with single-threaded mode (-O), stalld silently fell back to adaptive mode instead of honoring the requested configuration. This violates the principle of least surprise since the user explicitly requested single-threaded mode but gets a different threading model without warning. Replace the silent fallback with a usage() error that exits immediately, consistent with the other argument validation checks in parse_args(). Also fix the corresponding test which was missing the -O flag and therefore tested adaptive mode instead of single-threaded mode. Signed-off-by: Wander Lairson Costa <[email protected]> Assisted-by: Claude Code:claude-opus-4-6[1m] [PAL] --- src/utils.c | 9 ++------- tests/functional/test_force_fifo.sh | 18 ++---------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/utils.c b/src/utils.c index 8f1fe92..3dddb0f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1182,13 +1182,8 @@ int parse_args(int argc, char **argv) if (config_boost_duration > config_starving_threshold) usage("the boost duration cannot be longer than the starving threshold "); - if (config_force_fifo && config_single_threaded) { - log_msg("-F/--force_fifo does not work in single-threaded mode\n"); - log_msg("falling back to the adaptive mode\n"); - config_adaptive_multi_threaded = 1; - config_single_threaded = 0; - config_aggressive = 0; - } + if (config_force_fifo && config_single_threaded) + usage("--force_fifo does not work in single-threaded mode"); if (config_reservation && (config_aggressive || config_adaptive_multi_threaded)) usage("-R/--reservation only works in the single-threaded mode"); diff --git a/tests/functional/test_force_fifo.sh b/tests/functional/test_force_fifo.sh index 239bc37..4fdb13b 100755 --- a/tests/functional/test_force_fifo.sh +++ b/tests/functional/test_force_fifo.sh @@ -207,22 +207,8 @@ log "==========================================" log "Test 5: Single-threaded mode with FIFO (should fail)" log "==========================================" -# Try to run stalld with -F but without -A (single-threaded mode) -# According to CLAUDE.md, this should die/exit -FIFO_SINGLE_LOG="/tmp/stalld_test_force_fifo_single_$$.log" -CLEANUP_FILES+=("${FIFO_SINGLE_LOG}") - -log "Testing single-threaded mode with -F (should exit)" -timeout 5 ${TEST_ROOT}/../stalld -f -v -c "${TEST_CPU}" -t ${threshold} -F > "${FIFO_SINGLE_LOG}" 2>&1 -ret=$? - -if [ $ret -ne 0 ] && [ $ret -ne 124 ]; then - pass "single-threaded mode rejected FIFO" -elif grep -qiE "single.*thread|falling back|adaptive" "${FIFO_SINGLE_LOG}"; then - pass "stalld detected incompatibility and fell back to adaptive mode" -else - fail "stalld silently accepted FIFO in single-threaded mode" -fi +log "Testing single-threaded mode (-O) with -F (should exit)" +assert_stalld_rejects "Single-threaded mode rejected FIFO" -f -v -c "${TEST_CPU}" -t ${threshold} -F -O #============================================================================= # Test 6: Compare effectiveness (informational) -- 2.54.0