Skip to content

Commit 57c4cfd

Browse files
alan-maguireshuahkh
authored andcommitted
ftrace/selftests: workaround cgroup RT scheduling issues
wakeup_rt.tc and wakeup.tc tests in tracers/ subdirectory fail due to the chrt command returning: chrt: failed to set pid 0's policy: Operation not permitted. To work around this, temporarily disable grout RT scheduling during ftracetest execution. Restore original value on test run completion. With these changes in place, both tests consistently pass. Fixes: c575dea ("selftests/ftrace: Add wakeup_rt tracer testcase") Fixes: c1edd06 ("selftests/ftrace: Add wakeup tracer testcase") Signed-off-by: Alan Maguire <[email protected]> Acked-by: Steven Rostedt (VMware) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent f0c0d0c commit 57c4cfd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tools/testing/selftests/ftrace/ftracetest

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,25 @@ err_ret=1
2929
# kselftest skip code is 4
3030
err_skip=4
3131

32+
# cgroup RT scheduling prevents chrt commands from succeeding, which
33+
# induces failures in test wakeup tests. Disable for the duration of
34+
# the tests.
35+
36+
readonly sched_rt_runtime=/proc/sys/kernel/sched_rt_runtime_us
37+
38+
sched_rt_runtime_orig=$(cat $sched_rt_runtime)
39+
40+
setup() {
41+
echo -1 > $sched_rt_runtime
42+
}
43+
44+
cleanup() {
45+
echo $sched_rt_runtime_orig > $sched_rt_runtime
46+
}
47+
3248
errexit() { # message
3349
echo "Error: $1" 1>&2
50+
cleanup
3451
exit $err_ret
3552
}
3653

@@ -39,6 +56,8 @@ if [ `id -u` -ne 0 ]; then
3956
errexit "this must be run by root user"
4057
fi
4158

59+
setup
60+
4261
# Utilities
4362
absdir() { # file_path
4463
(cd `dirname $1`; pwd)
@@ -235,6 +254,7 @@ TOTAL_RESULT=0
235254

236255
INSTANCE=
237256
CASENO=0
257+
238258
testcase() { # testfile
239259
CASENO=$((CASENO+1))
240260
desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:`
@@ -406,5 +426,7 @@ prlog "# of unsupported: " `echo $UNSUPPORTED_CASES | wc -w`
406426
prlog "# of xfailed: " `echo $XFAILED_CASES | wc -w`
407427
prlog "# of undefined(test bug): " `echo $UNDEFINED_CASES | wc -w`
408428

429+
cleanup
430+
409431
# if no error, return 0
410432
exit $TOTAL_RESULT

0 commit comments

Comments
 (0)