Torture-test update for v4.15
Subsystems (6)
cover Torture-test update for v4.15
Hello!
This series contains torture-test updates:
1. Add interrupt-disable capability to stall-warning tests.
2. Dump writer stack if rcutorture writer kthread is stalled.
3. Provide TMPDIR environment variable to specify temporary
directory in order to run rcutorture on oddly configured systems.
Thanx, Paul
------------------------------------------------------------------------
Documentation/admin-guide/kernel-parameters.txt | 3 + kernel/rcu/rcutorture.c | 24 +++++++++++--- kernel/sched/core.c | 1 tools/testing/selftests/rcutorture/bin/config_override.sh | 2 - tools/testing/selftests/rcutorture/bin/configcheck.sh | 2 - tools/testing/selftests/rcutorture/bin/configinit.sh | 2 - tools/testing/selftests/rcutorture/bin/kvm-build.sh | 2 - tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 2 - tools/testing/selftests/rcutorture/bin/kvm.sh | 4 +- tools/testing/selftests/rcutorture/bin/parse-build.sh | 2 - tools/testing/selftests/rcutorture/bin/parse-torture.sh | 2 - 11 files changed, 32 insertions(+), 14 deletions(-)
PATCH 1/3 rcutorture: Add interrupt-disable capability to stall-warning tests
When rcutorture sees the rcutorture.stall_cpu kernel boot parameter, it loops with preemption disabled, which does in fact normally generate an RCU CPU stall warning message. However, there are test scenarios that need the stalling CPU to have interrupts disabled. This commit therefore adds an rcutorture.stall_cpu_irqsoff kernel boot parameter that causes the stalling CPU to disable interrupts.
--- Documentation/admin-guide/kernel-parameters.txt | 3 +++ kernel/rcu/rcutorture.c | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +3 -0
@@ -3539,6 +3539,9 @@ rcutorture.stall_cpu_holdoff= [KNL] Time to wait (s) after boot before inducing stall. + rcutorture.stall_cpu_irqsoff= [KNL] + Disable interrupts while stalling if set. + rcutorture.stat_interval= [KNL] Time (s) between statistics printk()s.
kernel/rcu/rcutorture.c +13 -5
@@ -89,6 +89,7 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable.");torture_param (int, stall_cpu,0 ,"Stall duration (s), zero to disable." );torture_param (int, stall_cpu_holdoff,10 ,"Time to wait before starting stall (s)." ); +torture_param (int, stall_cpu_irqsoff,0 ,"Disable interrupts while stalling." );torture_param (int, stat_interval,60 ,"Number of seconds between stats printk()s" );torture_param (int, stutter,5 ,"Number of seconds to run/halt test" );
@@ -1357,7 +1358,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)"fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d " "test_boost=%d/%d test_boost_interval=%d " "test_boost_duration=%d shutdown_secs=%d " -"stall_cpu=%d stall_cpu_holdoff=%d " +"stall_cpu=%d stall_cpu_holdoff=%d stall_cpu_irqsoff=%d " "n_barrier_cbs=%d " "onoff_interval=%d onoff_holdoff=%d\n" , torture_type, tag, nrealreaders, nfakewriters,
@@ -1365,7 +1366,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag) stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter, test_boost, cur_ops->can_boost, test_boost_interval, test_boost_duration, shutdown_secs, - stall_cpu, stall_cpu_holdoff, + stall_cpu, stall_cpu_holdoff, stall_cpu_irqsoff, n_barrier_cbs, onoff_interval, onoff_holdoff); }
@@ -1430,12 +1431,19 @@ static int rcu_torture_stall(void *args)if (!kthread_should_stop ()) { stop_at =get_seconds () + stall_cpu;/* RCU CPU stall is expected behavior in following code. */ -pr_alert ("rcu_torture_stall start.\n" );rcu_read_lock (); -preempt_disable (); +if (stall_cpu_irqsoff) +local_irq_disable (); +else +preempt_disable (); +pr_alert ("rcu_torture_stall start on CPU %d.\n" , +smp_processor_id ());while (ULONG_CMP_LT (get_seconds (), stop_at))continue ;/* Induce RCU CPU stall warning. */ -preempt_enable (); +if (stall_cpu_irqsoff) +local_irq_enable (); +else +preempt_enable ();rcu_read_unlock ();pr_alert ("rcu_torture_stall end.\n" ); }
Signature · 1 line
2.5.2
PATCH 2/3 rcutorture: Dump writer stack if stalled
In reply to Paul E. McKenneyRight now, rcutorture warns if an rcu_torture_writer() kthread stalls, but this warning is not always all that helpful. This commit therefore makes the first such warning include a stack dump.
This in turn requires that sched_show_task() be exported to GPL modules, so this commit makes that change as well.
--- kernel/rcu/rcutorture.c | 6 ++++++ kernel/sched/core.c | 1 + 2 files changed, 7 insertions(+)
kernel/rcu/rcutorture.c +6 -0
@@ -51,6 +51,7 @@#include <asm/byteorder.h> #include <linux/torture.h> #include <linux/vmalloc.h> +#include <linux/sched/debug.h> #include "rcu.h"
@@ -1240,6 +1241,7 @@ rcu_torture_stats_print(void)long pipesummary[RCU_TORTURE_PIPE_LEN +1 ] = {0 };long batchsummary[RCU_TORTURE_PIPE_LEN +1 ] = {0 };static unsigned long rtcv_snap =ULONG_MAX ; +static bool splatted;struct task_struct *wtp;for_each_possible_cpu (cpu) {
@@ -1325,6 +1327,10 @@ rcu_torture_stats_print(void) gpnum, completed, flags, wtp ==NULL ? ~0UL : wtp->state, wtp == NULL ? -1 : (int)task_cpu(wtp)); +if (!splatted && wtp) { +sched_show_task (wtp); + splatted = true; + }show_rcu_gp_kthreads ();rcu_ftrace_dump (DUMP_ALL ); }
kernel/sched/core.c +1 -0
@@ -5165,6 +5165,7 @@ void sched_show_task(struct task_struct *p)show_stack (p,NULL );put_task_stack (p); } +EXPORT_SYMBOL_GPL (sched_show_task);static inline bool state_filter_match (unsigned long state_filter,struct task_struct *p)
Signature · 1 line
2.5.2
PATCH 3/3 torture: Provide TMPDIR environment variable to specify tmpdir
In reply to Paul E. McKenneyBoth rcutorture and locktorture currently place temporary files in /tmp, in keeping with decades-long tradition. However, sometimes it is useful to specify an alternative temporary directory, for example, for space or performance reasons. This commit therefore causes the torture-test scripting to use the path specified in the TMPDIR environment variable, or to fall back to traditional /tmp if this variable is not set.
--- tools/testing/selftests/rcutorture/bin/config_override.sh | 2 +- tools/testing/selftests/rcutorture/bin/configcheck.sh | 2 +- tools/testing/selftests/rcutorture/bin/configinit.sh | 2 +- tools/testing/selftests/rcutorture/bin/kvm-build.sh | 2 +- tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 2 +- tools/testing/selftests/rcutorture/bin/kvm.sh | 4 ++-- tools/testing/selftests/rcutorture/bin/parse-build.sh | 2 +- tools/testing/selftests/rcutorture/bin/parse-torture.sh | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-)
tools/testing/selftests/rcutorture/bin/config_override.sh +1 -1
@@ -42,7 +42,7 @@ else exit 1 fi -T=/tmp/config_override.sh.$$ +T=${TMPDIR-/tmp}/config_override.sh.$$ trap 'rm -rf $T' 0 mkdir $T
tools/testing/selftests/rcutorture/bin/configcheck.sh +1 -1
@@ -19,7 +19,7 @@ # # Authors: Paul E. McKenney <[email protected]> -T=/tmp/abat-chk-config.sh.$$ +T=${TMPDIR-/tmp}/abat-chk-config.sh.$$ trap 'rm -rf $T' 0 mkdir $T
tools/testing/selftests/rcutorture/bin/configinit.sh +1 -1
@@ -32,7 +32,7 @@ # # Authors: Paul E. McKenney <[email protected]> -T=/tmp/configinit.sh.$$ +T=${TMPDIR-/tmp}/configinit.sh.$$ trap 'rm -rf $T' 0 mkdir $T
tools/testing/selftests/rcutorture/bin/kvm-build.sh +1 -1
@@ -35,7 +35,7 @@ then exit 1 fi -T=/tmp/test-linux.sh.$$ +T=${TMPDIR-/tmp}/test-linux.sh.$$ trap 'rm -rf $T' 0 mkdir $T
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1 -1
@@ -38,7 +38,7 @@ # # Authors: Paul E. McKenney <[email protected]> -T=/tmp/kvm-test-1-run.sh.$$ +T=${TMPDIR-/tmp}/kvm-test-1-run.sh.$$ trap 'rm -rf $T' 0 mkdir $T
tools/testing/selftests/rcutorture/bin/kvm.sh +2 -2
@@ -30,7 +30,7 @@ scriptname=$0 args="$*" -T=/tmp/kvm.sh.$$ +T=${TMPDIR-/tmp}/kvm.sh.$$ trap 'rm -rf $T' 0 mkdir $T
@@ -222,7 +222,7 @@ do exit 1 fi done -sort -k2nr $T/cfgcpu > $T/cfgcpu.sort +sort -k2nr $T/cfgcpu -T="$T" > $T/cfgcpu.sort # Use a greedy bin-packing algorithm, sorting the list accordingly. awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus '
tools/testing/selftests/rcutorture/bin/parse-build.sh +1 -1
@@ -28,7 +28,7 @@ F=$1 title=$2 -T=/tmp/parse-build.sh.$$ +T=${TMPDIR-/tmp}/parse-build.sh.$$ trap 'rm -rf $T' 0 mkdir $T
tools/testing/selftests/rcutorture/bin/parse-torture.sh +1 -1
@@ -27,7 +27,7 @@ # # Authors: Paul E. McKenney <[email protected]> -T=/tmp/parse-torture.sh.$$ +T=${TMPDIR-/tmp}/parse-torture.sh.$$ file="$1" title="$2"
Signature · 1 line
2.5.2