public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Cc: Philip Auld <pauld@redhat.com>
Subject: [LTP] [RFC PATCH] starvation: set a baseline for maximum runtime
Date: Tue, 26 Nov 2024 18:04:45 +0800	[thread overview]
Message-ID: <20241126100445.17133-1-liwang@redhat.com> (raw)

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

             reply	other threads:[~2024-11-26 10:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 10:04 Li Wang [this message]
2024-11-26 10:28 ` [LTP] [RFC PATCH] starvation: set a baseline for maximum runtime 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241126100445.17133-1-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    --cc=pauld@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox