* [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels
@ 2025-01-27 8:32 Alessandro Carminati
2025-01-27 9:39 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Alessandro Carminati @ 2025-01-27 8:32 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: Alessandro Carminati, ltp, Alessandro Carminati
This commit introduces a check in the starvation test case to detect and
skip execution on realtime kernels. The test is designed for use with the
Completely Fair Scheduler and produces meaningless results when run on
realtime kernels.
By skipping the test on realtime kernels, we avoid confusion caused by
misleading results.
Changes include:
- Added a detection mechanism for realtime kernels.
- Logic to skip the test execution if the kernel is identified as
realtime.
Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
---
include/tst_kernel.h | 9 +++++++++
lib/tst_kernel.c | 10 ++++++++++
testcases/kernel/sched/cfs-scheduler/starvation.c | 3 +++
3 files changed, 22 insertions(+)
diff --git a/include/tst_kernel.h b/include/tst_kernel.h
index 5f49952b7..63ecb19a4 100644
--- a/include/tst_kernel.h
+++ b/include/tst_kernel.h
@@ -58,4 +58,13 @@ int tst_check_builtin_driver(const char *driver);
*/
int tst_check_driver(const char *driver);
+/**
+ * tst_check_preempt_rt() - Check if the running kernel is RT.
+ *
+ * Check support for the kernel module (both built-in and loadable).
+ *
+ * Return: -1 if the kernel is RT, 0 otherwise.
+ */
+int tst_check_preempt_rt(void);
+
#endif /* TST_KERNEL_H__ */
diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
index 8dabfeba2..9ab02e5d3 100644
--- a/lib/tst_kernel.c
+++ b/lib/tst_kernel.c
@@ -214,3 +214,13 @@ int tst_check_driver(const char *driver)
return -1;
}
+
+int tst_check_preempt_rt(void)
+{
+ struct utsname uval;
+
+ uname(&uval);
+ if (strstr(uval.version, "PREEMPT_RT"))
+ return 1;
+ return 0;
+}
diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c
index 901556a7b..27bf77f39 100644
--- a/testcases/kernel/sched/cfs-scheduler/starvation.c
+++ b/testcases/kernel/sched/cfs-scheduler/starvation.c
@@ -80,6 +80,9 @@ static void setup(void)
int cpu = 0;
long ncpus = tst_ncpus_conf();
+ if (tst_check_preempt_rt())
+ tst_brk(TCONF, "This test is not designed for the RT kernel");
+
CPU_ZERO(&mask);
/* Restrict test to a single cpu */
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-27 8:32 [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels Alessandro Carminati
@ 2025-01-27 9:39 ` Petr Vorel
2025-01-27 11:07 ` Alessandro Carminati
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2025-01-27 9:39 UTC (permalink / raw)
To: Alessandro Carminati; +Cc: ltp, Alessandro Carminati
> This commit introduces a check in the starvation test case to detect and
> skip execution on realtime kernels. The test is designed for use with the
> Completely Fair Scheduler and produces meaningless results when run on
> realtime kernels.
> By skipping the test on realtime kernels, we avoid confusion caused by
> misleading results.
Thanks a lot for fixing -1 in v3. I was thinking to merge v2 and fix -1
manually, but I'm really not sure if the test is meaningless for realtime.
Was the test really written for CFS? It would be nice to get ack from any
realtime developer.
BTW test is working well on x86_64 SLES realtime kernel on VM, i.e. both you
want to skip (RT) or warn about unreliable results (VM). That of course
does not mean it's relevant for RT kernel.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-27 9:39 ` Petr Vorel
@ 2025-01-27 11:07 ` Alessandro Carminati
2025-01-27 13:37 ` Petr Vorel
2025-01-27 14:13 ` Petr Vorel
0 siblings, 2 replies; 5+ messages in thread
From: Alessandro Carminati @ 2025-01-27 11:07 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp, Alessandro Carminati
Hi Petr,
Thanks for the feedback.
On Mon, Jan 27, 2025 at 10:39 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> > This commit introduces a check in the starvation test case to detect and
> > skip execution on realtime kernels. The test is designed for use with the
> > Completely Fair Scheduler and produces meaningless results when run on
> > realtime kernels.
>
> > By skipping the test on realtime kernels, we avoid confusion caused by
> > misleading results.
>
> Thanks a lot for fixing -1 in v3. I was thinking to merge v2 and fix -1
> manually, but I'm really not sure if the test is meaningless for realtime.
> Was the test really written for CFS? It would be nice to get ack from any
> realtime developer.
>
> BTW test is working well on x86_64 SLES realtime kernel on VM, i.e. both you
> want to skip (RT) or warn about unreliable results (VM). That of course
> does not mean it's relevant for RT kernel.
Here's what I observed:
* In our CI pipeline, the test consistently fails on our RT kernel running
on AARCH64 boards.
* Upon investigating and reading through the code, I noticed that the test
seems to rely on an equal number of times the child and parent tasks get
scheduled. This behavior aligns with how CFS works... less with RT.
* That said, there are scenarios where CFS and RT might make similar
scheduling decisions, particularly in RT when all tasks share the same
priority.
* Finally, as a hint, I noticed that the test is currently placed in the
cfs-scheduler directory. I interpret this as a strong suggestion from the
author that the test was intended for the CFS scheduler.
>
> Kind regards,
> Petr
>
--
---
Thanks
Alessandro
172
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-27 11:07 ` Alessandro Carminati
@ 2025-01-27 13:37 ` Petr Vorel
2025-01-27 14:13 ` Petr Vorel
1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-01-27 13:37 UTC (permalink / raw)
To: Alessandro Carminati
Cc: Mike Galbraith, Alessandro Carminati, Mel Gorman, ltp
> Hi Petr,
> Thanks for the feedback.
> On Mon, Jan 27, 2025 at 10:39 AM Petr Vorel <pvorel@suse.cz> wrote:
> > > This commit introduces a check in the starvation test case to detect and
> > > skip execution on realtime kernels. The test is designed for use with the
> > > Completely Fair Scheduler and produces meaningless results when run on
> > > realtime kernels.
> > > By skipping the test on realtime kernels, we avoid confusion caused by
> > > misleading results.
> > Thanks a lot for fixing -1 in v3. I was thinking to merge v2 and fix -1
> > manually, but I'm really not sure if the test is meaningless for realtime.
> > Was the test really written for CFS? It would be nice to get ack from any
> > realtime developer.
> > BTW test is working well on x86_64 SLES realtime kernel on VM, i.e. both you
> > want to skip (RT) or warn about unreliable results (VM). That of course
> > does not mean it's relevant for RT kernel.
> Here's what I observed:
> * In our CI pipeline, the test consistently fails on our RT kernel running
> on AARCH64 boards.
> * Upon investigating and reading through the code, I noticed that the test
> seems to rely on an equal number of times the child and parent tasks get
> scheduled. This behavior aligns with how CFS works... less with RT.
> * That said, there are scenarios where CFS and RT might make similar
> scheduling decisions, particularly in RT when all tasks share the same
> priority.
> * Finally, as a hint, I noticed that the test is currently placed in the
> cfs-scheduler directory. I interpret this as a strong suggestion from the
> author that the test was intended for the CFS scheduler.
Oops, I completely missed the directory. And all the above sounds right.
Also reproducer was posted for EEVDF, which is CFS replacement.
OTOH cfs_bandwidth01.c, which requires CONFIG_CFS_BANDWIDTH works on RT kernel
well, also very old hackbench.c (which needs to be rewritten).
Anyway I wanted to have ack of somebody who actually understands the kernel
code. I got a confirmation from Mike Galbraith that "the test is about fair class
vs fair class wakeup latency, has little relevance to RT. It does bang on locks
in the wakeup path, but no more than about a zillion other things." therefore
I'm going to merge.
Kind regards,
Petr
> > Kind regards,
> > Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-27 11:07 ` Alessandro Carminati
2025-01-27 13:37 ` Petr Vorel
@ 2025-01-27 14:13 ` Petr Vorel
1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-01-27 14:13 UTC (permalink / raw)
To: Alessandro Carminati; +Cc: ltp, Alessandro Carminati
Hi Alessandro, all,
finally merged, thanks!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-27 14:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 8:32 [LTP] [PATCH v3] cfs-scheduler/starvation.c: Skip test on realtime kernels Alessandro Carminati
2025-01-27 9:39 ` Petr Vorel
2025-01-27 11:07 ` Alessandro Carminati
2025-01-27 13:37 ` Petr Vorel
2025-01-27 14:13 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox