[LTP] [RFC PATCH v3 1/1] test_controllers: Skip test when cgroup v2 is loaded
Petr Vorel
pvorel@suse.cz
Mon May 26 17:08:54 CEST 2025
From: Jin Guojie <guojie.jin@gmail.com>
When running "controllers" case on some newer Linux distributions, there
will be 10 ERROR messages during the setup phase, and several TFAIL
results at the end [1].
Current "controllers" cases only implement tests for cgroup v1 file interface.
It's better to skip the test after checking that v2 hierarchy has
already been loaded.
[1] https://lore.kernel.org/ltp/CA+B+MYSUASROU_8SkfKmz5c-7PjX2epovAzXMRS4a1nDFsVWOA@mail.gmail.com/
Tested-by: Ricardo B. Marlière <rbm@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Jin Guojie <guojie.jin@gmail.com>
[ pvorel: simplify, rebased ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
* changes v2->v3
- remove bashisms (although we use /bin/bash, better to avoid &> )
- simplify
* v2
https://patchwork.ozlabs.org/project/ltp/patch/CA+B+MYT=RRPEUQ8WydQWeQkB02xO5=EJd=gqOTXB1F5OUWj9HQ@mail.gmail.com/
* v1
https://patchwork.ozlabs.org/project/ltp/patch/CA+B+MYSUASROU_8SkfKmz5c-7PjX2epovAzXMRS4a1nDFsVWOA@mail.gmail.com/
Hi all,
candidate for the release.
Richardo pointed out this 6 months old patch [1].
Is it even useful nowadays when we have various C and shell based
tests? Shouldn't we just delete the test?
It even uses "blockio", shouldn't it be "blkio"?
Given the test is still somehow useful, i'm not sure if this is worth to
rewrite to cgroup_lib.sh (or even to the C API), but IMHO now before the
release I would just skip it on v2.
I'm not sure if all tests called by test_controllers.sh [2] should be
skipped when run with v2. According to Ricardo's run via openQA [3]
(below) there are quite a lot of failures:
TEST 1: CPU CONTROLLER TESTING
RUNNING SETUP.....
ERROR: Could not mount cgroup filesystem on /dev/cpuctl..Exiting test
Cleanup called
cat: /dev/cpuctl/group_def/tasks: No such file or directory
TEST 3: CPU CONTROLLER TESTING
RUNNING SETUP.....
ERROR: Could not mount cgroup filesystem on /dev/cpuctl..Exiting test
Cleanup called
cat: /dev/cpuctl/group_def/tasks: No such file or directory
...
TINFO Running cpuctl Latency Test 1
TINFO The latency check task started
FAIL The Latency test 1 failed
Max latency observed = 42318 in Iteration 0
The results FAIL is just intuitive and not exact failure. Please look at cpuctl_testplan.txt in the test directory.
Task 431164 exited abnormally with return value: 1
TBROK Test could'nt execute for expected duration
Doing cleanup
Cleanup done for latency test 1
TINFO Running cpuctl Latency Test 2
ERROR: Could not mount cgroup filesystem on /dev/cpuctl..Exiting test
Cleanup called
cat: /dev/cpuctl/group_def/tasks: No such file or directory
Doing cleanup
cat: '/dev/cpuctl/group*/tasks': No such file or directory
rmdir: failed to remove '/dev/cpuctl/group*': No such file or directory
umount: /dev/cpuctl: no mount point specified.
rmdir: failed to remove '/dev/cpuctl': No such file or directory
Cleanup done for latency test 2
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
dmesg(1) may have more information after failed mount system call.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case1 FAIL
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
dmesg(1) may have more information after failed mount system call.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case2 FAIL
...
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case21 FAIL
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
dmesg(1) may have more information after failed mount system call.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case22 FAIL
CONTROLLERS TESTCASES: WARNING
Either Kernel does not support for memory controller or functionality is not enabled
Skipping all memory controller testcases....
CONTROLLERS TESTCASES: WARNING
Either Kernel does not support for io controller or functionality is not enabled
Skipping all block device I/O throttling testcases....
CONTROLLERS TESTCASES: WARNING
Either Kernel does not support for freezer or functionality is not enabled
Kernel does not support freezer controller
Skipping all freezer testcases....
Could not start cpu accounting controller test
Either Kernel does not support for cpu accounting controller or functionality is not enabled
usage: run_cpuacct_test.sh
Skipping the cpu accounting controller test...
When I run it on some not that old Tumbleweed VM first 10 tests work:
# mount | grep "type cgroup"
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
cgroup on /dev/cpuctl type cgroup (rw,relatime,cpu)
$ uname -a
Linux ts 6.14.0-3.g5e7754e-default #1 SMP PREEMPT_DYNAMIC Mon Mar 31 14:34:31 UTC 2025 (5e7754e) x86_64 x86_64 x86_64 GNU/Linux
TEST 1: CPU CONTROLLER TESTING
RUNNING SETUP.....
WARN:/dev/cpuctl already exist..overwriting
Cleanup called
TEST STARTED: Please avoid using system while this test executes
/opt/ltp/testcases/bin/parameters.sh: line 56: /dev/cpuctl/group_def/cpu.rt_runtime_us: Permission denied
Successfully launched def task 6612 too
TASKS FIRED
Cpu controller test executed successfully.Results written to file
Please review the results in /opt/ltp/output/cpuctl_results_12.txt
Cleanup called
...
TEST 7: CPU CONTROLLER STRESS TESTING
RUNNING SETUP.....
TEST STARTED: Please avoid using system while this test executes
/opt/ltp/testcases/bin/parameters.sh: line 56: /dev/cpuctl/group_def/cpu.rt_runtime_us: Permission denied
Successfully launched def task 7168 too
TASKS FIRED
Cpu controller test executed successfully.Results written to file
Please review the results in /opt/ltp/output/cpuctl_results_stress-678.txt
Cleanup called
...
Some of the "latency tests 2" tests fail, but not that much as on openQA
(probably affected by overbooked VM):
TINFO Running cpuctl Latency Test 1
TINFO The latency check task started
FAIL The Latency test 1 failed
Max latency observed = 41925 in Iteration 0
The results FAIL is just intuitive and not exact failure. Please look at cpuctl_testplan.txt in the test directory.
Task 9657 exited abnormally with return value: 1
TBROK Test could'nt execute for expected duration
Doing cleanup
Cleanup done for latency test 1
TINFO Running cpuctl Latency Test 2
TINFO The latency check task started
PASS The Latency test 2 passed
Max latency observed = 17002 microsec in Iteration 0
Doing cleanup
Cleanup done for latency test 2
cpuctl_test_fj 1 TPASS : case1 PASS
cpuctl_test_fj 1 TPASS : case2 PASS
cpuctl_test_fj 1 TPASS : case3 PASS
cpuctl_test_fj 1 TPASS : case4 PASS
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case5 FAIL
cpuctl_fj_simple_echo: write error: Invalid argument
cpuctl_test_fj 1 TPASS : case6 PASS
cpuctl_fj_simple_echo: write error: Invalid argument
cpuctl_test_fj 1 TPASS : case7 PASS
cpuctl_test_fj 1 TPASS : case8 PASS
cpuctl_test_fj 1 TPASS : case9 PASS
cpuctl_test_fj 1 TPASS : case10 PASS
cpuctl_test_fj 1 TPASS : case11 PASS
cpuctl_test_fj 1 TPASS : case12 PASS
cpuctl_test_fj 1 TPASS : case13 PASS
cpuctl_test_fj 1 TPASS : case14 PASS
cpuctl_fj_simple_echo: write error: Invalid argument
cpuctl_test_fj 1 TPASS : case15 PASS
cpuctl_fj_simple_echo: write error: Invalid argument
cpuctl_test_fj 1 TPASS : case16 PASS
cpuctl_fj_simple_echo: write error: Invalid argument
cpuctl_test_fj 1 TPASS : case17 PASS
cpuctl_test_fj 1 TPASS : case18 PASS
pid 10654 cpu_usage 100
cpuctl_test_fj 1 TPASS : case19 PASS
pid 10680 cpu_usage 98
cpuctl_test_fj 1 TPASS : case20 PASS
pid 10706 cpu_usage 48
pid 10706 cpu_usage 48
pid 10706 cpu_usage 48
pid 10706 cpu_usage 48
pid 10706 cpu_usage 46
pid 10706 cpu_usage 47
pid 10706 cpu_usage 48
pid 10706 cpu_usage 59
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case21 FAIL
pid 10813 cpu_usage 98
pid 10813 cpu_usage 88
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case22 FAIL
CONTROLLERS TESTCASES: WARNING
---
But when I try to run them on SLES 12-SP5 (4.12.14 based) with cgroup v1
"Latency Test 2" tests fail even more:
# mount | grep "type cgroup"
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
TEST 1: CPU CONTROLLER TESTING
RUNNING SETUP.....
ERROR: Could not mount cgroup filesystem on /dev/cpuctl..Exiting test
Cleanup called
cat: /dev/cpuctl/group_def/tasks: No such file or directory
TEST 10: CPU CONTROLLER STRESS TESTING
RUNNING SETUP.....
ERROR: Could not mount cgroup filesystem on /dev/cpuctl..Exiting test
Cleanup called
cat: /dev/cpuctl/group_def/tasks: No such file or directory
TINFO Running cpuctl Latency Test 1
TINFO The latency check task started
PASS The Latency test 1 passed
Max latency observed = 3324 microsec in Iteration 0
Doing cleanup
Cleanup done for latency test 1
TINFO Running cpuctl Latency Test 2
ERROR: Could not mount cgroup filesystem on /dev/cpuctl..Exiting test
Cleanup called
cat: /dev/cpuctl/group_def/tasks: No such file or directory
Doing cleanup
cat: '/dev/cpuctl/group*/tasks': No such file or directory
rmdir: failed to remove '/dev/cpuctl/group*': No such file or directory
umount: /dev/cpuctl: no mount point specified.
rmdir: failed to remove '/dev/cpuctl': No such file or directory
Cleanup done for latency test 2
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case1 FAIL
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case2 FAIL
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: case3 FAIL
mount: /dev/cpuctl: cpuctl already mounted or mount point busy.
cpuctl_test_fj 1 TFAIL : ltpapicmd.c:188: failed to mount cpu subsystem... Exiting
[1] https://patchwork.ozlabs.org/project/ltp/patch/CA+B+MYT=RRPEUQ8WydQWeQkB02xO5=EJd=gqOTXB1F5OUWj9HQ@mail.gmail.com/
[2] https://github.com/linux-test-project/ltp/tree/master/testcases/kernel/controllers/test_controllers.sh
[3] https://openqa.opensuse.org/tests/5066388#step/controllers/8
testcases/kernel/controllers/test_controllers.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/testcases/kernel/controllers/test_controllers.sh b/testcases/kernel/controllers/test_controllers.sh
index 7aa974ff25..a34936626c 100755
--- a/testcases/kernel/controllers/test_controllers.sh
+++ b/testcases/kernel/controllers/test_controllers.sh
@@ -37,6 +37,11 @@
# #
##################################################################################
+if mount | grep -w "type cgroup2" > /dev/null 2>&1; then
+ tst_brkm TCONF "" "test_controllers.sh: V1 controller required, but mounted on V2"
+ exit 32
+fi
+
if [ -f /proc/cgroups ]
then
CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`;
--
2.49.0
More information about the ltp
mailing list