mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
selftests/verification: Add selftests for deadline and stall monitors
Add selftests to verify deadline monitors don't fail under expected conditions and the stall monitor report violations only when expected. Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20260723074534.43521-18-gmonaco@redhat.com Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
This commit is contained in:
23
tools/testing/selftests/verification/test.d/rv_deadline.tc
Normal file
23
tools/testing/selftests/verification/test.d/rv_deadline.tc
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# description: Test deadline monitors trigger no reaction
|
||||
# requires: available_reactors deadline:monitor printk:reactor stress-ng:program
|
||||
|
||||
load() { # returns true if there was a reaction
|
||||
local lines_before
|
||||
lines_before=$(dmesg | wc -l)
|
||||
stress-ng --cpu 2 --sched deadline --sched-period 100000000 \
|
||||
--sched-deadline 100000000 --sched-runtime 20000000 -t 5 &
|
||||
stress-ng --cpu 2 --sched rr --sched-prio 50 --cyclic 1 \
|
||||
--cyclic-policy rr --cyclic-prio 50 -t 5 &
|
||||
wait
|
||||
dmesg | tail -n +$((lines_before + 1)) | grep -q "rv: monitor [a-z]\+ does not allow event"
|
||||
}
|
||||
|
||||
echo 1 > monitors/deadline/enable
|
||||
echo printk > monitors/deadline/reactors
|
||||
|
||||
! load || false
|
||||
|
||||
echo nop > monitors/deadline/reactors
|
||||
echo 0 > monitors/deadline/enable
|
||||
33
tools/testing/selftests/verification/test.d/rv_stall.tc
Normal file
33
tools/testing/selftests/verification/test.d/rv_stall.tc
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# description: Test stall monitor
|
||||
# requires: available_reactors stall:monitor printk:reactor stress-ng:program
|
||||
|
||||
THRESHOLD=/sys/module/stall/parameters/threshold_jiffies
|
||||
ORIG_THRESHOLD=$(cat $THRESHOLD)
|
||||
trap 'echo $ORIG_THRESHOLD > $THRESHOLD' EXIT
|
||||
|
||||
load() { # returns true if there was a reaction
|
||||
local lines_before cpu
|
||||
cpu=$(($(nproc) - 1))
|
||||
lines_before=$(dmesg | wc -l)
|
||||
stress-ng --cpu 1 --taskset "$cpu" --sched rr --sched-prio 1 -t 3 &
|
||||
stress-ng --cpu 5 --taskset "$cpu" -t 3 &
|
||||
wait
|
||||
dmesg | tail -n +$((lines_before + 1)) | grep -q "rv: monitor stall does not allow event"
|
||||
}
|
||||
|
||||
echo 5000 > $THRESHOLD
|
||||
echo 1 > monitors/stall/enable
|
||||
echo printk > monitors/stall/reactors
|
||||
|
||||
! load || false
|
||||
|
||||
echo 0 > monitors/stall/enable
|
||||
echo 70 > $THRESHOLD
|
||||
echo 1 > monitors/stall/enable
|
||||
|
||||
load
|
||||
|
||||
echo nop > monitors/stall/reactors
|
||||
echo 0 > monitors/stall/enable
|
||||
Reference in New Issue
Block a user