[LTP] [RFC PATCH] starvation: set a baseline for maximum runtime
Li Wang
liwang@redhat.com
Tue Nov 26 11:04:45 CET 2024
The commit ec14f4572 ("sched: starvation: Autocallibrate the timeout")
introduced a runtime calibration mechanism to dynamically adjust test
timeouts based on CPU speed.
While this works well for slower systems like microcontrollers or ARM
boards, it struggles to determine appropriate runtimes for modern CPUs,
especially when debugging kernels with significant overhead.
This patch introduces a baseline runtime (max_runtime = 600 seconds) to
ensure the test does not timeout prematurely, even on modern CPUs or
debug kernels. The calibrated runtime is compared against this baseline,
and the greater value is used as the test timeout.
This change reduces the likelihood of timeouts while maintaining flexibility
for slower systems.
Error log on debug-kernel:
...
starvation.c:98: TINFO: Setting affinity to CPU 0
starvation.c:52: TINFO: CPU did 120000000 loops in 52717us
tst_test.c:1727: TINFO: Updating max runtime to 0h 00m 52s
tst_test.c:1719: TINFO: Timeout per run is 0h 06m 16s
starvation.c:148: TFAIL: Scheduller starvation reproduced.
...
>From Philip Auld:
"The test sends a large number of signals as fast as possible. On the
non-debug kernel both signal generation and signal deliver take 1usec
in my traces (maybe actually less in real time but the timestamp has
usec granularity).
But on the debug kernel these signal events take ~21usecs. A significant
increase and given the large number of them this leads the starvation
test to falsely report starvation when in fact it is just taking
a lot longer.
In both debug and non-debug the kernel is doing the same thing. Both
tasks are running as expected. It's just the timing is not working for
the debug case.
Probably should waive this as expected failure on the debug variants."
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Philip Auld <pauld@redhat.com>
Cc: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/sched/cfs-scheduler/starvation.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c
index e707e0865..d57052d1d 100644
--- a/testcases/kernel/sched/cfs-scheduler/starvation.c
+++ b/testcases/kernel/sched/cfs-scheduler/starvation.c
@@ -108,6 +108,7 @@ static void setup(void)
else
timeout = callibrate() / 1000;
+ timeout = MAX(timeout, test.max_runtime);
tst_set_max_runtime(timeout);
}
@@ -161,5 +162,6 @@ static struct tst_test test = {
{"t:", &str_timeout, "Max timeout (default 240s)"},
{}
},
+ .max_runtime = 600,
.needs_checkpoints = 1,
};
--
2.47.0
More information about the ltp
mailing list