Lines Matching +full:1 +full:- +full:3
2 # SPDX-License-Identifier: GPL-2.0
11 echo "$1"
16 [[ $(id -u) -eq 0 ]] || skip_test "Test must be run as root!"
23 CGROUP2=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
24 [[ -n "$CGROUP2" ]] || skip_test "Cgroup v2 mount point not found!"
26 CPUS=$(lscpu | grep "^CPU(s):" | sed -e "s/.*:[[:space:]]*//")
27 [[ $CPUS -lt 8 ]] && skip_test "Test needs at least 8 cpus available!"
30 PROG=$1
32 DELAY_FACTOR=1
34 while [[ "$1" = -* ]]
36 case "$1" in
37 -v) VERBOSE=1
39 [[ $DELAY_FACTOR -eq 1 ]] &&
43 -d) DELAY_FACTOR=$2
47 *) echo "Usage: $PROG [-v] [-d <delay-factor>"
54 # Set sched verbose flag if available when "-v" option is specified
55 if [[ -n "$VERBOSE" && -d /sys/kernel/debug/sched ]]
64 [[ -d test ]] || mkdir test
70 rmdir A1/A2/A3 A1/A2 A1 B1 > /dev/null 2>&1
72 rmdir test > /dev/null 2>&1
73 [[ -n "$SCHED_DEBUG" ]] &&
80 DELAY=$1
82 while [[ $LOOP -lt $DELAY_FACTOR ]]
92 MSG=$1
101 EXPECTED_VAL=$1
103 [[ $? -eq 0 ]] || exit 1
108 exit 1
114 EXPECTED_VAL=$1
119 exit 1
126 OUTSTR="$1"
128 echo $ERRMSG | grep -q "$OUTSTR"
129 [[ $? -ne 0 ]] && {
132 exit 1
142 echo 2-3 > cpuset.cpus
173 echo 2-3 > cpuset.cpus
175 test_effective_cpus 2-3
189 test_effective_cpus 3
191 echo 2-3 > cpuset.cpus
198 [[ -d A1 ]] && rmdir A1
206 # test -- A1 -- A2 -- A3
207 # \- B1
209 # P<v> = set cpus.partition (0:member, 1:root, 2:isolated, -1:root invalid)
210 # C<l> = add cpu-list
213 # O<c>-<v> = Write <v> to CPU online file of <c>
215 SETUP_A123_PARTITIONS="C1-3:P1:S+ C2-3:P1:S+ C3:P1"
217 # test old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate
218 # ---- ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------
219 " S+ C0-1 . . C2-3 S+ C4-5 . . 0 A2:0-1"
220 " S+ C0-1 . . C2-3 P1 . . . 0 "
221 " S+ C0-1 . . C2-3 P1:S+ C0-1:P1 . . 0 "
222 " S+ C0-1 . . C2-3 P1:S+ C1:P1 . . 0 "
223 " S+ C0-1:S+ . . C2-3 . . . P1 0 "
224 " S+ C0-1:P1 . . C2-3 S+ C1 . . 0 "
225 " S+ C0-1:P1 . . C2-3 S+ C1:P1 . . 0 "
226 " S+ C0-1:P1 . . C2-3 S+ C1:P1 . P1 0 "
227 " S+ C0-1:P1 . . C2-3 C4-5 . . . 0 A1:4-5"
228 " S+ C0-1:P1 . . C2-3 S+:C4-5 . . . 0 A1:4-5"
229 " S+ C0-1 . . C2-3:P1 . . . C2 0 "
230 " S+ C0-1 . . C2-3:P1 . . . C4-5 0 B1:4-5"
231 " S+ C0-3:P1:S+ C2-3:P1 . . . . . . 0 A1:0-1,A2:2-3"
232 " S+ C0-3:P1:S+ C2-3:P1 . . C1-3 . . . 0 A1:1,A2:2-3"
233 " S+ C2-3:P1:S+ C3:P1 . . C3 . . . 0 A1:,A2:3 A1:P1,A2:P1"
234 " S+ C2-3:P1:S+ C3:P1 . . C3 P0 . . 0 A1:3,A2:3 A1:P1,A2:P0"
235 " S+ C2-3:P1:S+ C2:P1 . . C2-4 . . . 0 A1:3-4,A2:2"
236 " S+ C2-3:P1:S+ C3:P1 . . C3 . . C0-2 0 A1:,B1:0-2 A1:P1,A2:P1"
237 …" S+ $SETUP_A123_PARTITIONS . C2-3 . . . 0 A1:,A2:2,A3:3 A1:P1,A2:P1,A3:P…
240 " S+ C0-1 . . C2-3 S+ C4-5 . O2-0 0 A1:0-1,B1:3"
241 " S+ C0-3:P1:S+ C2-3:P1 . . O2-0 . . . 0 A1:0-1,A2:3"
242 " S+ C0-3:P1:S+ C2-3:P1 . . O2-0 O2-1 . . 0 A1:0-1,A2:2-3"
243 " S+ C0-3:P1:S+ C2-3:P1 . . O1-0 . . . 0 A1:0,A2:2-3"
244 " S+ C0-3:P1:S+ C2-3:P1 . . O1-0 O1-1 . . 0 A1:0-1,A2:2-3"
245 " S+ C2-3:P1:S+ C3:P1 . . O3-0 O3-1 . . 0 A1:2,A2:3 A1:P1,A2:P1"
246 " S+ C2-3:P1:S+ C3:P2 . . O3-0 O3-1 . . 0 A1:2,A2:3 A1:P1,A2:P2"
247 " S+ C2-3:P1:S+ C3:P1 . . O2-0 O2-1 . . 0 A1:2,A2:3 A1:P1,A2:P1"
248 " S+ C2-3:P1:S+ C3:P2 . . O2-0 O2-1 . . 0 A1:2,A2:3 A1:P1,A2:P2"
249 " S+ C2-3:P1:S+ C3:P1 . . O2-0 . . . 0 A1:,A2:3 A1:P1,A2:P1"
250 " S+ C2-3:P1:S+ C3:P1 . . O3-0 . . . 0 A1:2,A2: A1:P1,A2:P1"
251 " S+ C2-3:P1:S+ C3:P1 . . T:O2-0 . . . 0 A1:3,A2:3 A1:P1,A2:P-1"
252 " S+ C2-3:P1:S+ C3:P1 . . . T:O3-0 . . 0 A1:2,A2:2 A1:P1,A2:P-1"
253 …" S+ $SETUP_A123_PARTITIONS . O1-0 . . . 0 A1:,A2:2,A3:3 A1:P1,A2:P1,A3:P…
254 …" S+ $SETUP_A123_PARTITIONS . O2-0 . . . 0 A1:1,A2:,A3:3 A1:P1,A2:P1,A3:P…
255 …" S+ $SETUP_A123_PARTITIONS . O3-0 . . . 0 A1:1,A2:2,A3: A1:P1,A2:P1,A3:P…
256 …" S+ $SETUP_A123_PARTITIONS . T:O1-0 . . . 0 A1:2-3,A2:2-3,A3:3 A1:P1,A2:P-…
257 …" S+ $SETUP_A123_PARTITIONS . . T:O2-0 . . 0 A1:1,A2:3,A3:3 A1:P1,A2:P1,A3:…
258 … S+ $SETUP_A123_PARTITIONS . . . T:O3-0 . 0 A1:1,A2:2,A3:2 A1:P1,A2:P1,A3:P-…
259 …" S+ $SETUP_A123_PARTITIONS . T:O1-0 O1-1 . . 0 A1:1,A2:2,A3:3 A1:P1,A2:P1,A3:…
260 …" S+ $SETUP_A123_PARTITIONS . . T:O2-0 O2-1 . 0 A1:1,A2:2,A3:3 A1:P1,A2:P1,A3:…
261 …" S+ $SETUP_A123_PARTITIONS . . . T:O3-0 O3-1 0 A1:1,A2:2,A3:3 A1:P1,A2:P1,A3:…
262 …" S+ $SETUP_A123_PARTITIONS . T:O1-0 O2-0 O1-1 . 0 A1:1,A2:,A3:3 A1:P1,A2:P1,A3:P…
263 …" S+ $SETUP_A123_PARTITIONS . T:O1-0 O2-0 O2-1 . 0 A1:2-3,A2:2-3,A3:3 A1:P1,A2:P-…
265 # test old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate
266 # ---- ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------
272 " S+ C2-3:P1:S+ C3:P1 . . . C2-4 . . 0 A1:,A2:2-3 A1:P1,A2:P1"
276 " S+ C2-3:P1:S+ C3:P1 . . T C2-3 . . 0 A1:2-3,A2:2-3 A1:P1,A2:P-1"
277 " S+ C3:P1:S+ C3 . . T P1 . . 0 A1:3,A2:3 A1:P1,A2:P-1"
278 …" S+ $SETUP_A123_PARTITIONS . T:C2-3 . . . 0 A1:2-3,A2:2-3,A3:3 A1:P1,A2:P-…
279 …" S+ $SETUP_A123_PARTITIONS . T:C2-3:C1-3 . . . 0 A1:1,A2:2,A3:3 A1:P1,A2:P1,A3:…
282 " S+ C2-3:P1:S+ C3:P1 . . P0 . . . 0 A1:2-3,A2:3 A1:P0,A2:P-1"
283 …" S+ $SETUP_A123_PARTITIONS . C2-3 P0 . . 0 A1:2-3,A2:2-3,A3:3 A1:P1,A2:P0…
287 " S+ C2-3:P1:S+ . . . . C3-4:P1 . . 0 A1:2,A2:3 A1:P1,A2:P1"
290 " S+ C0-1:P1:S+ C1 . C2-3 C4-5 . . . 0 A1:4-5,A2:4-5"
294 " S+ C0-1:P1 . . C2-3 S+ C4-5:P1 . . 0 A1:0-1,A2:0-1 A1:P1,A2:P-1"
297 " S+ C0-1:S+ C1 . C2-3 P1 . . . 0 A1:0-1,A2:1 A1:P1"
299 # A partition root with non-partition root parent is invalid, but it
301 " S+ C0-1:S+ C1 . C2-3 . P2 . . 0 A1:0-1,A2:1 A1:P0,A2:P-2"
302 " S+ C0-1:S+ C1:P2 . C2-3 P1 . . . 0 A1:0,A2:1 A1:P1,A2:P2"
304 # A non-exclusive cpuset.cpus change will invalidate partition and its siblings
305 " S+ C0-1:P1 . . C2-3 C0-2 . . . 0 A1:0-2,B1:2-3 A1:P-1,B1:P0"
306 " S+ C0-1:P1 . . P1:C2-3 C0-2 . . . 0 A1:0-2,B1:2-3 A1:P-1,B1:P-1"
307 " S+ C0-1 . . P1:C2-3 C0-2 . . . 0 A1:0-2,B1:2-3 A1:P0,B1:P-1"
309 # test old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate
310 # ---- ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------
314 " S+ C2-3:P1:S+ C3:P1 . . O2-0:T . . . 1 A1:,A2:3 A1:P1,A2:P1"
319 # $1 - <c>-<v> where <c> = cpu number, <v> value to be written
323 CPU=${1%-*}
324 VAL=${1#*-}
326 if [[ $VAL -eq 0 ]]
330 [[ -n "$OFFLINE_CPUS" ]] && {
331 OFFLINE_CPUS=$(echo $CPU $CPU $OFFLINE_CPUS | fmt -1 |\
332 sort | uniq -u)
341 # $1 - cgroup directory
342 # $2 - state
343 # $3 - showerr
350 CGRP=$1
352 SHOWERR=${3}${VERBOSE}
356 [[ -z "$STATE" || "$STATE" = '.' ]] && return 0
358 rm -f $TMPMSG
359 for CMD in $(echo $STATE | sed -e "s/:/ /g")
365 S=$(expr substr $CMD 1 1)
382 1) VAL=root
387 echo "Invalid partition state - $VAL"
388 exit 1
403 [[ $RET -ne 0 ]] && {
404 [[ -n "$SHOWERR" ]] && {
408 HASERR=1
411 rm -f $TMPMSG
418 CGRP=$1
420 [[ -d $CGRP ]] || mkdir $CGRP
421 set_ctrl_state $CGRP $STATE 1
422 [[ $? -ne 0 ]] && {
423 echo "ERROR: Failed to set $2 to cgroup $1!"
424 exit 1
430 [[ -n "OFFLINE_CPUS" ]] && {
433 write_cpu_online ${C}-1
439 # Return 1 if the list of effective cpus isn't the same as the initial list.
445 rmdir A1/A2/A3 A1/A2 A1 B1 > /dev/null 2>&1
446 set_ctrl_state . S-
456 [[ -e $ECPUS ]] && echo "$ECPUS: $(cat $ECPUS)"
457 [[ -e $PRS ]] && echo "$PRS: $(cat $PRS)"
463 # $1 - check string, format: <cgroup>:<cpu-list>[,<cgroup>:<cpu-list>]*
467 CHK_STR=$1
468 for CHK in $(echo $CHK_STR | sed -e "s/,/ /g")
470 set -- $(echo $CHK | sed -e "s/:/ /g")
471 CGRP=$1
476 [[ -e $FILE ]] || return 1
477 [[ $CPUS = $(cat $FILE) ]] || return 1
483 # $1 - check string, format: <cgroup>:<state>[,<cgroup>:<state>]*
487 CHK_STR=$1
488 for CHK in $(echo $CHK_STR | sed -e "s/,/ /g")
490 set -- $(echo $CHK | sed -e "s/:/ /g")
491 CGRP=$1
502 exit 1
510 root) VAL=1
516 VAL=-1
519 VAL=-2
522 [[ $EVAL != $VAL ]] && return 1
529 # $1 - test matrix name
537 TEST=$1
539 CPULIST=0-6
548 while [[ $I -lt $CNT ]]
551 eval set -- "\${$TEST[$I]}"
552 ROOT=$1
554 OLD_A2=$3
576 [[ $RETVAL -ne $RESULT ]] && {
580 exit 1
583 [[ -n "$ECPUS" && "$ECPUS" != . ]] && {
585 [[ $? -ne 0 ]] && {
590 exit 1
594 [[ -n "$STATES" ]] && {
596 [[ $? -ne 0 ]] && {
601 exit 1
613 exit 1
615 [[ -n "$VERBOSE" ]] && echo "Test $I done."
625 # $1: cgroup file to wait for
630 CGROUP_FILE=$1
645 [[ -f $WAIT_INOTIFY ]] || {
651 echo 1 > cpuset.cpus
655 rm -f $PRS
658 set_ctrl_state . "O1-0"
660 check_cgroup_states ".:P-1"
661 if [[ $? -ne 0 ]]
663 echo "FAILED: Inotify test - partition not invalid"
664 ERR=1
665 elif [[ ! -f $PRS ]]
667 echo "FAILED: Inotify test - event not generated"
668 ERR=1
669 kill %1
672 echo "FAILED: Inotify test - incorrect state"
674 ERR=1
679 if [[ $ERR -ne 0 ]]
681 exit 1
687 trap cleanup 0 2 3 6