* [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/)
@ 2025-06-05 14:29 Wei Gao via ltp
2025-06-05 9:40 ` Petr Vorel
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Wei Gao via ltp @ 2025-06-05 14:29 UTC (permalink / raw)
To: ltp
When the CONFIG_RT_GROUP_SCHED=y config is set, test cases like sched_rr_get_interval01
will failed since limitation of RT processes with cgroup v2 cpu controller.
The limitation is RT processes have to be in the root cgroup before enabling cpu controller.
By default the shell will not running in root cgroup "0::/" since systemd will put shell
into 0::/user.slice/user-xx.slice/session-xx.scope, so ltp case run within shell will failed.
We can use this patch to workaround above limitation. If we agree on this patch, i will
continue do same patch to following cases:
sched_rr_get_interval02
sched_rr_get_interval03
sched_setparam02
sched_getscheduler01
Fixes: https://github.com/linux-test-project/ltp/issues/1245
Signed-off-by: Wei Gao <wegao@suse.com>
---
.../sched_rr_get_interval/sched_rr_get_interval01.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
index b4d75bdcc..55516ec89 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
@@ -43,6 +43,12 @@ static void setup(void)
tp.type = tv->ts_type;
+ if (access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) {
+ int pid = getpid();
+
+ SAFE_FILE_PRINTF("/sys/fs/cgroup/cgroup.procs", "%d", pid);
+ }
+
if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1)
tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
--
2.49.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) 2025-06-05 14:29 [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) Wei Gao via ltp @ 2025-06-05 9:40 ` Petr Vorel 2025-06-05 11:17 ` Andrea Cervesato via ltp [not found] ` <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu> 2025-06-05 13:14 ` Cyril Hrubis 2025-06-10 22:14 ` [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y Wei Gao via ltp 2 siblings, 2 replies; 10+ messages in thread From: Petr Vorel @ 2025-06-05 9:40 UTC (permalink / raw) To: Wei Gao; +Cc: cgroups, Michal Koutný, ltp Hi Wei, all, > When the CONFIG_RT_GROUP_SCHED=y config is set, test cases like sched_rr_get_interval01 > will failed since limitation of RT processes with cgroup v2 cpu controller. > The limitation is RT processes have to be in the root cgroup before enabling cpu controller. > By default the shell will not running in root cgroup "0::/" since systemd will put shell > into 0::/user.slice/user-xx.slice/session-xx.scope, so ltp case run within shell will failed. > We can use this patch to workaround above limitation. If we agree on this patch, i will > continue do same patch to following cases: > sched_rr_get_interval02 > sched_rr_get_interval03 > sched_setparam02 > sched_getscheduler01 Acked-by: Petr Vorel <pvorel@suse.cz> LGTM. @Michal @Li WDYT? Kind regards, Petr > Fixes: https://github.com/linux-test-project/ltp/issues/1245 > Signed-off-by: Wei Gao <wegao@suse.com> > --- > .../sched_rr_get_interval/sched_rr_get_interval01.c | 6 ++++++ > 1 file changed, 6 insertions(+) > diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > index b4d75bdcc..55516ec89 100644 > --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > @@ -43,6 +43,12 @@ static void setup(void) > tp.type = tv->ts_type; > + if (access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) { > + int pid = getpid(); > + > + SAFE_FILE_PRINTF("/sys/fs/cgroup/cgroup.procs", "%d", pid); > + } > + > if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1) > tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) 2025-06-05 9:40 ` Petr Vorel @ 2025-06-05 11:17 ` Andrea Cervesato via ltp [not found] ` <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu> 1 sibling, 0 replies; 10+ messages in thread From: Andrea Cervesato via ltp @ 2025-06-05 11:17 UTC (permalink / raw) To: Petr Vorel, Wei Gao; +Cc: cgroups, Michal Koutný, ltp Merged, thanks. - Andrea -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu>]
* Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) [not found] ` <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu> @ 2025-06-07 4:01 ` Wei Gao via ltp 2025-06-07 18:42 ` Wei Gao via ltp 1 sibling, 0 replies; 10+ messages in thread From: Wei Gao via ltp @ 2025-06-07 4:01 UTC (permalink / raw) To: Michal Koutný; +Cc: ltp, cgroups @Michal Koutný <mkoutny@suse.com> So we should skip test cgroupv2 with CONFIG_RT_GROUP_SCHED=yes, correct? Like following change? diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c index 55516ec89..b12bd7857 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c @@ -43,10 +43,9 @@ static void setup(void) tp.type = tv->ts_type; + static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", NULL}; + if ((access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) && !tst_kconfig_check(kconf_strict)) { + tst_brk(TCONF, "CONFIG_RT_GROUP_SCHED not support on cgroupv2"); + } if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1) On Thu, Jun 5, 2025 at 11:56 PM Michal Koutný <mkoutny@suse.com> wrote: > On Thu, Jun 05, 2025 at 11:40:19AM +0200, Petr Vorel <pvorel@suse.cz> > wrote: > > @Michal @Li WDYT? > > RT_GROUP scheduling is v1 feature as of now. > > Testing cgroup v2 makes only sense with > CONFIG_RT_GROUP_SCHED=y and CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED=y > (this combination is equivalent to CONFIG_RT_GROUP_SCHED=n on v2). > > HTH, > Michal > -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) [not found] ` <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu> 2025-06-07 4:01 ` Wei Gao via ltp @ 2025-06-07 18:42 ` Wei Gao via ltp [not found] ` <rugkmu3bcsrqgehibgy3dn7nsisuv6lip7b5cmo3bewq4zjcdn@zuo6hg25pqyz> 1 sibling, 1 reply; 10+ messages in thread From: Wei Gao via ltp @ 2025-06-07 18:42 UTC (permalink / raw) To: Michal Koutný; +Cc: ltp, cgroups On Thu, Jun 05, 2025 at 05:56:11PM +0200, Michal Koutný wrote: > On Thu, Jun 05, 2025 at 11:40:19AM +0200, Petr Vorel <pvorel@suse.cz> wrote: > > @Michal @Li WDYT? > > RT_GROUP scheduling is v1 feature as of now. > > Testing cgroup v2 makes only sense with > CONFIG_RT_GROUP_SCHED=y and CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED=y > (this combination is equivalent to CONFIG_RT_GROUP_SCHED=n on v2). @Michal Koutný So we should skip test cgroupv2 with CONFIG_RT_GROUP_SCHED=yes, correct? Like following change? diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c index 55516ec89..b12bd7857 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c @@ -43,10 +43,9 @@ static void setup(void) tp.type = tv->ts_type; + static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", NULL}; + if ((access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) && !tst_kconfig_check(kconf_strict)) { + tst_brk(TCONF, "CONFIG_RT_GROUP_SCHED not support on cgroupv2"); + } > > HTH, > Michal -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <rugkmu3bcsrqgehibgy3dn7nsisuv6lip7b5cmo3bewq4zjcdn@zuo6hg25pqyz>]
* Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) [not found] ` <rugkmu3bcsrqgehibgy3dn7nsisuv6lip7b5cmo3bewq4zjcdn@zuo6hg25pqyz> @ 2025-06-09 13:33 ` Petr Vorel 0 siblings, 0 replies; 10+ messages in thread From: Petr Vorel @ 2025-06-09 13:33 UTC (permalink / raw) To: Michal Koutný; +Cc: cgroups, ltp Hi all, > On Sat, Jun 07, 2025 at 02:42:22PM -0400, Wei Gao <wegao@suse.com> wrote: > > @Michal Koutný So we should skip test cgroupv2 with CONFIG_RT_GROUP_SCHED=yes, correct? > Ideally, no one should run v2 with CONFIG_RT_GROUP_SCHED=y, so this > would never fail :-p @Michal thanks for a clarification. It's default n and Documentation/scheduler/sched-rt-group.rst which mentions CONFIG_RT_GROUP_SCHED also mentions Documentation/admin-guide/cgroup-v1/cgroups.rst, that should be a good hint for people changing the defaults :). Also, there are 3 old mips and sh boards which set CONFIG_RT_GROUP_SCHED=y. Probably nobody cares much nowadays, but maybe it should be deleted. > > Like following change? > But if there are such poor souls, that skip should make the test not > obstruct the rest of LTP. @Andrea, you claimed it's merged, but maybe you reply to a wrong thread because it's not merged. https://lore.kernel.org/ltp/b15fa0cb-e893-4642-9aa0-05f732b75131@suse.com/ I agree with Cyril to have a custom function in lib/tst_cgroup.c, which would be called by affected tests. Kind regards, Petr > Thanks, > Michal -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) 2025-06-05 14:29 [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) Wei Gao via ltp 2025-06-05 9:40 ` Petr Vorel @ 2025-06-05 13:14 ` Cyril Hrubis 2025-06-10 22:14 ` [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y Wei Gao via ltp 2 siblings, 0 replies; 10+ messages in thread From: Cyril Hrubis @ 2025-06-05 13:14 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > index b4d75bdcc..55516ec89 100644 > --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > @@ -43,6 +43,12 @@ static void setup(void) > > tp.type = tv->ts_type; > > + if (access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) { > + int pid = getpid(); > + > + SAFE_FILE_PRINTF("/sys/fs/cgroup/cgroup.procs", "%d", pid); > + } > + If we are going to fix more than one test it would make sense to put this code somewhere in a common header in the top level include/. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y 2025-06-05 14:29 [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) Wei Gao via ltp 2025-06-05 9:40 ` Petr Vorel 2025-06-05 13:14 ` Cyril Hrubis @ 2025-06-10 22:14 ` Wei Gao via ltp 2025-08-22 1:38 ` Li Wang via ltp 2 siblings, 1 reply; 10+ messages in thread From: Wei Gao via ltp @ 2025-06-10 22:14 UTC (permalink / raw) To: ltp; +Cc: mkoutny RT_GROUP scheduling is cgroup v1 feature as of now. So we need skip test cases for cgroup v2 with CONFIG_RT_GROUP_SCHED=y. Skip cases list: sched_rr_get_interval01 sched_rr_get_interval02 sched_rr_get_interval03 sched_setparam02 sched_getscheduler01 Fixes: https://github.com/linux-test-project/ltp/issues/1245 Signed-off-by: Wei Gao <wegao@suse.com> --- include/tst_cgroup.h | 2 ++ lib/tst_cgroup.c | 11 +++++++++++ .../sched_getscheduler/sched_getscheduler01.c | 2 ++ .../sched_rr_get_interval/sched_rr_get_interval01.c | 2 ++ .../sched_rr_get_interval/sched_rr_get_interval02.c | 2 ++ .../sched_rr_get_interval/sched_rr_get_interval03.c | 2 ++ .../kernel/syscalls/sched_setparam/sched_setparam02.c | 2 ++ 7 files changed, 23 insertions(+) diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h index d2b5224a0..0f0f44ec3 100644 --- a/include/tst_cgroup.h +++ b/include/tst_cgroup.h @@ -256,4 +256,6 @@ int safe_cg_occursin(const char *file, const int lineno, int tst_cg_memory_recursiveprot(struct tst_cg_group *cg); +void tst_check_rt_group_sched_support(void); + #endif /* TST_CGROUP_H */ diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index 36602402d..4ebdf701f 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -16,6 +16,7 @@ #include "lapi/fcntl.h" #include "lapi/mount.h" #include "tst_safe_file_at.h" +#include "tst_kconfig.h" struct cgroup_root; @@ -1531,3 +1532,13 @@ int tst_cg_memory_recursiveprot(struct tst_cg_group *cg) return cg->dirs_by_ctrl[0]->dir_root->memory_recursiveprot; return 0; } + +void tst_check_rt_group_sched_support(void) +{ + static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", NULL}; + + if ((access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) && !tst_kconfig_check(kconf)) { + tst_brk(TCONF, "CONFIG_RT_GROUP_SCHED not support on cgroupv2"); + } + +} diff --git a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c index 7edb59481..58bbede9a 100644 --- a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c +++ b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c @@ -39,6 +39,8 @@ static void run(unsigned int n) struct test_cases_t *tc = &tcases[n]; struct sched_param p = { .sched_priority = tc->priority }; + tst_check_rt_group_sched_support(); + TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, tc->policy, &p)); if (!TST_PASS) diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c index b4d75bdcc..6dbf5af89 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c @@ -43,6 +43,8 @@ static void setup(void) tp.type = tv->ts_type; + tst_check_rt_group_sched_support(); + if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1) tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c index 789e5ff10..3f6f34bbc 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c @@ -36,6 +36,8 @@ static void setup(void) tp.type = tv->ts_type; + tst_check_rt_group_sched_support(); + if ((sys_sched_setscheduler(0, SCHED_FIFO, &p)) == -1) tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); } diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c index 5e2f4ed7e..d4b7a6f22 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c @@ -59,6 +59,8 @@ static void setup(void) bad_addr = tst_get_bad_addr(NULL); tp.type = tv->ts_type; + tst_check_rt_group_sched_support(); + if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1) tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c index d71e2c6d6..99277baf6 100644 --- a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c +++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c @@ -36,6 +36,8 @@ static void run(unsigned int n) struct sched_variant *tv = &sched_variants[tst_variant]; struct sched_param p = { .sched_priority = tc->param }; + tst_check_rt_group_sched_support(); + TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, tc->policy, &p)); p.sched_priority = tc->priority; -- 2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y 2025-06-10 22:14 ` [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y Wei Gao via ltp @ 2025-08-22 1:38 ` Li Wang via ltp 2025-08-22 1:42 ` Li Wang via ltp 0 siblings, 1 reply; 10+ messages in thread From: Li Wang via ltp @ 2025-08-22 1:38 UTC (permalink / raw) To: Wei Gao; +Cc: mkoutny, ltp On Tue, Jun 10, 2025 at 6:15 PM Wei Gao via ltp <ltp@lists.linux.it> wrote: > RT_GROUP scheduling is cgroup v1 feature as of now. So we need skip test > cases > for cgroup v2 with CONFIG_RT_GROUP_SCHED=y. > > Skip cases list: > sched_rr_get_interval01 > sched_rr_get_interval02 > sched_rr_get_interval03 > sched_setparam02 > sched_getscheduler01 > > Fixes: https://github.com/linux-test-project/ltp/issues/1245 > Signed-off-by: Wei Gao <wegao@suse.com> > --- > include/tst_cgroup.h | 2 ++ > lib/tst_cgroup.c | 11 +++++++++++ > .../sched_getscheduler/sched_getscheduler01.c | 2 ++ > .../sched_rr_get_interval/sched_rr_get_interval01.c | 2 ++ > .../sched_rr_get_interval/sched_rr_get_interval02.c | 2 ++ > .../sched_rr_get_interval/sched_rr_get_interval03.c | 2 ++ > .../kernel/syscalls/sched_setparam/sched_setparam02.c | 2 ++ > 7 files changed, 23 insertions(+) > > diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h > index d2b5224a0..0f0f44ec3 100644 > --- a/include/tst_cgroup.h > +++ b/include/tst_cgroup.h > @@ -256,4 +256,6 @@ int safe_cg_occursin(const char *file, const int > lineno, > > int tst_cg_memory_recursiveprot(struct tst_cg_group *cg); > > +void tst_check_rt_group_sched_support(void); > + > #endif /* TST_CGROUP_H */ > diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c > index 36602402d..4ebdf701f 100644 > --- a/lib/tst_cgroup.c > +++ b/lib/tst_cgroup.c > @@ -16,6 +16,7 @@ > #include "lapi/fcntl.h" > #include "lapi/mount.h" > #include "tst_safe_file_at.h" > +#include "tst_kconfig.h" > > struct cgroup_root; > > @@ -1531,3 +1532,13 @@ int tst_cg_memory_recursiveprot(struct tst_cg_group > *cg) > return cg->dirs_by_ctrl[0]->dir_root->memory_recursiveprot; > return 0; > } > + > +void tst_check_rt_group_sched_support(void) > +{ > + static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", > NULL}; > + > + if ((access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) && > !tst_kconfig_check(kconf)) { > Here is what we assume the cgrup v2 default mount path, but better to use cgroup_v2_mounted() in case some test env is not mount cgroup on the path. I made the below change and pushed: --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -1537,7 +1537,9 @@ void tst_check_rt_group_sched_support(void) { static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", NULL}; - if (cgroup_v2_mounted() && !tst_kconfig_check(kconf)) { + tst_cg_scan(); + + if (cgroup_v2_mounted() && tst_kconfig_check(kconf)) { tst_brk(TCONF, "CONFIG_RT_GROUP_SCHED not support on cgroupv2"); } -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y 2025-08-22 1:38 ` Li Wang via ltp @ 2025-08-22 1:42 ` Li Wang via ltp 0 siblings, 0 replies; 10+ messages in thread From: Li Wang via ltp @ 2025-08-22 1:42 UTC (permalink / raw) To: Wei Gao; +Cc: mkoutny, ltp On Fri, Aug 22, 2025 at 9:38 AM Li Wang <liwang@redhat.com> wrote: > > > On Tue, Jun 10, 2025 at 6:15 PM Wei Gao via ltp <ltp@lists.linux.it> > wrote: > >> RT_GROUP scheduling is cgroup v1 feature as of now. So we need skip test >> cases >> for cgroup v2 with CONFIG_RT_GROUP_SCHED=y. >> >> Skip cases list: >> sched_rr_get_interval01 >> sched_rr_get_interval02 >> sched_rr_get_interval03 >> sched_setparam02 >> sched_getscheduler01 >> >> Fixes: https://github.com/linux-test-project/ltp/issues/1245 >> Signed-off-by: Wei Gao <wegao@suse.com> >> --- >> include/tst_cgroup.h | 2 ++ >> lib/tst_cgroup.c | 11 +++++++++++ >> .../sched_getscheduler/sched_getscheduler01.c | 2 ++ >> .../sched_rr_get_interval/sched_rr_get_interval01.c | 2 ++ >> .../sched_rr_get_interval/sched_rr_get_interval02.c | 2 ++ >> .../sched_rr_get_interval/sched_rr_get_interval03.c | 2 ++ >> .../kernel/syscalls/sched_setparam/sched_setparam02.c | 2 ++ >> 7 files changed, 23 insertions(+) >> >> diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h >> index d2b5224a0..0f0f44ec3 100644 >> --- a/include/tst_cgroup.h >> +++ b/include/tst_cgroup.h >> @@ -256,4 +256,6 @@ int safe_cg_occursin(const char *file, const int >> lineno, >> >> int tst_cg_memory_recursiveprot(struct tst_cg_group *cg); >> >> +void tst_check_rt_group_sched_support(void); >> + >> #endif /* TST_CGROUP_H */ >> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c >> index 36602402d..4ebdf701f 100644 >> --- a/lib/tst_cgroup.c >> +++ b/lib/tst_cgroup.c >> @@ -16,6 +16,7 @@ >> #include "lapi/fcntl.h" >> #include "lapi/mount.h" >> #include "tst_safe_file_at.h" >> +#include "tst_kconfig.h" >> >> struct cgroup_root; >> >> @@ -1531,3 +1532,13 @@ int tst_cg_memory_recursiveprot(struct >> tst_cg_group *cg) >> return >> cg->dirs_by_ctrl[0]->dir_root->memory_recursiveprot; >> return 0; >> } >> + >> +void tst_check_rt_group_sched_support(void) >> +{ >> + static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", >> NULL}; >> + >> + if ((access("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) && >> !tst_kconfig_check(kconf)) { >> > > Here is what we assume the cgrup v2 default mount path, but > better to use cgroup_v2_mounted() in case some test env is not > mount cgroup on the path. > > I made the below change and pushed: > > --- a/lib/tst_cgroup.c > +++ b/lib/tst_cgroup.c > @@ -1537,7 +1537,9 @@ void tst_check_rt_group_sched_support(void) > { > static const char * const kconf[] = {"CONFIG_RT_GROUP_SCHED=y", > NULL}; > > - if (cgroup_v2_mounted() && !tst_kconfig_check(kconf)) { > + tst_cg_scan(); > + > + if (cgroup_v2_mounted() && tst_kconfig_check(kconf)) { > tst_brk(TCONF, "CONFIG_RT_GROUP_SCHED not support on > cgroupv2"); > } > Sorry, I copied the wrong content from my test machine, the merged patch is actually like: https://github.com/linux-test-project/ltp/commit/1bddde12f1d7b96d5c7a2157877330bbeb9b26d9 -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-08-22 1:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 14:29 [LTP] [PATCH v1] sched_rr_get_interval01.c: Put test process into absolute root cgroup (0::/) Wei Gao via ltp
2025-06-05 9:40 ` Petr Vorel
2025-06-05 11:17 ` Andrea Cervesato via ltp
[not found] ` <orzx7vfokvwuceowwjctea4yvujn75djunyhsqvdfr5bw7kqe7@rkn5tlnzwllu>
2025-06-07 4:01 ` Wei Gao via ltp
2025-06-07 18:42 ` Wei Gao via ltp
[not found] ` <rugkmu3bcsrqgehibgy3dn7nsisuv6lip7b5cmo3bewq4zjcdn@zuo6hg25pqyz>
2025-06-09 13:33 ` Petr Vorel
2025-06-05 13:14 ` Cyril Hrubis
2025-06-10 22:14 ` [LTP] [PATCH v2] tst_cgroup.c: Skip cases which testing cgroup v2 with CONFIG_RT_GROUP_SCHED=y Wei Gao via ltp
2025-08-22 1:38 ` Li Wang via ltp
2025-08-22 1:42 ` Li Wang via ltp
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox