@@ -112,6 +112,8 @@ cleanup()
112112 online_cpus
113113 cd $CGROUP2
114114 rmdir A1/A2/A3 A1/A2 A1 B1 test/A1 test/B1 test > /dev/null 2>&1
115+ rmdir rtest/p1/c11 rtest/p1/c12 rtest/p2/c21 \
116+ rtest/p2/c22 rtest/p1 rtest/p2 rtest > /dev/null 2>&1
115117 [[ -n " $SCHED_DEBUG " ]] &&
116118 echo " $SCHED_DEBUG " > /sys/kernel/debug/sched/verbose
117119}
@@ -223,9 +225,9 @@ TEST_MATRIX=(
223225 " C0 -1 :P1 . . C2 -3 S+:C4 -5 . . . 0 A1 :4 -5 "
224226 " C0 -1 . . C2 -3 :P1 . . . C2 0 "
225227 " C0 -1 . . C2 -3 :P1 . . . C4 -5 0 B1 :4 -5 "
226- "C0 -3 :P1 :S+ C2 -3 :P1 . . . . . . 0 A1 :0 -1 |A2 :2 -3 "
227- "C0 -3 :P1 :S+ C2 -3 :P1 . . C1 -3 . . . 0 A1 :1 |A2 :2 -3 "
228- "C2 -3 :P1 :S+ C3 :P1 . . C3 . . . 0 A1 :|A2 :3 A1 :P1 |A2 :P1 "
228+ "C0 -3 :P1 :S+ C2 -3 :P1 . . . . . . 0 A1 :0 -1 |A2 :2 -3 |XA 2 : 2 - 3 "
229+ "C0 -3 :P1 :S+ C2 -3 :P1 . . C1 -3 . . . 0 A1 :1 |A2 :2 -3 |XA 2 : 2 - 3 "
230+ "C2 -3 :P1 :S+ C3 :P1 . . C3 . . . 0 A1 :|A2 :3 |XA 2 : 3 A1 :P1 |A2 :P1 "
229231 "C2 -3 :P1 :S+ C3 :P1 . . C3 P0 . . 0 A1 :3 |A2 :3 A1 :P1 |A2 :P0 "
230232 "C2 -3 :P1 :S+ C2 :P1 . . C2 -4 . . . 0 A1 :3 -4 |A2 :2 "
231233 "C2 -3 :P1 :S+ C3 :P1 . . C3 . . C0 -2 0 A1 :|B1 :0 -2 A1 :P1 |A2 :P1 "
@@ -291,7 +293,7 @@ TEST_MATRIX=(
291293 A1 :P0 |A2 :P2 |A3 :P1 2 "
292294 " C0 -4 :X2 -4 :S+ C1 -4 :X2 -4 :S+:P2 C2 -4 :X4 :P1 \
293295 . . X5 . . 0 A1 :0 -4 |A2 :1 -4 |A3 :2 -4 \
294- A1 :P0 |A2 :P-2 |A3 :P-1 "
296+ A1 :P0 |A2 :P-2 |A3 :P-1 . "
295297 " C0 -4 :X2 -4 :S+ C1 -4 :X2 -4 :S+:P2 C2 -4 :X4 :P1 \
296298 . . . X1 . 0 A1 :0 -1 |A2 :2 -4 |A3 :2 -4 \
297299 A1 :P0 |A2 :P2 |A3 :P-1 2 -4 "
@@ -303,13 +305,13 @@ TEST_MATRIX=(
303305 " C0 -3 :S+ C1 -3 :S+ C3 . X2 -3 X2 -3 T:P2 :O3 =0 . 0 A1 :0 -2 |A2 :1 -2 |A3 :1 -2 A1 :P0 |A3 :P-2 3 |"
304306
305307 # An invalidated remote partition cannot self-recover from hotplug
306- " C0 -3 :S+ C1 -3 :S+ C2 . X2 -3 X2 -3 T:P2 :O2 =0 O2 =1 0 A1 :0 -3 |A2 :1 -3 |A3 :2 A1 :P0 |A3 :P-2 "
308+ " C0 -3 :S+ C1 -3 :S+ C2 . X2 -3 X2 -3 T:P2 :O2 =0 O2 =1 0 A1 :0 -3 |A2 :1 -3 |A3 :2 A1 :P0 |A3 :P-2 . "
307309
308310 # cpus.exclusive.effective clearing test
309311 " C0 -3 :S+ C1 -3 :S+ C2 . X2 -3 :X . . . 0 A1 :0 -3 |A2 :1 -3 |A3 :2 |XA1 :"
310312
311313 # Invalid to valid remote partition transition test
312- " C0 -3 :S+ C1 -3 . . . X3 :P2 . . 0 A1 :0 -3 |A2 :1 -3 |XA2 : A2 :P-2 "
314+ " C0 -3 :S+ C1 -3 . . . X3 :P2 . . 0 A1 :0 -3 |A2 :1 -3 |XA2 : A2 :P-2 . "
313315 " C0 -3 :S+ C1 -3 :X3 :P2
314316 . . X2 -3 P2 . . 0 A1 :0 -2 |A2 :3 |XA2 :3 A2 :P2 3 "
315317
@@ -318,7 +320,6 @@ TEST_MATRIX=(
318320 " C1 -3 :S+:P2 X4 :P2 . . . X3 :P2 . . 0 A1 :1 -2 |XA1 :1 -3 |A2 :3 :XA2 :3 A1 :P2 |A2 :P2 1 -3 "
319321 " C0 -3 :P2 . . C4 -6 C0 -4 . . . 0 A1 :0 -4 |B1 :4 -6 A1 :P-2 |B1 :P0 "
320322 " C0 -3 :P2 . . C4 -6 C0 -4 :C0 -3 . . . 0 A1 :0 -3 |B1 :4 -6 A1 :P2 |B1 :P0 0 -3 "
321- " C0 -3 :P2 . . C3 -5 :C4 -5 . . . . 0 A1 :0 -3 |B1 :4 -5 A1 :P2 |B1 :P0 0 -3 "
322323
323324 # Local partition invalidation tests
324325 " C0 -3 :X1 -3 :S+:P2 C1 -3 :X2 -3 :S+:P2 C2 -3 :X3 :P2 \
@@ -334,10 +335,10 @@ TEST_MATRIX=(
334335 # cpus_allowed/exclusive_cpus update tests
335336 " C0 -3 :X2 -3 :S+ C1 -3 :X2 -3 :S+ C2 -3 :X2 -3 \
336337 . X:C4 . P2 . 0 A1 :4 |A2 :4 |XA2 :|XA3 :|A3 :4 \
337- A1 :P0 |A3 :P-2 "
338+ A1 :P0 |A3 :P-2 . "
338339 " C0 -3 :X2 -3 :S+ C1 -3 :X2 -3 :S+ C2 -3 :X2 -3 \
339340 . X1 . P2 . 0 A1 :0 -3 |A2 :1 -3 |XA1 :1 |XA2 :|XA3 :|A3 :2 -3 \
340- A1 :P0 |A3 :P-2 "
341+ A1 :P0 |A3 :P-2 . "
341342 " C0 -3 :X2 -3 :S+ C1 -3 :X2 -3 :S+ C2 -3 :X2 -3 \
342343 . . X3 P2 . 0 A1 :0 -2 |A2 :1 -2 |XA2 :3 |XA3 :3 |A3 :3 \
343344 A1 :P0 |A3 :P2 3 "
@@ -385,7 +386,7 @@ TEST_MATRIX=(
385386 # A partition root with non-partition root parent is invalid| but it
386387 # can be made valid if its parent becomes a partition root too.
387388 " C0 -1 :S+ C1 . C2 -3 . P2 . . 0 A1 :0 -1 |A2 :1 A1 :P0 |A2 :P-2 "
388- " C0 -1 :S+ C1 :P2 . C2 -3 P1 . . . 0 A1 :0 |A2 :1 A1 :P1 |A2 :P2 "
389+ " C0 -1 :S+ C1 :P2 . C2 -3 P1 . . . 0 A1 :0 |A2 :1 A1 :P1 |A2 :P2 0 - 1 | 1 "
389390
390391 # A non-exclusive cpuset.cpus change will invalidate partition and its siblings
391392 " C0 -1 :P1 . . C2 -3 C0 -2 . . . 0 A1 :0 -2 |B1 :2 -3 A1 :P-1 |B1 :P0 "
@@ -405,6 +406,17 @@ TEST_MATRIX=(
405406 # affect cpuset.cpus.exclusive.effective.
406407 " C1 -4 :X3 :S+ C1 :X3 . . . C . . 0 A2 :1 -4 |XA2 :3 "
407408
409+ # cpuset.cpus can contain CPUs that overlap a sibling cpuset with cpus.exclusive
410+ # but creating a local partition out of it is not allowed. Similarly and change
411+ # in cpuset.cpus of a local partition that overlaps sibling exclusive CPUs will
412+ # invalidate it.
413+ " CX1 -4 :S+ CX2 -4 :P2 . C5 -6 . . . P1 0 A1 :1 |A2 :2 -4 |B1 :5 -6 |XB1 :5 -6 \
414+ A1 :P0 |A2 :P2 :B1 :P1 2 -4 "
415+ " CX1 -4 :S+ CX2 -4 :P2 . C3 -6 . . . P1 0 A1 :1 |A2 :2 -4 |B1 :5 -6 \
416+ A1 :P0 |A2 :P2 :B1 :P-1 2 -4 "
417+ " CX1 -4 :S+ CX2 -4 :P2 . C5 -6 . . . P1 :C3 -6 0 A1 :1 |A2 :2 -4 |B1 :5 -6 \
418+ A1 :P0 |A2 :P2 :B1 :P-1 2 -4 "
419+
408420 # old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
409421 # ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
410422 # Failure cases:
@@ -419,6 +431,54 @@ TEST_MATRIX=(
419431 " C0 -3 . . C4 -5 X3 -5 . . . 1 A1 :0 -3 |B1 :4 -5 "
420432)
421433
434+ #
435+ # Cpuset controller remote partition test matrix.
436+ #
437+ # Cgroup test hierarchy
438+ #
439+ # root
440+ # |
441+ # rtest (cpuset.cpus.exclusive=1 -7 )
442+ # |
443+ # +------+------+
444+ # | |
445+ # p1 p2
446+ # +--+--+ +--+--+
447+ # | | | |
448+ # c11 c12 c21 c22
449+ #
450+ # REMOTE_TEST_MATRIX uses the same notational convention as TEST_MATRIX.
451+ # Only CPUs 1 -7 should be used.
452+ #
453+ REMOTE_TEST_MATRIX=(
454+ # old-p1 old-p2 old-c11 old-c12 old-c21 old-c22
455+ # new-p1 new-p2 new-c11 new-c12 new-c21 new-c22 ECPUs Pstate ISOLCPUS
456+ # ------ ------ ------- ------- ------- ------- ----- ------ --------
457+ " X1 -3 :S+ X4 -6 :S+ X1 -2 X3 X4 -5 X6 \
458+ . . P2 P2 P2 P2 c11 :1 -2 |c12 :3 |c21 :4 -5 |c22 :6 \
459+ c11 :P2 |c12 :P2 |c21 :P2 |c22 :P2 1 -6 "
460+ " CX1 -4 :S+ . X1 -2 :P2 C3 . . \
461+ . . . C3 -4 . . p1 :3 -4 |c11 :1 -2 |c12 :3 -4 \
462+ p1 :P0 |c11 :P2 |c12 :P0 1 -2 "
463+ " CX1 -4 :S+ . X1 -2 :P2 . . . \
464+ X2 -4 . . . . . p1 :1 ,3 -4 |c11 :2 \
465+ p1 :P0 |c11 :P2 2 "
466+ " CX1 -5 :S+ . X1 -2 :P2 X3 -5 :P1 . . \
467+ X2 -4 . . . . . p1 :1 ,5 |c11 :2 |c12 :3 -4 \
468+ p1 :P0 |c11 :P2 |c12 :P1 2 "
469+ " CX1 -4 :S+ . X1 -2 :P2 X3 -4 :P1 . . \
470+ . . X2 . . . p1 :1 |c11 :2 |c12 :3 -4 \
471+ p1 :P0 |c11 :P2 |c12 :P1 2 "
472+ # p1 as member, will get its effective CPUs from its parent rtest
473+ " CX1 -4 :S+ . X1 -2 :P2 X3 -4 :P1 . . \
474+ . . X1 CX2 -4 . . p1 :5 -7 |c11 :1 |c12 :2 -4 \
475+ p1 :P0 |c11 :P2 |c12 :P1 1 "
476+ " CX1 -4 :S+ X5 -6 :P1 :S+ . . . . \
477+ . . X1 -2 :P2 X4 -5 :P1 . X1 -7 :P2 p1 :3 |c11 :1 -2 |c12 :4 :c22 :5 -6 \
478+ p1 :P0 |p2 :P1 |c11 :P2 |c12 :P1 |c22 :P2 \
479+ 1 -2 ,4 -6 |1 -2 ,5 -6 "
480+ )
481+
422482#
423483# Write to the cpu online file
424484# $1 - <c>=<v> where <c> = cpu number, <v> value to be written
@@ -902,10 +962,11 @@ run_state_test()
902962 STATES=${11}
903963 ICPUS=${12}
904964
905- set_ctrl_state_noerr B1 $OLD_B1
906965 set_ctrl_state_noerr A1 $OLD_A1
907966 set_ctrl_state_noerr A1/A2 $OLD_A2
908967 set_ctrl_state_noerr A1/A2/A3 $OLD_A3
968+ set_ctrl_state_noerr B1 $OLD_B1
969+
909970 RETVAL=0
910971 set_ctrl_state A1 $NEW_A1 ; (( RETVAL += $? ))
911972 set_ctrl_state A1/A2 $NEW_A2 ; (( RETVAL += $? ))
@@ -920,6 +981,76 @@ run_state_test()
920981 echo " All $I tests of $TEST PASSED."
921982}
922983
984+ #
985+ # Run cpuset remote partition state transition test
986+ # $1 - test matrix name
987+ #
988+ run_remote_state_test ()
989+ {
990+ TEST=$1
991+ CONTROLLER=cpuset
992+ [[ -d rtest ]] || mkdir rtest
993+ cd rtest
994+ echo +cpuset > cgroup.subtree_control
995+ echo " 1-7" > cpuset.cpus
996+ echo " 1-7" > cpuset.cpus.exclusive
997+ CGROUP_LIST=" .. . p1 p2 p1/c11 p1/c12 p2/c21 p2/c22"
998+ RESET_LIST=" p1/c11 p1/c12 p2/c21 p2/c22 p1 p2"
999+ I=0
1000+ eval CNT=" \$ {#$TEST [@]}"
1001+
1002+ reset_cgroup_states
1003+ console_msg " Running remote partition state transition test ..."
1004+
1005+ while [[ $I -lt $CNT ]]
1006+ do
1007+ echo " Running test $I ..." > $CONSOLE
1008+ [[ $VERBOSE -gt 1 ]] && {
1009+ echo " "
1010+ eval echo \$ {$TEST [$I ]}
1011+ }
1012+ eval set -- " \$ {$TEST [$I ]}"
1013+ OLD_p1=$1
1014+ OLD_p2=$2
1015+ OLD_c11=$3
1016+ OLD_c12=$4
1017+ OLD_c21=$5
1018+ OLD_c22=$6
1019+ NEW_p1=$7
1020+ NEW_p2=$8
1021+ NEW_c11=$9
1022+ NEW_c12=${10}
1023+ NEW_c21=${11}
1024+ NEW_c22=${12}
1025+ ECPUS=${13}
1026+ STATES=${14}
1027+ ICPUS=${15}
1028+
1029+ set_ctrl_state_noerr p1 $OLD_p1
1030+ set_ctrl_state_noerr p2 $OLD_p2
1031+ set_ctrl_state_noerr p1/c11 $OLD_c11
1032+ set_ctrl_state_noerr p1/c12 $OLD_c12
1033+ set_ctrl_state_noerr p2/c21 $OLD_c21
1034+ set_ctrl_state_noerr p2/c22 $OLD_c22
1035+
1036+ RETVAL=0
1037+ set_ctrl_state p1 $NEW_p1 ; (( RETVAL += $? ))
1038+ set_ctrl_state p2 $NEW_p2 ; (( RETVAL += $? ))
1039+ set_ctrl_state p1/c11 $NEW_c11 ; (( RETVAL += $? ))
1040+ set_ctrl_state p1/c12 $NEW_c12 ; (( RETVAL += $? ))
1041+ set_ctrl_state p2/c21 $NEW_c21 ; (( RETVAL += $? ))
1042+ set_ctrl_state p2/c22 $NEW_c22 ; (( RETVAL += $? ))
1043+
1044+ [[ $RETVAL -ne 0 ]] && test_fail $I result
1045+
1046+ check_test_results $I " $ECPUS " " $STATES " " $ICPUS "
1047+ (( I++ ))
1048+ done
1049+ cd ..
1050+ rmdir rtest
1051+ echo " All $I tests of $TEST PASSED."
1052+ }
1053+
9231054#
9241055# Testing the new "isolated" partition root type
9251056#
@@ -1056,6 +1187,7 @@ test_inotify()
10561187
10571188trap cleanup 0 2 3 6
10581189run_state_test TEST_MATRIX
1190+ run_remote_state_test REMOTE_TEST_MATRIX
10591191test_isolated
10601192test_inotify
10611193echo " All tests PASSED."
0 commit comments