diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-04-27 10:57:36 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-04-27 10:57:36 -0400 |
commit | 41ed943d855c3fa2bf6fecc33250b294bd568b7a (patch) | |
tree | ba29dd5031cc0c61ae9bd0b9c171192040214587 /tools | |
parent | f28f20da704d399fb1e4d8838ffd697a357d9cc8 (diff) | |
parent | dcd36d01fb3f99d1d5df01714f6ccbe3fbbaf81f (diff) |
Merge branch 'for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu
Pull RCU updates from Paul E. McKenney:
* Documentation updates, including fixes to the design-level
requirements documentation and a fixed version of the design-level
data-structure documentation. These fixes include removing
cartoons and getting rid of the html/htmlx duplication.
* Further improvements to the new-age expedited grace periods.
* Miscellaneous fixes.
* Torture-test changes, including a new rcuperf module for measuring
RCU grace-period performance and scalability, which is useful for
the expedited-grace-period changes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
13 files changed, 476 insertions, 21 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh b/tools/testing/selftests/rcutorture/bin/jitter.sh new file mode 100755 index 000000000000..3633828375e3 --- /dev/null +++ b/tools/testing/selftests/rcutorture/bin/jitter.sh | |||
@@ -0,0 +1,90 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Alternate sleeping and spinning on randomly selected CPUs. The purpose | ||
4 | # of this script is to inflict random OS jitter on a concurrently running | ||
5 | # test. | ||
6 | # | ||
7 | # Usage: jitter.sh me duration [ sleepmax [ spinmax ] ] | ||
8 | # | ||
9 | # me: Random-number-generator seed salt. | ||
10 | # duration: Time to run in seconds. | ||
11 | # sleepmax: Maximum microseconds to sleep, defaults to one second. | ||
12 | # spinmax: Maximum microseconds to spin, defaults to one millisecond. | ||
13 | # | ||
14 | # This program is free software; you can redistribute it and/or modify | ||
15 | # it under the terms of the GNU General Public License as published by | ||
16 | # the Free Software Foundation; either version 2 of the License, or | ||
17 | # (at your option) any later version. | ||
18 | # | ||
19 | # This program is distributed in the hope that it will be useful, | ||
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | # GNU General Public License for more details. | ||
23 | # | ||
24 | # You should have received a copy of the GNU General Public License | ||
25 | # along with this program; if not, you can access it online at | ||
26 | # http://www.gnu.org/licenses/gpl-2.0.html. | ||
27 | # | ||
28 | # Copyright (C) IBM Corporation, 2016 | ||
29 | # | ||
30 | # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
31 | |||
32 | me=$(($1 * 1000)) | ||
33 | duration=$2 | ||
34 | sleepmax=${3-1000000} | ||
35 | spinmax=${4-1000} | ||
36 | |||
37 | n=1 | ||
38 | |||
39 | starttime=`awk 'BEGIN { print systime(); }' < /dev/null` | ||
40 | |||
41 | while : | ||
42 | do | ||
43 | # Check for done. | ||
44 | t=`awk -v s=$starttime 'BEGIN { print systime() - s; }' < /dev/null` | ||
45 | if test "$t" -gt "$duration" | ||
46 | then | ||
47 | exit 0; | ||
48 | fi | ||
49 | |||
50 | # Set affinity to randomly selected CPU | ||
51 | cpus=`ls /sys/devices/system/cpu/*/online | | ||
52 | sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//' | | ||
53 | grep -v '^0*$'` | ||
54 | cpumask=`awk -v cpus="$cpus" -v me=$me -v n=$n 'BEGIN { | ||
55 | srand(n + me + systime()); | ||
56 | ncpus = split(cpus, ca); | ||
57 | curcpu = ca[int(rand() * ncpus + 1)]; | ||
58 | mask = lshift(1, curcpu); | ||
59 | if (mask + 0 <= 0) | ||
60 | mask = 1; | ||
61 | printf("%#x\n", mask); | ||
62 | }' < /dev/null` | ||
63 | n=$(($n+1)) | ||
64 | if ! taskset -p $cpumask $$ > /dev/null 2>&1 | ||
65 | then | ||
66 | echo taskset failure: '"taskset -p ' $cpumask $$ '"' | ||
67 | exit 1 | ||
68 | fi | ||
69 | |||
70 | # Sleep a random duration | ||
71 | sleeptime=`awk -v me=$me -v n=$n -v sleepmax=$sleepmax 'BEGIN { | ||
72 | srand(n + me + systime()); | ||
73 | printf("%06d", int(rand() * sleepmax)); | ||
74 | }' < /dev/null` | ||
75 | n=$(($n+1)) | ||
76 | sleep .$sleeptime | ||
77 | |||
78 | # Spin a random duration | ||
79 | limit=`awk -v me=$me -v n=$n -v spinmax=$spinmax 'BEGIN { | ||
80 | srand(n + me + systime()); | ||
81 | printf("%06d", int(rand() * spinmax)); | ||
82 | }' < /dev/null` | ||
83 | n=$(($n+1)) | ||
84 | for i in {1..$limit} | ||
85 | do | ||
86 | echo > /dev/null | ||
87 | done | ||
88 | done | ||
89 | |||
90 | exit 1 | ||
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh new file mode 100755 index 000000000000..f79b0e9e84fc --- /dev/null +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | |||
@@ -0,0 +1,121 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Analyze a given results directory for rcuperf performance measurements, | ||
4 | # looking for ftrace data. Exits with 0 if data was found, analyzed, and | ||
5 | # printed. Intended to be invoked from kvm-recheck-rcuperf.sh after | ||
6 | # argument checking. | ||
7 | # | ||
8 | # Usage: kvm-recheck-rcuperf-ftrace.sh resdir | ||
9 | # | ||
10 | # This program is free software; you can redistribute it and/or modify | ||
11 | # it under the terms of the GNU General Public License as published by | ||
12 | # the Free Software Foundation; either version 2 of the License, or | ||
13 | # (at your option) any later version. | ||
14 | # | ||
15 | # This program is distributed in the hope that it will be useful, | ||
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | # GNU General Public License for more details. | ||
19 | # | ||
20 | # You should have received a copy of the GNU General Public License | ||
21 | # along with this program; if not, you can access it online at | ||
22 | # http://www.gnu.org/licenses/gpl-2.0.html. | ||
23 | # | ||
24 | # Copyright (C) IBM Corporation, 2016 | ||
25 | # | ||
26 | # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
27 | |||
28 | i="$1" | ||
29 | . tools/testing/selftests/rcutorture/bin/functions.sh | ||
30 | |||
31 | if test "`grep -c 'rcu_exp_grace_period.*start' < $i/console.log`" -lt 100 | ||
32 | then | ||
33 | exit 10 | ||
34 | fi | ||
35 | |||
36 | sed -e 's/^\[[^]]*]//' < $i/console.log | | ||
37 | grep 'us : rcu_exp_grace_period' | | ||
38 | sed -e 's/us : / : /' | | ||
39 | tr -d '\015' | | ||
40 | awk ' | ||
41 | $8 == "start" { | ||
42 | if (starttask != "") | ||
43 | nlost++; | ||
44 | starttask = $1; | ||
45 | starttime = $3; | ||
46 | startseq = $7; | ||
47 | } | ||
48 | |||
49 | $8 == "end" { | ||
50 | if (starttask == $1 && startseq == $7) { | ||
51 | curgpdur = $3 - starttime; | ||
52 | gptimes[++n] = curgpdur; | ||
53 | gptaskcnt[starttask]++; | ||
54 | sum += curgpdur; | ||
55 | if (curgpdur > 1000) | ||
56 | print "Long GP " starttime "us to " $3 "us (" curgpdur "us)"; | ||
57 | starttask = ""; | ||
58 | } else { | ||
59 | # Lost a message or some such, reset. | ||
60 | starttask = ""; | ||
61 | nlost++; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | $8 == "done" { | ||
66 | piggybackcnt[$1]++; | ||
67 | } | ||
68 | |||
69 | END { | ||
70 | newNR = asort(gptimes); | ||
71 | if (newNR <= 0) { | ||
72 | print "No ftrace records found???" | ||
73 | exit 10; | ||
74 | } | ||
75 | pct50 = int(newNR * 50 / 100); | ||
76 | if (pct50 < 1) | ||
77 | pct50 = 1; | ||
78 | pct90 = int(newNR * 90 / 100); | ||
79 | if (pct90 < 1) | ||
80 | pct90 = 1; | ||
81 | pct99 = int(newNR * 99 / 100); | ||
82 | if (pct99 < 1) | ||
83 | pct99 = 1; | ||
84 | div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100; | ||
85 | print "Histogram bucket size: " div; | ||
86 | last = gptimes[1] - 10; | ||
87 | count = 0; | ||
88 | for (i = 1; i <= newNR; i++) { | ||
89 | current = div * int(gptimes[i] / div); | ||
90 | if (last == current) { | ||
91 | count++; | ||
92 | } else { | ||
93 | if (count > 0) | ||
94 | print last, count; | ||
95 | count = 1; | ||
96 | last = current; | ||
97 | } | ||
98 | } | ||
99 | if (count > 0) | ||
100 | print last, count; | ||
101 | print "Distribution of grace periods across tasks:"; | ||
102 | for (i in gptaskcnt) { | ||
103 | print "\t" i, gptaskcnt[i]; | ||
104 | nbatches += gptaskcnt[i]; | ||
105 | } | ||
106 | ngps = nbatches; | ||
107 | print "Distribution of piggybacking across tasks:"; | ||
108 | for (i in piggybackcnt) { | ||
109 | print "\t" i, piggybackcnt[i]; | ||
110 | ngps += piggybackcnt[i]; | ||
111 | } | ||
112 | print "Average grace-period duration: " sum / newNR " microseconds"; | ||
113 | print "Minimum grace-period duration: " gptimes[1]; | ||
114 | print "50th percentile grace-period duration: " gptimes[pct50]; | ||
115 | print "90th percentile grace-period duration: " gptimes[pct90]; | ||
116 | print "99th percentile grace-period duration: " gptimes[pct99]; | ||
117 | print "Maximum grace-period duration: " gptimes[newNR]; | ||
118 | print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches " Lost: " nlost + 0; | ||
119 | print "Computed from ftrace data."; | ||
120 | }' | ||
121 | exit 0 | ||
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh new file mode 100755 index 000000000000..8f3121afc716 --- /dev/null +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh | |||
@@ -0,0 +1,96 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Analyze a given results directory for rcuperf performance measurements. | ||
4 | # | ||
5 | # Usage: kvm-recheck-rcuperf.sh resdir | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License as published by | ||
9 | # the Free Software Foundation; either version 2 of the License, or | ||
10 | # (at your option) any later version. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License | ||
18 | # along with this program; if not, you can access it online at | ||
19 | # http://www.gnu.org/licenses/gpl-2.0.html. | ||
20 | # | ||
21 | # Copyright (C) IBM Corporation, 2016 | ||
22 | # | ||
23 | # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
24 | |||
25 | i="$1" | ||
26 | if test -d $i | ||
27 | then | ||
28 | : | ||
29 | else | ||
30 | echo Unreadable results directory: $i | ||
31 | exit 1 | ||
32 | fi | ||
33 | PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH | ||
34 | . tools/testing/selftests/rcutorture/bin/functions.sh | ||
35 | |||
36 | if kvm-recheck-rcuperf-ftrace.sh $i | ||
37 | then | ||
38 | # ftrace data was successfully analyzed, call it good! | ||
39 | exit 0 | ||
40 | fi | ||
41 | |||
42 | configfile=`echo $i | sed -e 's/^.*\///'` | ||
43 | |||
44 | sed -e 's/^\[[^]]*]//' < $i/console.log | | ||
45 | awk ' | ||
46 | /-perf: .* gps: .* batches:/ { | ||
47 | ngps = $9; | ||
48 | nbatches = $11; | ||
49 | } | ||
50 | |||
51 | /-perf: .*writer-duration/ { | ||
52 | gptimes[++n] = $5 / 1000.; | ||
53 | sum += $5 / 1000.; | ||
54 | } | ||
55 | |||
56 | END { | ||
57 | newNR = asort(gptimes); | ||
58 | if (newNR <= 0) { | ||
59 | print "No rcuperf records found???" | ||
60 | exit; | ||
61 | } | ||
62 | pct50 = int(newNR * 50 / 100); | ||
63 | if (pct50 < 1) | ||
64 | pct50 = 1; | ||
65 | pct90 = int(newNR * 90 / 100); | ||
66 | if (pct90 < 1) | ||
67 | pct90 = 1; | ||
68 | pct99 = int(newNR * 99 / 100); | ||
69 | if (pct99 < 1) | ||
70 | pct99 = 1; | ||
71 | div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100; | ||
72 | print "Histogram bucket size: " div; | ||
73 | last = gptimes[1] - 10; | ||
74 | count = 0; | ||
75 | for (i = 1; i <= newNR; i++) { | ||
76 | current = div * int(gptimes[i] / div); | ||
77 | if (last == current) { | ||
78 | count++; | ||
79 | } else { | ||
80 | if (count > 0) | ||
81 | print last, count; | ||
82 | count = 1; | ||
83 | last = current; | ||
84 | } | ||
85 | } | ||
86 | if (count > 0) | ||
87 | print last, count; | ||
88 | print "Average grace-period duration: " sum / newNR " microseconds"; | ||
89 | print "Minimum grace-period duration: " gptimes[1]; | ||
90 | print "50th percentile grace-period duration: " gptimes[pct50]; | ||
91 | print "90th percentile grace-period duration: " gptimes[pct90]; | ||
92 | print "99th percentile grace-period duration: " gptimes[pct99]; | ||
93 | print "Maximum grace-period duration: " gptimes[newNR]; | ||
94 | print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches; | ||
95 | print "Computed from rcuperf printk output."; | ||
96 | }' | ||
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh index d86bdd6b6cc2..f659346d3358 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh | |||
@@ -48,7 +48,10 @@ do | |||
48 | cat $i/Make.oldconfig.err | 48 | cat $i/Make.oldconfig.err |
49 | fi | 49 | fi |
50 | parse-build.sh $i/Make.out $configfile | 50 | parse-build.sh $i/Make.out $configfile |
51 | parse-torture.sh $i/console.log $configfile | 51 | if test "$TORTURE_SUITE" != rcuperf |
52 | then | ||
53 | parse-torture.sh $i/console.log $configfile | ||
54 | fi | ||
52 | parse-console.sh $i/console.log $configfile | 55 | parse-console.sh $i/console.log $configfile |
53 | if test -r $i/Warnings | 56 | if test -r $i/Warnings |
54 | then | 57 | then |
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh index 0f80eefb0bfd..4109f306d855 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | |||
@@ -6,7 +6,7 @@ | |||
6 | # Execute this in the source tree. Do not run it as a background task | 6 | # Execute this in the source tree. Do not run it as a background task |
7 | # because qemu does not seem to like that much. | 7 | # because qemu does not seem to like that much. |
8 | # | 8 | # |
9 | # Usage: kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args | 9 | # Usage: kvm-test-1-run.sh config builddir resdir seconds qemu-args boot_args |
10 | # | 10 | # |
11 | # qemu-args defaults to "-enable-kvm -soundhw pcspk -nographic", along with | 11 | # qemu-args defaults to "-enable-kvm -soundhw pcspk -nographic", along with |
12 | # arguments specifying the number of CPUs and other | 12 | # arguments specifying the number of CPUs and other |
@@ -91,25 +91,33 @@ fi | |||
91 | # CONFIG_PCMCIA=n | 91 | # CONFIG_PCMCIA=n |
92 | # CONFIG_CARDBUS=n | 92 | # CONFIG_CARDBUS=n |
93 | # CONFIG_YENTA=n | 93 | # CONFIG_YENTA=n |
94 | if kvm-build.sh $config_template $builddir $T | 94 | base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'` |
95 | if test "$base_resdir" != "$resdir" -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux | ||
95 | then | 96 | then |
97 | # Rerunning previous test, so use that test's kernel. | ||
98 | QEMU="`identify_qemu $base_resdir/vmlinux`" | ||
99 | KERNEL=$base_resdir/bzImage | ||
100 | ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh | ||
101 | ln -s $base_resdir/.config $resdir # for kvm-recheck.sh | ||
102 | elif kvm-build.sh $config_template $builddir $T | ||
103 | then | ||
104 | # Had to build a kernel for this test. | ||
96 | QEMU="`identify_qemu $builddir/vmlinux`" | 105 | QEMU="`identify_qemu $builddir/vmlinux`" |
97 | BOOT_IMAGE="`identify_boot_image $QEMU`" | 106 | BOOT_IMAGE="`identify_boot_image $QEMU`" |
98 | cp $builddir/Make*.out $resdir | 107 | cp $builddir/Make*.out $resdir |
108 | cp $builddir/vmlinux $resdir | ||
99 | cp $builddir/.config $resdir | 109 | cp $builddir/.config $resdir |
100 | if test -n "$BOOT_IMAGE" | 110 | if test -n "$BOOT_IMAGE" |
101 | then | 111 | then |
102 | cp $builddir/$BOOT_IMAGE $resdir | 112 | cp $builddir/$BOOT_IMAGE $resdir |
113 | KERNEL=$resdir/bzImage | ||
103 | else | 114 | else |
104 | echo No identifiable boot image, not running KVM, see $resdir. | 115 | echo No identifiable boot image, not running KVM, see $resdir. |
105 | echo Do the torture scripts know about your architecture? | 116 | echo Do the torture scripts know about your architecture? |
106 | fi | 117 | fi |
107 | parse-build.sh $resdir/Make.out $title | 118 | parse-build.sh $resdir/Make.out $title |
108 | if test -f $builddir.wait | ||
109 | then | ||
110 | mv $builddir.wait $builddir.ready | ||
111 | fi | ||
112 | else | 119 | else |
120 | # Build failed. | ||
113 | cp $builddir/Make*.out $resdir | 121 | cp $builddir/Make*.out $resdir |
114 | cp $builddir/.config $resdir || : | 122 | cp $builddir/.config $resdir || : |
115 | echo Build failed, not running KVM, see $resdir. | 123 | echo Build failed, not running KVM, see $resdir. |
@@ -119,12 +127,15 @@ else | |||
119 | fi | 127 | fi |
120 | exit 1 | 128 | exit 1 |
121 | fi | 129 | fi |
130 | if test -f $builddir.wait | ||
131 | then | ||
132 | mv $builddir.wait $builddir.ready | ||
133 | fi | ||
122 | while test -f $builddir.ready | 134 | while test -f $builddir.ready |
123 | do | 135 | do |
124 | sleep 1 | 136 | sleep 1 |
125 | done | 137 | done |
126 | minutes=$4 | 138 | seconds=$4 |
127 | seconds=$(($minutes * 60)) | ||
128 | qemu_args=$5 | 139 | qemu_args=$5 |
129 | boot_args=$6 | 140 | boot_args=$6 |
130 | 141 | ||
@@ -167,15 +178,26 @@ then | |||
167 | exit 0 | 178 | exit 0 |
168 | fi | 179 | fi |
169 | echo "NOTE: $QEMU either did not run or was interactive" > $resdir/console.log | 180 | echo "NOTE: $QEMU either did not run or was interactive" > $resdir/console.log |
170 | echo $QEMU $qemu_args -m 512 -kernel $resdir/bzImage -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd | 181 | echo $QEMU $qemu_args -m 512 -kernel $KERNEL -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd |
171 | ( $QEMU $qemu_args -m 512 -kernel $resdir/bzImage -append "$qemu_append $boot_args"; echo $? > $resdir/qemu-retval ) & | 182 | ( $QEMU $qemu_args -m 512 -kernel $KERNEL -append "$qemu_append $boot_args"& echo $! > $resdir/qemu_pid; wait `cat $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) & |
172 | qemu_pid=$! | ||
173 | commandcompleted=0 | 183 | commandcompleted=0 |
174 | echo Monitoring qemu job at pid $qemu_pid | 184 | sleep 10 # Give qemu's pid a chance to reach the file |
185 | if test -s "$resdir/qemu_pid" | ||
186 | then | ||
187 | qemu_pid=`cat "$resdir/qemu_pid"` | ||
188 | echo Monitoring qemu job at pid $qemu_pid | ||
189 | else | ||
190 | qemu_pid="" | ||
191 | echo Monitoring qemu job at yet-as-unknown pid | ||
192 | fi | ||
175 | while : | 193 | while : |
176 | do | 194 | do |
195 | if test -z "$qemu_pid" -a -s "$resdir/qemu_pid" | ||
196 | then | ||
197 | qemu_pid=`cat "$resdir/qemu_pid"` | ||
198 | fi | ||
177 | kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null` | 199 | kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null` |
178 | if kill -0 $qemu_pid > /dev/null 2>&1 | 200 | if test -z "$qemu_pid" || kill -0 "$qemu_pid" > /dev/null 2>&1 |
179 | then | 201 | then |
180 | if test $kruntime -ge $seconds | 202 | if test $kruntime -ge $seconds |
181 | then | 203 | then |
@@ -195,12 +217,16 @@ do | |||
195 | ps -fp $killpid >> $resdir/Warnings 2>&1 | 217 | ps -fp $killpid >> $resdir/Warnings 2>&1 |
196 | fi | 218 | fi |
197 | else | 219 | else |
198 | echo ' ---' `date`: Kernel done | 220 | echo ' ---' `date`: "Kernel done" |
199 | fi | 221 | fi |
200 | break | 222 | break |
201 | fi | 223 | fi |
202 | done | 224 | done |
203 | if test $commandcompleted -eq 0 | 225 | if test -z "$qemu_pid" -a -s "$resdir/qemu_pid" |
226 | then | ||
227 | qemu_pid=`cat "$resdir/qemu_pid"` | ||
228 | fi | ||
229 | if test $commandcompleted -eq 0 -a -n "$qemu_pid" | ||
204 | then | 230 | then |
205 | echo Grace period for qemu job at pid $qemu_pid | 231 | echo Grace period for qemu job at pid $qemu_pid |
206 | while : | 232 | while : |
@@ -220,6 +246,9 @@ then | |||
220 | fi | 246 | fi |
221 | sleep 1 | 247 | sleep 1 |
222 | done | 248 | done |
249 | elif test -z "$qemu_pid" | ||
250 | then | ||
251 | echo Unknown PID, cannot kill qemu command | ||
223 | fi | 252 | fi |
224 | 253 | ||
225 | parse-torture.sh $resdir/console.log $title | 254 | parse-torture.sh $resdir/console.log $title |
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh index 4a431767f77a..0d598145873e 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm.sh | |||
@@ -34,7 +34,7 @@ T=/tmp/kvm.sh.$$ | |||
34 | trap 'rm -rf $T' 0 | 34 | trap 'rm -rf $T' 0 |
35 | mkdir $T | 35 | mkdir $T |
36 | 36 | ||
37 | dur=30 | 37 | dur=$((30*60)) |
38 | dryrun="" | 38 | dryrun="" |
39 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM | 39 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM |
40 | PATH=${KVM}/bin:$PATH; export PATH | 40 | PATH=${KVM}/bin:$PATH; export PATH |
@@ -48,6 +48,7 @@ resdir="" | |||
48 | configs="" | 48 | configs="" |
49 | cpus=0 | 49 | cpus=0 |
50 | ds=`date +%Y.%m.%d-%H:%M:%S` | 50 | ds=`date +%Y.%m.%d-%H:%M:%S` |
51 | jitter=0 | ||
51 | 52 | ||
52 | . functions.sh | 53 | . functions.sh |
53 | 54 | ||
@@ -63,6 +64,7 @@ usage () { | |||
63 | echo " --dryrun sched|script" | 64 | echo " --dryrun sched|script" |
64 | echo " --duration minutes" | 65 | echo " --duration minutes" |
65 | echo " --interactive" | 66 | echo " --interactive" |
67 | echo " --jitter N [ maxsleep (us) [ maxspin (us) ] ]" | ||
66 | echo " --kmake-arg kernel-make-arguments" | 68 | echo " --kmake-arg kernel-make-arguments" |
67 | echo " --mac nn:nn:nn:nn:nn:nn" | 69 | echo " --mac nn:nn:nn:nn:nn:nn" |
68 | echo " --no-initrd" | 70 | echo " --no-initrd" |
@@ -116,12 +118,17 @@ do | |||
116 | ;; | 118 | ;; |
117 | --duration) | 119 | --duration) |
118 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' | 120 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' |
119 | dur=$2 | 121 | dur=$(($2*60)) |
120 | shift | 122 | shift |
121 | ;; | 123 | ;; |
122 | --interactive) | 124 | --interactive) |
123 | TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE | 125 | TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE |
124 | ;; | 126 | ;; |
127 | --jitter) | ||
128 | checkarg --jitter "(# threads [ sleep [ spin ] ])" $# "$2" '^-\{,1\}[0-9]\+\( \+[0-9]\+\)\{,2\} *$' '^error$' | ||
129 | jitter="$2" | ||
130 | shift | ||
131 | ;; | ||
125 | --kmake-arg) | 132 | --kmake-arg) |
126 | checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' | 133 | checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' |
127 | TORTURE_KMAKE_ARG="$2" | 134 | TORTURE_KMAKE_ARG="$2" |
@@ -156,7 +163,7 @@ do | |||
156 | shift | 163 | shift |
157 | ;; | 164 | ;; |
158 | --torture) | 165 | --torture) |
159 | checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\)$' '^--' | 166 | checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\|rcuperf\)$' '^--' |
160 | TORTURE_SUITE=$2 | 167 | TORTURE_SUITE=$2 |
161 | shift | 168 | shift |
162 | ;; | 169 | ;; |
@@ -299,6 +306,7 @@ awk < $T/cfgcpu.pack \ | |||
299 | -v CONFIGDIR="$CONFIGFRAG/" \ | 306 | -v CONFIGDIR="$CONFIGFRAG/" \ |
300 | -v KVM="$KVM" \ | 307 | -v KVM="$KVM" \ |
301 | -v ncpus=$cpus \ | 308 | -v ncpus=$cpus \ |
309 | -v jitter="$jitter" \ | ||
302 | -v rd=$resdir/$ds/ \ | 310 | -v rd=$resdir/$ds/ \ |
303 | -v dur=$dur \ | 311 | -v dur=$dur \ |
304 | -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \ | 312 | -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \ |
@@ -359,6 +367,16 @@ function dump(first, pastlast, batchnum) | |||
359 | print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log"; | 367 | print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log"; |
360 | print "fi" | 368 | print "fi" |
361 | } | 369 | } |
370 | njitter = 0; | ||
371 | split(jitter, ja); | ||
372 | if (ja[1] == -1 && ncpus == 0) | ||
373 | njitter = 1; | ||
374 | else if (ja[1] == -1) | ||
375 | njitter = ncpus; | ||
376 | else | ||
377 | njitter = ja[1]; | ||
378 | for (j = 0; j < njitter; j++) | ||
379 | print "jitter.sh " j " " dur " " ja[2] " " ja[3] "&" | ||
362 | print "wait" | 380 | print "wait" |
363 | print "if test -z \"$TORTURE_BUILDONLY\"" | 381 | print "if test -z \"$TORTURE_BUILDONLY\"" |
364 | print "then" | 382 | print "then" |
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE04 b/tools/testing/selftests/rcutorture/configs/rcu/TREE04 index 39a2c6d7d7ec..17cbe098b115 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE04 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE04 | |||
@@ -14,7 +14,7 @@ CONFIG_HOTPLUG_CPU=n | |||
14 | CONFIG_SUSPEND=n | 14 | CONFIG_SUSPEND=n |
15 | CONFIG_HIBERNATION=n | 15 | CONFIG_HIBERNATION=n |
16 | CONFIG_RCU_FANOUT=4 | 16 | CONFIG_RCU_FANOUT=4 |
17 | CONFIG_RCU_FANOUT_LEAF=4 | 17 | CONFIG_RCU_FANOUT_LEAF=3 |
18 | CONFIG_RCU_NOCB_CPU=n | 18 | CONFIG_RCU_NOCB_CPU=n |
19 | CONFIG_DEBUG_LOCK_ALLOC=n | 19 | CONFIG_DEBUG_LOCK_ALLOC=n |
20 | CONFIG_DEBUG_OBJECTS_RCU_HEAD=n | 20 | CONFIG_DEBUG_OBJECTS_RCU_HEAD=n |
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE04.boot b/tools/testing/selftests/rcutorture/configs/rcu/TREE04.boot index 0fc8a3428938..e34c33430447 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE04.boot +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE04.boot | |||
@@ -1 +1 @@ | |||
rcutorture.torture_type=rcu_bh | rcutorture.torture_type=rcu_bh rcutree.rcu_fanout_leaf=4 | ||
diff --git a/tools/testing/selftests/rcutorture/configs/rcuperf/CFLIST b/tools/testing/selftests/rcutorture/configs/rcuperf/CFLIST new file mode 100644 index 000000000000..c9f56cf20775 --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcuperf/CFLIST | |||
@@ -0,0 +1 @@ | |||
TREE | |||
diff --git a/tools/testing/selftests/rcutorture/configs/rcuperf/CFcommon b/tools/testing/selftests/rcutorture/configs/rcuperf/CFcommon new file mode 100644 index 000000000000..a09816b8c0f3 --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcuperf/CFcommon | |||
@@ -0,0 +1,2 @@ | |||
1 | CONFIG_RCU_PERF_TEST=y | ||
2 | CONFIG_PRINTK_TIME=y | ||
diff --git a/tools/testing/selftests/rcutorture/configs/rcuperf/TREE b/tools/testing/selftests/rcutorture/configs/rcuperf/TREE new file mode 100644 index 000000000000..a312f671a29a --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcuperf/TREE | |||
@@ -0,0 +1,20 @@ | |||
1 | CONFIG_SMP=y | ||
2 | CONFIG_PREEMPT_NONE=n | ||
3 | CONFIG_PREEMPT_VOLUNTARY=n | ||
4 | CONFIG_PREEMPT=y | ||
5 | #CHECK#CONFIG_PREEMPT_RCU=y | ||
6 | CONFIG_HZ_PERIODIC=n | ||
7 | CONFIG_NO_HZ_IDLE=y | ||
8 | CONFIG_NO_HZ_FULL=n | ||
9 | CONFIG_RCU_FAST_NO_HZ=n | ||
10 | CONFIG_RCU_TRACE=n | ||
11 | CONFIG_HOTPLUG_CPU=n | ||
12 | CONFIG_SUSPEND=n | ||
13 | CONFIG_HIBERNATION=n | ||
14 | CONFIG_RCU_NOCB_CPU=n | ||
15 | CONFIG_DEBUG_LOCK_ALLOC=n | ||
16 | CONFIG_PROVE_LOCKING=n | ||
17 | CONFIG_RCU_BOOST=n | ||
18 | CONFIG_DEBUG_OBJECTS_RCU_HEAD=n | ||
19 | CONFIG_RCU_EXPERT=y | ||
20 | CONFIG_RCU_TRACE=y | ||
diff --git a/tools/testing/selftests/rcutorture/configs/rcuperf/TREE54 b/tools/testing/selftests/rcutorture/configs/rcuperf/TREE54 new file mode 100644 index 000000000000..985fb170d13c --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcuperf/TREE54 | |||
@@ -0,0 +1,23 @@ | |||
1 | CONFIG_SMP=y | ||
2 | CONFIG_NR_CPUS=54 | ||
3 | CONFIG_PREEMPT_NONE=n | ||
4 | CONFIG_PREEMPT_VOLUNTARY=n | ||
5 | CONFIG_PREEMPT=y | ||
6 | #CHECK#CONFIG_PREEMPT_RCU=y | ||
7 | CONFIG_HZ_PERIODIC=n | ||
8 | CONFIG_NO_HZ_IDLE=y | ||
9 | CONFIG_NO_HZ_FULL=n | ||
10 | CONFIG_RCU_FAST_NO_HZ=n | ||
11 | CONFIG_RCU_TRACE=n | ||
12 | CONFIG_HOTPLUG_CPU=n | ||
13 | CONFIG_SUSPEND=n | ||
14 | CONFIG_HIBERNATION=n | ||
15 | CONFIG_RCU_FANOUT=3 | ||
16 | CONFIG_RCU_FANOUT_LEAF=2 | ||
17 | CONFIG_RCU_NOCB_CPU=n | ||
18 | CONFIG_DEBUG_LOCK_ALLOC=n | ||
19 | CONFIG_PROVE_LOCKING=n | ||
20 | CONFIG_RCU_BOOST=n | ||
21 | CONFIG_DEBUG_OBJECTS_RCU_HEAD=n | ||
22 | CONFIG_RCU_EXPERT=y | ||
23 | CONFIG_RCU_TRACE=y | ||
diff --git a/tools/testing/selftests/rcutorture/configs/rcuperf/ver_functions.sh b/tools/testing/selftests/rcutorture/configs/rcuperf/ver_functions.sh new file mode 100644 index 000000000000..34f2a1b35ee5 --- /dev/null +++ b/tools/testing/selftests/rcutorture/configs/rcuperf/ver_functions.sh | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Torture-suite-dependent shell functions for the rest of the scripts. | ||
4 | # | ||
5 | # This program is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published by | ||
7 | # the Free Software Foundation; either version 2 of the License, or | ||
8 | # (at your option) any later version. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with this program; if not, you can access it online at | ||
17 | # http://www.gnu.org/licenses/gpl-2.0.html. | ||
18 | # | ||
19 | # Copyright (C) IBM Corporation, 2015 | ||
20 | # | ||
21 | # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
22 | |||
23 | # rcuperf_param_nreaders bootparam-string | ||
24 | # | ||
25 | # Adds nreaders rcuperf module parameter if not already specified. | ||
26 | rcuperf_param_nreaders () { | ||
27 | if ! echo "$1" | grep -q "rcuperf.nreaders" | ||
28 | then | ||
29 | echo rcuperf.nreaders=-1 | ||
30 | fi | ||
31 | } | ||
32 | |||
33 | # rcuperf_param_nwriters bootparam-string | ||
34 | # | ||
35 | # Adds nwriters rcuperf module parameter if not already specified. | ||
36 | rcuperf_param_nwriters () { | ||
37 | if ! echo "$1" | grep -q "rcuperf.nwriters" | ||
38 | then | ||
39 | echo rcuperf.nwriters=-1 | ||
40 | fi | ||
41 | } | ||
42 | |||
43 | # per_version_boot_params bootparam-string config-file seconds | ||
44 | # | ||
45 | # Adds per-version torture-module parameters to kernels supporting them. | ||
46 | per_version_boot_params () { | ||
47 | echo $1 `rcuperf_param_nreaders "$1"` \ | ||
48 | `rcuperf_param_nwriters "$1"` \ | ||
49 | rcuperf.perf_runnable=1 \ | ||
50 | rcuperf.shutdown=1 \ | ||
51 | rcuperf.verbose=1 | ||
52 | } | ||