* [LTP] Question on .needs_cgroup_ctrls for cgroupv2
@ 2023-02-27 14:44 Wei Gao via ltp
2023-02-27 14:58 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Wei Gao via ltp @ 2023-02-27 14:44 UTC (permalink / raw)
To: rpalethorpe; +Cc: ltp
Hi Richard
How to setup correct test case for cgroupv2 check? I try to put following parameter but failed.
struct tst_test test = {
...
.needs_cgroup_ctrls = (const char *const []){ "unified", NULL },
.needs_cgroup_ver = TST_CG_V2,
};
After some investigation i found cgroup_find_ctrl which called by tst_cg_require seems not implement
how to check cgroupv2, the controllers has no "unified" memeber, should we add CGROUP_CTRL_MEMBER("unified", xxx)
into controllers? Correct me if any misunderstanding.
void tst_cg_require(const char *const ctrl_name,
const struct tst_cg_opts *options)
{
struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
Thanks.
Regards
Gao Wei
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [LTP] Question on .needs_cgroup_ctrls for cgroupv2
2023-02-27 14:44 [LTP] Question on .needs_cgroup_ctrls for cgroupv2 Wei Gao via ltp
@ 2023-02-27 14:58 ` Cyril Hrubis
2023-02-27 15:17 ` Wei Gao via ltp
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2023-02-27 14:58 UTC (permalink / raw)
To: Wei Gao; +Cc: rpalethorpe, ltp
Hi!
> How to setup correct test case for cgroupv2 check? I try to put following parameter but failed.
>
> struct tst_test test = {
> ...
> .needs_cgroup_ctrls = (const char *const []){ "unified", NULL },
> .needs_cgroup_ver = TST_CG_V2,
> };
>
>
> After some investigation i found cgroup_find_ctrl which called by tst_cg_require seems not implement
> how to check cgroupv2, the controllers has no "unified" memeber, should we add CGROUP_CTRL_MEMBER("unified", xxx)
> into controllers? Correct me if any misunderstanding.
>
>
> void tst_cg_require(const char *const ctrl_name,
> const struct tst_cg_opts *options)
> {
> struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
I think that you are misunderstanding something, controllers that are
checked by the .needs_cgroup_ctrls and tst_cg_require() are cgroup
controllers such as memory or cpu controller.
And unified can be the hierarchy, that means that all controllers are in
a single mount point which is how controllers are presented in the
cgroup V2.
You can have a mix of V1 and V2 controllers on a system and LTP library
abstracts away all the details so that you can focus on the test logic
rather than on how things are set up on the system. You have to start by
specifying which controllers is the test going to use, that's the
.needs_cgroup_ctrls array and if the test is V2 only you pass the
TST_CG_V2 in the flags.
--
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] Question on .needs_cgroup_ctrls for cgroupv2
2023-02-27 14:58 ` Cyril Hrubis
@ 2023-02-27 15:17 ` Wei Gao via ltp
2023-02-27 15:28 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Wei Gao via ltp @ 2023-02-27 15:17 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: rpalethorpe, ltp
On Mon, Feb 27, 2023 at 03:58:41PM +0100, Cyril Hrubis wrote:
> Hi!
> > How to setup correct test case for cgroupv2 check? I try to put following parameter but failed.
> >
> > struct tst_test test = {
> > ...
> > .needs_cgroup_ctrls = (const char *const []){ "unified", NULL },
> > .needs_cgroup_ver = TST_CG_V2,
> > };
> >
> >
> > After some investigation i found cgroup_find_ctrl which called by tst_cg_require seems not implement
> > how to check cgroupv2, the controllers has no "unified" memeber, should we add CGROUP_CTRL_MEMBER("unified", xxx)
> > into controllers? Correct me if any misunderstanding.
> >
> >
> > void tst_cg_require(const char *const ctrl_name,
> > const struct tst_cg_opts *options)
> > {
> > struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
>
> I think that you are misunderstanding something, controllers that are
> checked by the .needs_cgroup_ctrls and tst_cg_require() are cgroup
> controllers such as memory or cpu controller.
>
> And unified can be the hierarchy, that means that all controllers are in
> a single mount point which is how controllers are presented in the
> cgroup V2.
>
> You can have a mix of V1 and V2 controllers on a system and LTP library
> abstracts away all the details so that you can focus on the test logic
> rather than on how things are set up on the system. You have to start by
> specifying which controllers is the test going to use, that's the
> .needs_cgroup_ctrls array and if the test is V2 only you pass the
> TST_CG_V2 in the flags.
So .needs_cgroup_ctrls can not used anymore for ONLY V2 case?
Since i encounter "tst_cgroup.c:848: TCONF: V2 'memory' controller required, but it's mounted on V1" when i add ".needs_cgroup_ctrls = (const char *const []){ "memory", NULL }".
If yes then i have to manual create V2 cgroup in test case?
BTW is there any example for V2 case? I try to run some case with V2 enalbed but both failed.
>
> --
> 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] Question on .needs_cgroup_ctrls for cgroupv2
2023-02-27 15:17 ` Wei Gao via ltp
@ 2023-02-27 15:28 ` Cyril Hrubis
2023-02-27 15:52 ` Richard Palethorpe
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2023-02-27 15:28 UTC (permalink / raw)
To: Wei Gao; +Cc: rpalethorpe, ltp
Hi!
> So .needs_cgroup_ctrls can not used anymore for ONLY V2 case?
> Since i encounter "tst_cgroup.c:848: TCONF: V2 'memory' controller required, but it's mounted on V1" when i add ".needs_cgroup_ctrls = (const char *const []){ "memory", NULL }".
Each controller can be mounted as V1 or as V2 but not both at the same
time. It depends on how the system is booted, the default on most
distributions is mixed V1 and V2 at the moment. If you want V2 system
you have to reboot with systemd.unified_cgroup_hierarchy=1.
--
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] Question on .needs_cgroup_ctrls for cgroupv2
2023-02-27 15:28 ` Cyril Hrubis
@ 2023-02-27 15:52 ` Richard Palethorpe
0 siblings, 0 replies; 5+ messages in thread
From: Richard Palethorpe @ 2023-02-27 15:52 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hello,
Cyril Hrubis <chrubis@suse.cz> writes:
> Hi!
>> So .needs_cgroup_ctrls can not used anymore for ONLY V2 case?
>> Since i encounter "tst_cgroup.c:848: TCONF: V2 'memory' controller
>> required, but it's mounted on V1" when i add ".needs_cgroup_ctrls =
>> (const char *const []){ "memory", NULL }".
You should see this works fine on Tumbleweed where pure V2 is the
default.
>
> Each controller can be mounted as V1 or as V2 but not both at the same
> time. It depends on how the system is booted, the default on most
> distributions is mixed V1 and V2 at the moment. If you want V2 system
> you have to reboot with systemd.unified_cgroup_hierarchy=1.
Yes that is the kernel command line option which you can add through
GRUB (unless I am mistaken).
Or it can be specified in the systemd configuration somewhere.
LTP does not try to remount CGroups if a controller is not on the
required version. If you need to test the unified hierarchy or a V2
controller then the simplest thing to do is configure systemd to only
use V2 (unified).
The exception is if the needed controller is not mounted already, then
LTP will mount it. This is the case if you, for e.g., use Rapido or some
buildroot config with CGroups in the kernel, but not userland.
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-27 16:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 14:44 [LTP] Question on .needs_cgroup_ctrls for cgroupv2 Wei Gao via ltp
2023-02-27 14:58 ` Cyril Hrubis
2023-02-27 15:17 ` Wei Gao via ltp
2023-02-27 15:28 ` Cyril Hrubis
2023-02-27 15:52 ` Richard Palethorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox