When a boot time nohz_full CPUs are present and they cover CPUs 0-7, some of the test cases may fail. So the test run will be skipped with a warning message in this case. On the other hand, if the boot time nohz_full CPUs cover all the CPUs except 0-7, a special set of nohz_full specific housekeeping check related tests could be run to make sure the housekeeping check are behaving properly. The test_cpuset_prs.sh test script is now updated to do exactly that.
Signed-off-by: Waiman Long <[email protected]> --- .../selftests/cgroup/test_cpuset_prs.sh | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh index 5aac0df86593..ea0ebbdf4bb3 100755 --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh @@ -84,6 +84,29 @@ echo member > test/cpuset.cpus.partition echo "" > test/cpuset.cpus [[ $RESULT -eq 0 ]] && skip_test "Child cgroups are using cpuset!" +# +# If nohz_full CPUs have been reserved at boot time, they should not include +# CPUs 0-7 as that may fail some of the test cases. On the other hand if the +# set of nohz_full CPUs includes all the CPUs except 0-7, we can run a special +# set of housekeeping CPUs exhaustion tests to see if the cpuset code will +# reject them. +# +NOHZ_FULL_CPUS=$(cat /sys/devices/system/cpu/nohz_full) +FIRST_NOHZ_FULL_CPU= +LAST_NOHZ_FULL_CPU= +RUN_NOHZ_FULL_TESTS= +LAST_PRESENT_CPU=$(cat /sys/devices/system/cpu/present | sed -e "s/.*[,-]//") +[[ -n "$NOHZ_FULL_CPUS" ]] && { + FIRST_NOHZ_FULL_CPU=$(echo $NOHZ_FULL_CPUS | sed -e "s/[,-].*//") + LAST_NOHZ_FULL_CPU=$(echo $NOHZ_FULL_CPUS | sed -e "s/.*[,-]//") + echo "Boot nohz_full CPUs: $NOHZ_FULL_CPUS" +} +[[ -n "$FIRST_NOHZ_FULL_CPU" && "$FIRST_NOHZ_FULL_CPU" -le 7 ]] && + skip_test "Boot NOHZ_FULL CPUs overlap CPUs to be tested!" + +[[ -n "$FIRST_NOHZ_FULL_CPU" && "$FIRST_NOHZ_FULL_CPU" = 8 && + "$LAST_NOHZ_FULL_CPU" = $LAST_PRESENT_CPU ]] && RUN_NOHZ_FULL_TESTS=1 + # # If isolated CPUs have been reserved at boot time (as shown in # /sys/devices/system/cpu/isolated), these isolated CPUs should be outside of @@ -497,6 +520,16 @@ ISOLCPUS_TEST_MATRIX=( " CX1-2,I:X1,I:P1 . . . X1,2,I . . . 0 A1:1-2,I|XA1:1-2,I A1:P-1 ." ) +# Test matrix to be run when boot time nohz_full CPUs cover all CPUs except CPUs 0-7 +NOHZ_FULL_TEST_MATRIX=( + # old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS + # ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ -------- + # Using all the nohz_full HK CPUs 0-7 in isolated partition is not allowed + " C0-7 . . . P2 . . . 0 A1:0-7 A1:P-2 ." + " C1-7:P2 C5-7:P2 . . . . . C0:P2 0 A1:1-4|A2:5-7|B1:0 + A1:P2|A2:P2|B1:P-2 1-7" +) + # # Cpuset controller remote partition test matrix. # @@ -1362,6 +1395,7 @@ trap cleanup 0 2 3 6 run_state_test TEST_MATRIX run_remote_state_test REMOTE_TEST_MATRIX TEST_ISOLCPUS=1 run_state_test ISOLCPUS_TEST_MATRIX +[[ -n "$RUN_NOHZ_FULL_TESTS" ]] && run_state_test NOHZ_FULL_TEST_MATRIX test_isolated test_boot_isolated test_inotify -- 2.55.0

