Skip to content

Commit 1c0be3f

Browse files
Waiman-Longhtejun
authored andcommitted
selftest/cgroup: Update test_cpuset_prs.sh to match changes
Unlike the list of isolated CPUs, it is not easy to programamatically determine what sched domains are being created by the scheduler just by examinng the data in various kernfs filesystems. The easiest way to get this information is by enabling /sys/kernel/debug/sched/verbose file to make those information displayed in the console. This is also what the test_cpuset_prs.sh script is doing when the -v flag is given. It is rather hard to fetch the data from the console and compare it to the expected result. An easier way is to dump the expected sched-domain information out to the console so that they can be visually compared with the actual sched domain data. However, this have to be done manually by visual inspection and so will only be done once in a while. Moreover the preceding cpuset commits also change the cpuset behavior requiring corresponding chanages in some test cases as well as new test cases to test the newly added functionality. Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 737bb14 commit 1c0be3f

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

tools/testing/selftests/cgroup/test_cpuset_prs.sh

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ test_add_proc()
169169
# T = put a task into cgroup
170170
# O<c>=<v> = Write <v> to CPU online file of <c>
171171
#
172+
# ECPUs - effective CPUs of cpusets
173+
# Pstate - partition root state
174+
# ISOLCPUS - isolated CPUs (<icpus>[,<icpus2>])
175+
#
176+
# Note that if there are 2 fields in ISOLCPUS, the first one is for
177+
# sched-debug matching which includes offline CPUs and single-CPU partitions
178+
# while the second one is for matching cpuset.cpus.isolated.
179+
#
172180
SETUP_A123_PARTITIONS="C1-3:P1:S+ C2-3:P1:S+ C3:P1"
173181
TEST_MATRIX=(
174182
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
@@ -228,23 +236,29 @@ TEST_MATRIX=(
228236
" C0-3:S+ C1-3:S+ C2-3 . X2-3 X2-3:P2 . . 0 A1:0-1,A2:2-3,A3:2-3 A1:P0,A2:P2 2-3"
229237
" C0-3:S+ C1-3:S+ C2-3 . X2-3 X3:P2 . . 0 A1:0-2,A2:3,A3:3 A1:P0,A2:P2 3"
230238
" C0-3:S+ C1-3:S+ C2-3 . X2-3 X2-3 X2-3:P2 . 0 A1:0-1,A2:1,A3:2-3 A1:P0,A3:P2 2-3"
231-
" C0-3:S+ C1-3:S+ C2-3 . X2-3 X2-3 X2-3:P2:C3 . 0 A1:0-2,A2:1-2,A3:3 A1:P0,A3:P2 3"
239+
" C0-3:S+ C1-3:S+ C2-3 . X2-3 X2-3 X2-3:P2:C3 . 0 A1:0-1,A2:1,A3:2-3 A1:P0,A3:P2 2-3"
232240
" C0-3:S+ C1-3:S+ C2-3 C2-3 . . . P2 0 A1:0-3,A2:1-3,A3:2-3,B1:2-3 A1:P0,A3:P0,B1:P-2"
233241
" C0-3:S+ C1-3:S+ C2-3 C4-5 . . . P2 0 B1:4-5 B1:P2 4-5"
234242
" C0-3:S+ C1-3:S+ C2-3 C4 X2-3 X2-3 X2-3:P2 P2 0 A3:2-3,B1:4 A3:P2,B1:P2 2-4"
235243
" C0-3:S+ C1-3:S+ C2-3 C4 X2-3 X2-3 X2-3:P2:C1-3 P2 0 A3:2-3,B1:4 A3:P2,B1:P2 2-4"
236244
" C0-3:S+ C1-3:S+ C2-3 C4 X1-3 X1-3:P2 P2 . 0 A2:1,A3:2-3 A2:P2,A3:P2 1-3"
237245
" C0-3:S+ C1-3:S+ C2-3 C4 X2-3 X2-3 X2-3:P2 P2:C4-5 0 A3:2-3,B1:4-5 A3:P2,B1:P2 2-5"
246+
" C4:X0-3:S+ X1-3:S+ X2-3 . . P2 . . 0 A1:4,A2:1-3,A3:1-3 A2:P2 1-3"
247+
" C4:X0-3:S+ X1-3:S+ X2-3 . . . P2 . 0 A1:4,A2:4,A3:2-3 A3:P2 2-3"
238248
239249
# Nested remote/local partition tests
240250
" C0-3:S+ C1-3:S+ C2-3 C4-5 X2-3 X2-3:P1 P2 P1 0 A1:0-1,A2:,A3:2-3,B1:4-5 \
241251
A1:P0,A2:P1,A3:P2,B1:P1 2-3"
242252
" C0-3:S+ C1-3:S+ C2-3 C4 X2-3 X2-3:P1 P2 P1 0 A1:0-1,A2:,A3:2-3,B1:4 \
243253
A1:P0,A2:P1,A3:P2,B1:P1 2-4,2-3"
254+
" C0-3:S+ C1-3:S+ C2-3 C4 X2-3 X2-3:P1 . P1 0 A1:0-1,A2:2-3,A3:2-3,B1:4 \
255+
A1:P0,A2:P1,A3:P0,B1:P1"
244256
" C0-3:S+ C1-3:S+ C3 C4 X2-3 X2-3:P1 P2 P1 0 A1:0-1,A2:2,A3:3,B1:4 \
245257
A1:P0,A2:P1,A3:P2,B1:P1 2-4,3"
246258
" C0-4:S+ C1-4:S+ C2-4 . X2-4 X2-4:P2 X4:P1 . 0 A1:0-1,A2:2-3,A3:4 \
247259
A1:P0,A2:P2,A3:P1 2-4,2-3"
260+
" C0-4:S+ C1-4:S+ C2-4 . X2-4 X2-4:P2 X3-4:P1 . 0 A1:0-1,A2:2,A3:3-4 \
261+
A1:P0,A2:P2,A3:P1 2"
248262
" C0-4:X2-4:S+ C1-4:X2-4:S+:P2 C2-4:X4:P1 \
249263
. . X5 . . 0 A1:0-4,A2:1-4,A3:2-4 \
250264
A1:P0,A2:P-2,A3:P-1"
@@ -270,8 +284,8 @@ TEST_MATRIX=(
270284
. . X2-3 P2 . . 0 A1:0-2,A2:3,XA2:3 A2:P2 3"
271285
272286
# Invalid to valid local partition direct transition tests
273-
" C1-3:S+:P2 C2-3:X1:P2 . . . . . . 0 A1:1-3,XA1:1-3,A2:2-3:XA2: A1:P2,A2:P-2 1-3"
274-
" C1-3:S+:P2 C2-3:X1:P2 . . . X3:P2 . . 0 A1:1-2,XA1:1-3,A2:3:XA2:3 A1:P2,A2:P2 1-3"
287+
" C1-3:S+:P2 X4:P2 . . . . . . 0 A1:1-3,XA1:1-3,A2:1-3:XA2: A1:P2,A2:P-2 1-3"
288+
" 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"
275289
" C0-3:P2 . . C4-6 C0-4 . . . 0 A1:0-4,B1:4-6 A1:P-2,B1:P0"
276290
" C0-3:P2 . . C4-6 C0-4:C0-3 . . . 0 A1:0-3,B1:4-6 A1:P2,B1:P0 0-3"
277291
" C0-3:P2 . . C3-5:C4-5 . . . . 0 A1:0-3,B1:4-5 A1:P2,B1:P0 0-3"
@@ -282,32 +296,26 @@ TEST_MATRIX=(
282296
" C0-3:X1-3:S+:P2 C1-3:X2-3:S+:P2 C2-3:X3:P2 \
283297
. . X4 . . 0 A1:1-3,A2:1-3,A3:2-3,XA2:,XA3: A1:P2,A2:P-2,A3:P-2 1-3"
284298
" C0-3:X1-3:S+:P2 C1-3:X2-3:S+:P2 C2-3:X3:P2 \
285-
. . C4 . . 0 A1:1-3,A2:1-3,A3:2-3,XA2:,XA3: A1:P2,A2:P-2,A3:P-2 1-3"
299+
. . C4:X . . 0 A1:1-3,A2:1-3,A3:2-3,XA2:,XA3: A1:P2,A2:P-2,A3:P-2 1-3"
286300
# Local partition CPU change tests
287301
" C0-5:S+:P2 C4-5:S+:P1 . . . C3-5 . . 0 A1:0-2,A2:3-5 A1:P2,A2:P1 0-2"
288302
" C0-5:S+:P2 C4-5:S+:P1 . . C1-5 . . . 0 A1:1-3,A2:4-5 A1:P2,A2:P1 1-3"
289303
290304
# cpus_allowed/exclusive_cpus update tests
291305
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3 \
292-
. C4 . P2 . 0 A1:4,A2:4,XA2:,XA3:,A3:4 \
306+
. X:C4 . P2 . 0 A1:4,A2:4,XA2:,XA3:,A3:4 \
293307
A1:P0,A3:P-2"
294308
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3 \
295309
. X1 . P2 . 0 A1:0-3,A2:1-3,XA1:1,XA2:,XA3:,A3:2-3 \
296310
A1:P0,A3:P-2"
297-
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3 \
298-
. . C3 P2 . 0 A1:0-2,A2:0-2,XA2:3,XA3:3,A3:3 \
299-
A1:P0,A3:P2 3"
300311
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3 \
301312
. . X3 P2 . 0 A1:0-2,A2:1-2,XA2:3,XA3:3,A3:3 \
302313
A1:P0,A3:P2 3"
303314
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3:P2 \
304315
. . X3 . . 0 A1:0-3,A2:1-3,XA2:3,XA3:3,A3:2-3 \
305316
A1:P0,A3:P-2"
306317
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3:P2 \
307-
. . C3 . . 0 A1:0-3,A2:3,XA2:3,XA3:3,A3:3 \
308-
A1:P0,A3:P-2"
309-
" C0-3:X2-3:S+ C1-3:X2-3:S+ C2-3:X2-3:P2 \
310-
. C4 . . . 0 A1:4,A2:4,A3:4,XA1:,XA2:,XA3 \
318+
. X4 . . . 0 A1:0-3,A2:1-3,A3:2-3,XA1:4,XA2:,XA3 \
311319
A1:P0,A3:P-2"
312320
313321
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
@@ -354,6 +362,9 @@ TEST_MATRIX=(
354362
" C0-1:P1 . . P1:C2-3 C0-2 . . . 0 A1:0-2,B1:2-3 A1:P-1,B1:P-1"
355363
" C0-1 . . P1:C2-3 C0-2 . . . 0 A1:0-2,B1:2-3 A1:P0,B1:P-1"
356364
365+
# cpuset.cpus can overlap with sibling cpuset.cpus.exclusive but not subsumed by it
366+
" C0-3 . . C4-5 X5 . . . 0 A1:0-3,B1:4-5"
367+
357368
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
358369
# ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
359370
# Failure cases:
@@ -363,6 +374,9 @@ TEST_MATRIX=(
363374
364375
# Changes to cpuset.cpus.exclusive that violate exclusivity rule is rejected
365376
" C0-3 . . C4-5 X0-3 . . X3-5 1 A1:0-3,B1:4-5"
377+
378+
# cpuset.cpus cannot be a subset of sibling cpuset.cpus.exclusive
379+
" C0-3 . . C4-5 X3-5 . . . 1 A1:0-3,B1:4-5"
366380
)
367381
368382
#
@@ -564,14 +578,15 @@ check_cgroup_states()
564578
do
565579
set -- $(echo $CHK | sed -e "s/:/ /g")
566580
CGRP=$1
581+
CGRP_DIR=$CGRP
567582
STATE=$2
568583
FILE=
569584
EVAL=$(expr substr $STATE 2 2)
570-
[[ $CGRP = A2 ]] && CGRP=A1/A2
571-
[[ $CGRP = A3 ]] && CGRP=A1/A2/A3
585+
[[ $CGRP = A2 ]] && CGRP_DIR=A1/A2
586+
[[ $CGRP = A3 ]] && CGRP_DIR=A1/A2/A3
572587
573588
case $STATE in
574-
P*) FILE=$CGRP/cpuset.cpus.partition
589+
P*) FILE=$CGRP_DIR/cpuset.cpus.partition
575590
;;
576591
*) echo "Unknown state: $STATE!"
577592
exit 1
@@ -595,6 +610,16 @@ check_cgroup_states()
595610
;;
596611
esac
597612
[[ $EVAL != $VAL ]] && return 1
613+
614+
#
615+
# For root partition, dump sched-domains info to console if
616+
# verbose mode set for manual comparison with sched debug info.
617+
#
618+
[[ $VAL -eq 1 && $VERBOSE -gt 0 ]] && {
619+
DOMS=$(cat $CGRP_DIR/cpuset.cpus.effective)
620+
[[ -n "$DOMS" ]] &&
621+
echo " [$CGRP] sched-domain: $DOMS" > $CONSOLE
622+
}
598623
done
599624
return 0
600625
}

0 commit comments

Comments
 (0)