linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.28k stars 999 forks source link

cputest_regression_test fails with error: Both cpuset.cpu_exclusive and cpu_exclusive do not exist in rhel #1028

Closed smayasomesh closed 1 year ago

smayasomesh commented 1 year ago

cputest_regression_test fails with error: Both cpuset.cpu_exclusive and cpu_exclusive do not exist in rhel9

./runltp -f controllers -s cpuset_regression_test

Error: cpuset_regression_test 1 TBROK: Both cpuset.cpu_exclusive and cpu_exclusive do not exist

Summary: passed 0 failed 0 broken 1 skipped 0 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=2 corefile=no cutime=6 cstime=3 <<>> INFO: ltp-pan reported some tests FAIL LTP Version: 20230127

   ###############################################################

        Done executing testcases.
        LTP Version:  20230127
   ###############################################################

cat /sys/gs/cgroup - wherein cpuset doesnt exist. However created it manually

mount | grep group cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)

cat /sys/fs/cgroup/cgroup.controllers cpuset cpu io memory hugetlb pids rdma misc

cat /proc/filesystems | grep cpuset nodev cpuset

cd /sys/fs/cgroup ls cgroup.controllers cpuset.mems.effective memory.stat cgroup.max.depth cpu.stat misc.capacity cgroup.max.descendants dev-hugepages.mount proc-fs-nfsd.mount cgroup.procs dev-mqueue.mount proc-sys-fs-binfmt_misc.mount cgroup.stat init.scope sys-fs-fuse-connections.mount cgroup.subtree_control io.pressure sys-kernel-config.mount cgroup.threads io.stat sys-kernel-debug.mount cpu.pressure memory.numa_stat sys-kernel-tracing.mount cpuset memory.pressure system.slice cpuset.cpus.effective memory.reclaim user.slice

where in still cpu_exclusive doesnot exist

cat /proc/filesystems | grep cpuset nodev cpuset

metan-ucw commented 1 year ago

Looking at kernel sources it looks like cpuset purposely exposes minimal interface in the V2 hierarchy, so I suppose the best course of action is to skip the cpu_exclusive tests if we are on v2 cpuset controller.

Sowmya-Indranna commented 1 year ago

Can I go ahead with the patch to skip this test if cgroup v2 cpuset controllers are found?

metan-ucw commented 1 year ago

@Sowmya-Indranna ideally the test should be fixed to return TCONF instead of TBROK.

Sowmya-Indranna commented 1 year ago

tested this patch to skip if the cgroup is V2. Please check and confirm if this looks fine.

In cpuset/cpuset_regression_test.sh

setup() { cgroup_require "cpuset" cgroup_version=$(cgroup_get_version "cpuset") root_cpuset_dir=$(cgroup_get_mountpoint "cpuset") testpath=$(cgroup_get_test_path "cpuset") task_list=$(cgroup_get_task_list "cpuset") tst_res TINFO "test starts with cgroup version $cgroup_version"

    **if [ "$cgroup_version" = "2" ]; then
            tst_res TINFO "Controller mounted on cgroup2 hierarchy, skipping test"
            return
    fi**
    if ! [ -f ${root_cpuset_dir}/${cpu_exclusive} ]; then
            cpu_exclusive=cpu_exclusive
            cpus=cpus
    fi

do_test() { local cpu_exclusive_tmp cpus_value ROD_SILENT mkdir ${root_cpuset_dir}/testdir

    **if [ "$cgroup_version" = "2" ]; then
            tst_res TCONF "Cgroup v2 found, skipping test"
            return
    fi**
    # Creat an exclusive cpuset.
    echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}
    [ $? -ne 0 ] && tst_brk TFAIL "'echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}' failed"

tested the results across cgroup version:

if cgroup version is 2 then the results achieved is

Running tests....... <<>> tag=cpuset_regression_test stime=1682694849 cmdline="cpuset_regression_test.sh" contacts="" analysis=exit <<>> incrementing stop cpuset_regression_test 1 TINFO: trying to disable AppArmor (requires super/root) cpuset_regression_test 1 TINFO: timeout per run is 3h 20m 0s cpuset_regression_test 1 TINFO: test starts with cgroup version 2 cpuset_regression_test 1 TINFO: Controller mounted on cgroup2 hierarchy cpuset_regression_test 1 TCONF: Cgroup v2 found, skipping test

Summary: passed 0 failed 0 broken 0 skipped 1 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=32 corefile=no cutime=5 cstime=2 <<>> INFO: ltp-pan reported all tests PASS LTP Version: 20230127

if the cgroup version is 1

Running tests....... <<>> tag=cpuset_regression_test stime=1682695457 cmdline="cpuset_regression_test.sh" contacts="" analysis=exit <<>> incrementing stop cpuset_regression_test 1 TINFO: trying to disable AppArmor (requires super/root) cpuset_regression_test 1 TINFO: timeout per run is 3h 20m 0s cpuset_regression_test 1 TINFO: test starts with cgroup version 1 cpuset_regression_test 1 TPASS: Bug is not reproducible

Summary: passed 1 failed 0 broken 0 skipped 0 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=0 corefile=no cutime=7 cstime=1 <<>> INFO: ltp-pan reported all tests PASS LTP Version: 20220527

Request to review

Sowmya-Indranna commented 1 year ago

Awaiting review for this to return TCONF instead of TBRK if the cgroup version is 2

Sowmya-Indranna commented 1 year ago

@metan-ucw - please review the above fix to return TCONF if its cgroup version2

metan-ucw commented 1 year ago

@Sowmya-Indranna we can just do tst_brk TCONF "..." in the test setup, no need to touch the do_test(). Can you please send a patch to the mailing list?

Sowmya-TI commented 1 year ago

setup() { cgroup_require "cpuset" cgroup_version=$(cgroup_get_version "cpuset") root_cpuset_dir=$(cgroup_get_mountpoint "cpuset") testpath=$(cgroup_get_test_path "cpuset") task_list=$(cgroup_get_task_list "cpuset")

    tst_res TINFO "test starts with cgroup version $cgroup_version"

    **if [ "$cgroup_version" = "2" ]; then
            tst_brk TCONF "Cgroup v2 found, skipping test"
            return
    fi**

    if ! [ -f ${root_cpuset_dir}/${cpu_exclusive} ]; then
            cpu_exclusive=cpu_exclusive
            cpus=cpus
    fi

sending the patch for the mailing list

Sowmya-Indranna commented 1 year ago

Results:

tag=cpuset_regression_test stime=1683873223 cmdline="cpuset_regression_test.sh" contacts="" analysis=exit <<>> [260510.712839] LTP: starting cpuset_regression_test (cpuset_regression_test.sh) incrementing stop cpuset_regression_test 1 TINFO: timeout per run is 0h 5m 0s cpuset_regression_test 1 TINFO: test starts with cgroup version 2 cpuset_regression_test 1 TCONF: Cgroup v2 found, skipping test

Summary: passed 0 failed 0 broken 0 skipped 1 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=32 corefile=no cutime=3 cstime=0 <<>> INFO: ltp-pan reported all tests PASS LTP Version: 20230127

Sowmya-Indranna commented 1 year ago

patch sent to the mailing list