public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH] starvation: set a baseline for maximum runtime
@ 2024-11-26 10:04 Li Wang
  2024-11-26 10:28 ` Cyril Hrubis
  0 siblings, 1 reply; 11+ messages in thread
From: Li Wang @ 2024-11-26 10:04 UTC (permalink / raw)
  To: ltp; +Cc: Philip Auld

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-11-27 10:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-26 10:04 [LTP] [RFC PATCH] starvation: set a baseline for maximum runtime Li Wang
2024-11-26 10:28 ` Cyril Hrubis
2024-11-26 10:59   ` Li Wang
2024-11-26 11:23     ` Cyril Hrubis
2024-11-27  4:15       ` Li Wang
2024-11-27  7:48         ` [LTP] [Draft PATCH] lib: add TST_DYNAMICAL_RUNTIME option Li Wang
2024-11-27  8:21           ` Li Wang
2024-11-27  9:46         ` [LTP] [RFC PATCH] starvation: set a baseline for maximum runtime Cyril Hrubis
2024-11-27 10:08           ` Li Wang
2024-11-27 10:40             ` Cyril Hrubis
2024-11-27 10:56               ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox