* [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels
@ 2025-01-21 11:19 Alessandro Carminati
2025-01-21 12:07 ` Li Wang
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alessandro Carminati @ 2025-01-21 11:19 UTC (permalink / raw)
To: Petr Vorel; +Cc: Alessandro Carminati, Alessandro Carminati, ltp
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>
---
V1: https://lore.kernel.org/ltp/20250120085017.63442-1-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..7084289c3 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 v2] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-21 11:19 [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels Alessandro Carminati
@ 2025-01-21 12:07 ` Li Wang
2025-01-21 14:37 ` Petr Vorel
2025-01-24 11:58 ` Cyril Hrubis
2 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2025-01-21 12:07 UTC (permalink / raw)
To: Alessandro Carminati; +Cc: Alessandro Carminati, ltp
On Tue, Jan 21, 2025 at 7:22 PM Alessandro Carminati <acarmina@redhat.com>
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.
>
> 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>
>
Reviewed-by: Li Wang <liwang@redhat.com>
> ---
>
> V1:
> https://lore.kernel.org/ltp/20250120085017.63442-1-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..7084289c3 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
>
>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-21 11:19 [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels Alessandro Carminati
2025-01-21 12:07 ` Li Wang
@ 2025-01-21 14:37 ` Petr Vorel
2025-01-24 11:58 ` Cyril Hrubis
2 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-01-21 14:37 UTC (permalink / raw)
To: Alessandro Carminati; +Cc: Alessandro Carminati, ltp
Hi Alessandro,
LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-21 11:19 [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels Alessandro Carminati
2025-01-21 12:07 ` Li Wang
2025-01-21 14:37 ` Petr Vorel
@ 2025-01-24 11:58 ` Cyril Hrubis
2025-01-27 8:25 ` Alessandro Carminati
2 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2025-01-24 11:58 UTC (permalink / raw)
To: Alessandro Carminati; +Cc: Alessandro Carminati, ltp
Hi!
> +int tst_check_preempt_rt(void)
> +{
> + struct utsname uval;
> +
> + uname(&uval);
> + if (strstr(uval.version, "PREEMPT_RT"))
> + return -1;
Maybe just return 1; here instead.
Otherwise:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels
2025-01-24 11:58 ` Cyril Hrubis
@ 2025-01-27 8:25 ` Alessandro Carminati
0 siblings, 0 replies; 5+ messages in thread
From: Alessandro Carminati @ 2025-01-27 8:25 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: Alessandro Carminati, ltp
Hello Cyril,
Thanks for the feedback.
On Fri, Jan 24, 2025 at 12:58 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> > +int tst_check_preempt_rt(void)
> > +{
> > + struct utsname uval;
> > +
> > + uname(&uval);
> > + if (strstr(uval.version, "PREEMPT_RT"))
> > + return -1;
>
> Maybe just return 1; here instead.
Fixing in v3 that will follow in a few minutes.
>
> Otherwise:
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
--
---
Thanks
Alessandro
172
--
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 8:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21 11:19 [LTP] [PATCH v2] cfs-scheduler/starvation.c: Skip test on realtime kernels Alessandro Carminati
2025-01-21 12:07 ` Li Wang
2025-01-21 14:37 ` Petr Vorel
2025-01-24 11:58 ` Cyril Hrubis
2025-01-27 8:25 ` Alessandro Carminati
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox