aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2019-10-14 07:05:38 -0700
committerPaul E. McKenney <paulmck@kernel.org>2019-12-09 13:00:26 -0800
commit517f17aed0ce678dfa82d7dd4e2593fc1bac799c (patch)
tree7bb1cc3814099ad36031bd2725d6b100118d1644 /tools/testing/selftests
parentrcutorture: Dispense with Dracut for initrd creation (diff)
downloadlinux-dev-517f17aed0ce678dfa82d7dd4e2593fc1bac799c.tar.xz
linux-dev-517f17aed0ce678dfa82d7dd4e2593fc1bac799c.zip
torture: Handle jitter for CPUs that cannot be offlined
Currently, jitter.sh assumes that the underlying hypervisor will be configured with all CPUs hotpluggable, with the possible exception of CPU 0. However, there are installations where the hypervisor prohibits offlining, which breaks jitter.sh. This commit therefore lists the CPUs that cannot be offlined up front, and checks for the case where no CPU can be offlined in the loop. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/jitter.sh26
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh b/tools/testing/selftests/rcutorture/bin/jitter.sh
index 86a217b41b9f..30cb5b27d32e 100755
--- a/tools/testing/selftests/rcutorture/bin/jitter.sh
+++ b/tools/testing/selftests/rcutorture/bin/jitter.sh
@@ -25,6 +25,18 @@ n=1
starttime=`gawk 'BEGIN { print systime(); }' < /dev/null`
+nohotplugcpus=
+for i in /sys/devices/system/cpu/cpu[0-9]*
+do
+ if test -f $i/online
+ then
+ :
+ else
+ curcpu=`echo $i | sed -e 's/^[^0-9]*//'`
+ nohotplugcpus="$nohotplugcpus $curcpu"
+ fi
+done
+
while :
do
# Check for done.
@@ -35,13 +47,15 @@ do
fi
# Set affinity to randomly selected online CPU
- cpus=`grep 1 /sys/devices/system/cpu/*/online |
- sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//'`
-
- # Do not leave out poor old cpu0 which may not be hot-pluggable
- if [ ! -f "/sys/devices/system/cpu/cpu0/online" ]; then
- cpus="0 $cpus"
+ if cpus=`grep 1 /sys/devices/system/cpu/*/online 2>&1 |
+ sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//'`
+ then
+ :
+ else
+ cpus=
fi
+ # Do not leave out non-hot-pluggable CPUs
+ cpus="$cpus $nohotplugcpus"
cpumask=`awk -v cpus="$cpus" -v me=$me -v n=$n 'BEGIN {
srand(n + me + systime());