Skip to content

Commit 2149af8

Browse files
committed
e2e: test configuring scheduling in balloons
Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
1 parent 8c2a56f commit 2149af8

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

test/e2e/policies.test-suite/balloons/n4c16/test17-cstates/balloons-cstates.cfg renamed to test/e2e/policies.test-suite/balloons/n4c16/test17-cstates-scheduling/balloons-cstates.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config:
1414
balloonTypes:
1515
- name: lowlatency-bln
1616
cpuClass: lowlatency-class
17+
schedulingClass: realtime
1718

1819
control:
1920
cpu:
@@ -22,9 +23,22 @@ config:
2223
disabledCstates: [C4, C6, C8, C10]
2324
default-class:
2425
disabledCstates: []
26+
27+
schedulingClasses:
28+
- name: realtime
29+
policy: fifo # SCHED_FIFO
30+
priority: 42
31+
32+
- name: run-when-free
33+
policy: idle
34+
nice: 17
35+
ioClass: be
36+
ioPriority: 6
37+
2538
log:
2639
debug:
2740
- policy
41+
- nri-plugin
2842
- cpu
2943
extraEnv:
3044
OVERRIDE_SYS_CSTATES: '''[{"cpus": "0-15", "names": ["C1E", "C2", "C4", "C8"], "files": {"disable": "0"}}]'''

test/e2e/policies.test-suite/balloons/n4c16/test17-cstates/code.var.sh renamed to test/e2e/policies.test-suite/balloons/n4c16/test17-cstates-scheduling/code.var.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ verify-cstates() {
3535
done
3636
}
3737

38+
verify-sched() {
39+
local podXcY=$1
40+
vm-command "cat /proc/\$(pgrep -f $podXcY)/sched" || command-error "cannot get /proc/PID/sched for $podXcY"
41+
42+
if [ "$expected_policy" != "" ]; then
43+
echo "verify scheduling policy of $podXcY is $expected_policy"
44+
grep -q -E "policy .* $expected_policy" <<< $COMMAND_OUTPUT ||
45+
error "expected policy $expected_policy not found"
46+
47+
fi
48+
49+
if [ "$expected_prio" != "" ]; then
50+
echo "verify scheduling priority of $podXcY is $expected_prio"
51+
grep -q -E "prio .* $expected_prio" <<< $COMMAND_OUTPUT ||
52+
error "expected priority $expected_prio not found"
53+
fi
54+
}
55+
3856
# verify-cstates-no-writes checks that any c-states of given CPUs have not been written
3957
verify-cstates-no-writes() {
4058
local cpu_ids=$1 # e.g. "1 2 4"
@@ -52,7 +70,7 @@ cleanup() {
5270
}
5371

5472
echo "verify that all c-states of all available CPUs are enabled"
55-
verify-cstates "2 3 4 5 6 7 11 12 13" "C1E C2 C4 C8" "" 36
73+
verify-cstates "2 3 4 5 6 7 11 12 13" "C1E C2 C4 C8" "" 40
5674

5775
echo "verify that c-states of CPUs outside AvailableResources have not been written"
5876
verify-cstates-no-writes "0 1 8 9 14 15"
@@ -63,15 +81,27 @@ report allowed
6381
verify 'len(cpus["pod0c0"]) == 1'
6482
echo "verify that CPUs of low-latency pod0 cannot enter C4 or C8"
6583
verify-cstates "$(cpuids-of pod0c0)" "C1E C2" "C4 C8" 4
84+
expected_policy=1 expected_prio=$((99 - 42)) verify-sched pod0c0 # expect SCHED_FIFO, prio 56
6685

6786
CPUREQ="3" MEMREQ="100M" CPULIM="" MEMLIM=""
68-
POD_ANNOTATION="balloon.balloons.resource-policy.nri.io: lowlatency-bln" CONTCOUNT=1 create balloons-busybox
87+
POD_ANNOTATION=(
88+
"balloon.balloons.resource-policy.nri.io: lowlatency-bln"
89+
"scheduling-class.resource-policy.nri.io: run-when-free"
90+
)
91+
CONTCOUNT=1 create balloons-busybox
6992
report allowed
7093
verify 'cpus["pod0c0"] == cpus["pod1c0"]' \
7194
'len(cpus["pod0c0"]) == 4'
7295
echo "verify that CPUs of low-latency pods pod0 and pod1 cannot enter C4 or C8"
7396
verify-cstates "$(cpuids-of pod1c0)" "C1E C2" "C4 C8" 16
7497

98+
expected_policy=5 expected_prio=$((120 + 17)) verify-sched pod1c0 # expect SCHED_IDLE, prio 137
99+
vm-command "ionice -p \$(pgrep -f pod1c0)" ||
100+
command-error "cannot get ionice for pod1c0"
101+
expected_ionice="best-effort: prio 6"
102+
[[ "$COMMAND_OUTPUT" == "$expected_ionice" ]] ||
103+
command-error "expected ionice output '$expected_ionice'"
104+
75105
# store CPU ids of maximal cpuset before deleting pods
76106
max_lowlatency_cpus="$(echo $(cpuids-of pod1c0) )"
77107

0 commit comments

Comments
 (0)