]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
torture: Prevent jitter processes from delaying failed run
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 18 Sep 2020 20:26:22 +0000 (13:26 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Sat, 7 Nov 2020 01:13:53 +0000 (17:13 -0800)
Even when the kernel panics and qemu dies, runs with jitter enabled will
continue uselessly until the jitter.sh processes terminate.  This can
be annoying if a planned one-hour run instead dies during boot.

This commit therefore kills the jitter.sh processes when the run ends
more than one minute prior to the termination time specified by the
kvm.sh --duration argument or its default.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
tools/testing/selftests/rcutorture/bin/kvm.sh

index d04966ab88cc57920015d63d1ac3f826b7fb8169..3cd03d01857cff221638956219e11e2c4c209a82 100755 (executable)
@@ -226,6 +226,20 @@ do
                                echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
                                ps -fp $killpid >> $resdir/Warnings 2>&1
                        fi
+                       # Reduce probability of PID reuse by allowing a one-minute buffer
+                       if test $((kruntime + 60)) -lt $seconds && test -s "$resdir/../jitter_pids"
+                       then
+                               awk < "$resdir/../jitter_pids" '
+                               NF > 0 {
+                                       pidlist = pidlist " " $1;
+                                       n++;
+                               }
+                               END {
+                                       if (n > 0) {
+                                               print "kill " pidlist;
+                                       }
+                               }' | sh
+                       fi
                else
                        echo ' ---' `date`: "Kernel done"
                fi
index 6eb1d3f6524d587087e102b2dae809d7bc1b4fa5..5ad3882563ce6dbcf6165bbf2f301bb3186aece6 100755 (executable)
@@ -459,8 +459,11 @@ function dump(first, pastlast, batchnum)
        print "if test -n \"$needqemurun\""
        print "then"
        print "\techo ---- Starting kernels. `date` | tee -a " rd "log";
-       for (j = 0; j < njitter; j++)
+       print "\techo > " rd "jitter_pids"
+       for (j = 0; j < njitter; j++) {
                print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&"
+               print "\techo $! >> " rd "jitter_pids"
+       }
        print "\twait"
        print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log";
        print "else"