Skip to contentSkip to conversation

Torture-test updates for v4.18

PATCH New Paul E. McKenney 1 participant 7 messages Apr 23, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Torture-test updates for v4.18

Hello!

This series contains torture-test updates:

1. Add a script to edit output from failed runs. Running this
script takes your editor through the build errors and the various problems in the console output, for each such file, first showing a summary of the errors and then the full output.

2. Code cleanup: Fold parse-torture.sh into parse-console.sh.

3. Output end-of-test state onto the console for rcutorture, which
can help locate cases where RCU is unnecessarily starting new
grace periods. Of course, if you are testing the default RCU
flavor, the kernel probably asked for another grace period, but it can be useful for the other RCU flavors.

4. Print the above end-of-test state in the rcutorture test
summary provided by the rcutorture scripting.

5. Abbreviate kvm.sh summary lines to avoid line wrap.

6. Make kvm-find-errors.sh find build warnings.

Thanx, Paul

------------------------------------------------------------------------

 b/kernel/rcu/rcutorture.c                                   |    8 
 b/tools/testing/selftests/rcutorture/bin/kvm-find-errors.sh |   60 ++++++
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh |   12 -
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh     |    4 
 b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh  |    1 
 b/tools/testing/selftests/rcutorture/bin/parse-console.sh   |  115 ++++++++++--
 tools/testing/selftests/rcutorture/bin/parse-torture.sh     |  105 ----------
 7 files changed, 176 insertions(+), 129 deletions(-)
#1 lore raw

PATCH 1/6 torture: Add a script to edit output from failed runs

This commit adds a script that allows viewing the build and/or console output from failed rcutorture, locktorture, or rcuperf runs. This replaces a time-honored but inefficient manual procedure that uses cut and paste.

---
 .../selftests/rcutorture/bin/kvm-find-errors.sh    | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-find-errors.sh
tools/testing/selftests/rcutorture/bin/kvm-find-errors.sh new file +55 -0
new file mode 100755
index 000000000000..7742fac44781
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Invoke a text editor on all console.log files for all runs with diagnostics,
+# that is, on all such files having a console.log.diags counterpart.
+# Note that both console.log.diags and console.log are passed to the
+# editor (currently defaulting to "vi"), allowing the user to get an
+# idea of what to search for in the console.log file.
+#
+# Usage: kvm-find-errors.sh directory
+#
+# The "directory" above should end with the date/time directory, for example,
+# "tools/testing/selftests/rcutorture/res/2018.02.25-14:27:27".
+
+rundir="${1}"
+if test -z "$rundir" -o ! -d "$rundir"
+then
+	echo Usage: $0 directory
+fi
+editor=${EDITOR-vi}
+
+# Find builds with errors
+files=
+for i in ${rundir}/*/Make.out
+do
+	if grep -q "error:" < $i
+	then
+		files="$files $i"
+	fi
+done
+if test -n "$files"
+then
+	$editor $files
+else
+	echo No build errors.
+fi
+if grep -q -e "--buildonly" < ${rundir}/log
+then
+	echo Build-only run, no console logs to check.
+fi
+
+# Find console logs with errors
+files=
+for i in ${rundir}/*/console.log
+do
+	if test -r $i.diags
+	then
+		files="$files $i.diags $i"
+	fi
+done
+if test -n "$files"
+then
+	$editor $files
+else
+	echo No errors in console logs.
+fi
Signature · 1 line
2.5.2
#2 lore raw

PATCH 2/6 torture: Fold parse-torture.sh into parse-console.sh

In reply to Paul E. McKenney

The rcutorture scripting scans the console output twice, once to look for various sorts of hangs and again to find warnings and panics. Unfortunately, only the output of the second scan gets written to the console.log.diags file, which can cause hangs to be overlooked. This commit therefore folds the parse-torture.sh script (which looks for hangs) into the parse-console.sh script (which looks for warnings and panics). This allows both types of failure information to be added to console.log.diags, while still reliably removing this file when it proves to be empty.

This also fixes a long-standing bug where rcuperf log files would unconditionally complain about a hang.

---
 .../selftests/rcutorture/bin/kvm-recheck.sh        |   4 -
 .../selftests/rcutorture/bin/kvm-test-1-run.sh     |   1 -
 .../selftests/rcutorture/bin/parse-console.sh      | 115 ++++++++++++++++++---
 .../selftests/rcutorture/bin/parse-torture.sh      | 105 -------------------
 4 files changed, 102 insertions(+), 123 deletions(-)
 delete mode 100755 tools/testing/selftests/rcutorture/bin/parse-torture.sh
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +0 -4
index f7e988f369dd..c27e97824163 100755
@@ -48,10 +48,6 @@ do
 				cat $i/Make.oldconfig.err
 			fi
 			parse-build.sh $i/Make.out $configfile
-			if test "$TORTURE_SUITE" != rcuperf
-			then
-				parse-torture.sh $i/console.log $configfile
-			fi
 			parse-console.sh $i/console.log $configfile
 			if test -r $i/Warnings
 			then
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +0 -1
index 5f8fbb0d7c17..c5b0f94341d9 100755
@@ -267,5 +267,4 @@ then
 	echo Unknown PID, cannot kill qemu command
 fi
 
-parse-torture.sh $resdir/console.log $title
 parse-console.sh $resdir/console.log $title
tools/testing/selftests/rcutorture/bin/parse-console.sh +102 -13

159 lines not on this page · raw message

tools/testing/selftests/rcutorture/bin/parse-torture.sh deleted +0 -105

105 lines not on this page · raw message

Signature · 1 line
2.5.2
#3 lore raw

PATCH 3/6 rcutorture: Print end-of-test state

In reply to Paul E. McKenney

This commit adds end-of-test state printout to help check whether RCU shut down nicely. Note that this printout only helps for flavors of RCU that are not used much by the kernel. In particular, for normal RCU having a grace period in progress is expected behavior.

---
 kernel/rcu/rcutorture.c | 8 ++++++++
 1 file changed, 8 insertions(+)
kernel/rcu/rcutorture.c +8 -0
index 680c96d8c00f..fd86965b33a7 100644
@@ -1609,6 +1609,9 @@ static enum cpuhp_state rcutor_hp;
 static void
 rcu_torture_cleanup(void)
 {
+	int flags = 0;
+	unsigned long gpnum = 0;
+	unsigned long completed = 0;
 	int i;
 
 	rcutorture_record_test_transition();
@@ -1639,6 +1642,11 @@ rcu_torture_cleanup(void)
 		fakewriter_tasks = NULL;
 	}
 
+	rcutorture_get_gp_data(cur_ops->ttype, &flags, &gpnum, &completed);
+	srcutorture_get_gp_data(cur_ops->ttype, srcu_ctlp,
+				&flags, &gpnum, &completed);
+	pr_alert("%s:  End-test grace-period state: g%lu c%lu f%#x\n",
+		 cur_ops->name, gpnum, completed, flags);
 	torture_stop_kthread(rcu_torture_stats, stats_task);
 	torture_stop_kthread(rcu_torture_fqs, fqs_task);
 	for (i = 0; i < ncbflooders; i++)
Signature · 1 line
2.5.2
#4 lore raw

PATCH 4/6 rcutorture: Print end-of-test state in kvm.sh summary

In reply to Paul E. McKenney

This commit adds the end-of-test test, if present in the console output, to the kvm.sh test summary that is printed by kvm-recheck.sh. Note that this only applies to rcutorture console output.

---
 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh +6 -2
index c2e1bb6d0cba..166aed550bc9 100755
@@ -34,9 +34,13 @@ fi
 
 configfile=`echo $i | sed -e 's/^.*\///'`
 ngps=`grep ver: $i/console.log 2> /dev/null | tail -1 | sed -e 's/^.* ver: //' -e 's/ .*$//'`
+stopstate="`grep 'End-test grace-period state: g' $i/console.log 2> /dev/null |
+	    tail -1 | sed -e 's/^\[[ 0-9.]*] //' |
+	    awk '{ print \"[\" $1 \" \" $5 \" \" $6 \" \" $7 \"]\"; }' |
+	    tr -d '\012\015'`"
 if test -z "$ngps"
 then
-	echo "$configfile -------"
+	echo "$configfile ------- " $stopstate
 else
 	title="$configfile ------- $ngps grace periods"
 	dur=`sed -e 's/^.* rcutorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd 2> /dev/null`
@@ -48,7 +52,7 @@ else
 			BEGIN { print ngps / dur }' < /dev/null`
 		title="$title ($ngpsps per second)"
 	fi
-	echo $title
+	echo $title $stopstate
 	nclosecalls=`grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
 	if test -z "$nclosecalls"
 	then
Signature · 1 line
2.5.2
#5 lore raw

PATCH 5/6 rcutorture: Abbreviate kvm.sh summary lines

In reply to Paul E. McKenney

With the addition of the end-of-test state, it is not uncommon for the kvm.sh summary lines to overflow 80 characters. This commit therefore applies abbreviations in order to make the line fit into 80 characters with high probability.

And yes, I did make heavy use of punched cards back in the day, so 80 columns it is for my xterms! ;-)

---
 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh +2 -2
index 166aed550bc9..477ecb1293ab 100755
@@ -42,7 +42,7 @@ if test -z "$ngps"
 then
 	echo "$configfile ------- " $stopstate
 else
-	title="$configfile ------- $ngps grace periods"
+	title="$configfile ------- $ngps GPs"
 	dur=`sed -e 's/^.* rcutorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd 2> /dev/null`
 	if test -z "$dur"
 	then
@@ -50,7 +50,7 @@ else
 	else
 		ngpsps=`awk -v ngps=$ngps -v dur=$dur '
 			BEGIN { print ngps / dur }' < /dev/null`
-		title="$title ($ngpsps per second)"
+		title="$title ($ngpsps/s)"
 	fi
 	echo $title $stopstate
 	nclosecalls=`grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
Signature · 1 line
2.5.2
#6 lore raw

PATCH 6/6 torture: Make kvm-find-errors.sh find build warnings

In reply to Paul E. McKenney

Currently, kvm-find-errors.sh looks only for build errors ("error:"), so this commit makes it also locate build warnings ("warning:").

---
 tools/testing/selftests/rcutorture/bin/kvm-find-errors.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-find-errors.sh +3 -2
index 7742fac44781..98f650c9bf54 100755
@@ -22,9 +22,10 @@ editor=${EDITOR-vi}
 files=
 for i in ${rundir}/*/Make.out
 do
-	if grep -q "error:" < $i
+	if egrep -q "error:|warning:" < $i
 	then
-		files="$files $i"
+		egrep "error:|warning:" < $i > $i.diags
+		files="$files $i.diags $i"
 	fi
 done
 if test -n "$files"
Signature · 1 line
2.5.2