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.31k stars 1.01k forks source link

I meet a problem: memcontrol01&memcontrol02 test broken.What is the reason?tst_cgroup.c:550: TBROK: vdprintf(7</var/volatile/tmp/cgroup_memory>, 'memory.use_hierarchy', '%d'<1>): EBUSY (16) #1018

Open 844688449 opened 1 year ago

844688449 commented 1 year ago

Hello,I meet a problem, memcontrol01&memcontrol02 test broken. Here is the print information: ...... uname: Linux s9863a-1h10 5.4.180-android12-9 #1 SMP PREEMPT Fri Feb 10 03:00:01 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux ...... COMMAND: /opt/ltp/bin/ltp-pan -e -S -a 1731 -n 1731 -p -f /tmp/ltp-Lh0K6lnO7r/alltests -l /opt/ltp/results/raw.result -C /opt/ltp/output/LTP_RUN_ON-raw.result.failed -T /opt/ltp/output/LTP_RUN_ON-raw .result.tconf LOG File: /opt/ltp/results/raw.result FAILED COMMAND File: /opt/ltp/output/LTP_RUN_ON-raw.result.failed TCONF COMMAND File: /opt/ltp/output/LTP_RUN_ON-raw.result.tconf ...... <<>> tag=memcontrol01 stime=1676013867 cmdline="memcontrol01" contacts="" analysis=exit <<>> tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s tst_cgroup.c:491: TINFO: Mounted V2 CGroups on /tmp/cgroup_unified tst_cgroup.c:541: TINFO: Mounted V1 memory CGroup on /tmp/cgroup_memory tst_cgroup.c:550: TBROK: vdprintf(7</var/volatile/tmp/cgroup_memory>, 'memory.use_hierarchy', '%d'<1>): EBUSY (16)

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=1 cstime=3 <<>> <<>> tag=memcontrol02 stime=1676013867 cmdline="memcontrol02" contacts="" analysis=exit <<>> tst_device.c:88: TINFO: Found free device 0 '/dev/loop0' tst_supported_fs_types.c:89: TINFO: Kernel supports ext2 tst_supported_fs_types.c:51: TINFO: mkfs.ext2 does exist tst_supported_fs_types.c:89: TINFO: Kernel supports ext3 tst_supported_fs_types.c:51: TINFO: mkfs.ext3 does exist tst_supported_fs_types.c:89: TINFO: Kernel supports ext4 tst_supported_fs_types.c:51: TINFO: mkfs.ext4 does exist tst_supported_fs_types.c:115: TINFO: Filesystem xfs is not supported tst_supported_fs_types.c:115: TINFO: Filesystem btrfs is not supported tst_supported_fs_types.c:89: TINFO: Kernel supports vfat tst_supported_fs_types.c:47: TINFO: mkfs.vfat does not exist tst_supported_fs_types.c:89: TINFO: Kernel supports exfat tst_supported_fs_types.c:47: TINFO: mkfs.exfat does not exist tst_supported_fs_types.c:115: TINFO: Filesystem ntfs is not supported tst_supported_fs_types.c:89: TINFO: Kernel supports tmpfs tst_supported_fs_types.c:38: TINFO: mkfs is not needed for tmpfs tst_test.c:1500: TINFO: Testing on ext2 tst_test.c:996: TINFO: Formatting /dev/loop0 with ext2 opts='' extra opts='' mke2fs 1.45.7 (28-Jan-2021) tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s tst_cgroup.c:491: TINFO: Mounted V2 CGroups on /tmp/cgroup_unified tst_cgroup.c:541: TINFO: Mounted V1 memory CGroup on /tmp/cgroup_memory tst_cgroup.c:550: TBROK: vdprintf(7</var/volatile/tmp/cgroup_memory>, 'memory.use_hierarchy', '%d'<1>): EBUSY (16)

Summary: passed 0 failed 0 broken 1 skipped 0 warnings 0 <<>> initiation_status="ok" duration=1 termination_type=exited termination_id=2 corefile=no cutime=2 cstime=36 <<>> ....... LTP Version: 20220527 INFO: Test end time: Thu Apr 28 18:55:33 UTC 2022

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

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

Here is a message: If the pre-test case “memcg_regression_test.sh” is added to the blacklist,memcontrol01&memcontrol02 will pass.

Can you help me look at this problem.Thanks!!

metan-ucw commented 1 year ago

And does everything work fine if you first run memcontrol01 & memcontrol02 and memcg_regression_test.sh after them?

844688449 commented 1 year ago

first run memcontrol01 & memcontrol02 and memcg_regression_test.sh after them, all test will pass. We find after run memcg_regression_test.sh, execute 'mount -t cgroup -o memory xxx memcg/',and 'echo 1 > memcg/memory.use_hierarchy' will return EBUSY

richiejp commented 1 year ago

It's strange that it mounts V2 then fails to add the V2 memory controller and then mounts the V1 controller.

Do you already have Cgroups mounted somewhere? What is the output for memcg_regression_test.sh?

I suspect that the shell test is not cleaning up properly after mounting V2 or V1 CGroups. However it's unusual that LTP has to mount CGroups, it's only supported because I personally wanted it for test development. To work around it you could mount the CGroup hierarchy your system is actually likely to use. Then LTP will hook into that.

844688449 commented 1 year ago

Do you already have Cgroups mounted somewhere? -> I don't have mount Cgroups, but LTP will mount Cgroup before run memcg_regression_test.sh and memcontrol01 & memcontrol02 .

What is the output for memcg_regression_test.sh? <<>> tag=memcg_regression stime=1668374775 cmdline="memcg_regression_test.sh" contacts="" analysis=exit <<>> memcg_regression_test 1 TPASS : no kernel bug was found memcg_regression_test 2 TPASS : EBUSY was returned as expected memcg_regression_test 3 TPASS : no kernel bug was found ./memcg_test_4.sh: line 41: 17147 Killed swapoff -a ./memcg_test_4.sh: line 42: 17142 Killed ./memcg_test_4 memcg_regression_test 4 TPASS : no kernel bug was found <<>>

I suspect that memcg_regression_test.sh likely to cause the kernel is not cleaning up Cgroup, this case will 'mkdir memcg/0' and 'rmdir /memcg/0'. If don't run this case, memcontrol01&memcontrol02 will pass.

coolgw commented 1 year ago

memcontrol01 case already set .needs_cgroup_ver = TST_CG_V2, but i saw log show tst_cgroup.c:541: TINFO: Mounted V1 memory CGroup on /tmp/cgroup_memory

I suggest use latest LTP to run again.