Skip to content

Commit 517f17a

Browse files
committed
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 <[email protected]>
1 parent 9aa55ec commit 517f17a

File tree

1 file changed

+20
-6
lines changed
  • tools/testing/selftests/rcutorture/bin

1 file changed

+20
-6
lines changed

tools/testing/selftests/rcutorture/bin/jitter.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ n=1
2525

2626
starttime=`gawk 'BEGIN { print systime(); }' < /dev/null`
2727

28+
nohotplugcpus=
29+
for i in /sys/devices/system/cpu/cpu[0-9]*
30+
do
31+
if test -f $i/online
32+
then
33+
:
34+
else
35+
curcpu=`echo $i | sed -e 's/^[^0-9]*//'`
36+
nohotplugcpus="$nohotplugcpus $curcpu"
37+
fi
38+
done
39+
2840
while :
2941
do
3042
# Check for done.
@@ -35,13 +47,15 @@ do
3547
fi
3648

3749
# Set affinity to randomly selected online CPU
38-
cpus=`grep 1 /sys/devices/system/cpu/*/online |
39-
sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//'`
40-
41-
# Do not leave out poor old cpu0 which may not be hot-pluggable
42-
if [ ! -f "/sys/devices/system/cpu/cpu0/online" ]; then
43-
cpus="0 $cpus"
50+
if cpus=`grep 1 /sys/devices/system/cpu/*/online 2>&1 |
51+
sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//'`
52+
then
53+
:
54+
else
55+
cpus=
4456
fi
57+
# Do not leave out non-hot-pluggable CPUs
58+
cpus="$cpus $nohotplugcpus"
4559

4660
cpumask=`awk -v cpus="$cpus" -v me=$me -v n=$n 'BEGIN {
4761
srand(n + me + systime());

0 commit comments

Comments
 (0)