Torture-test updates for 4.9
Subsystems (2)
cover Torture-test updates for 4.9
Hello!
This series provides some torture-test updates:
1. Convert torture_shutdown() to hrtimer to avoid new-age
timer-wheel inaccuracies.
2. Add task state to writer-task stall printk()s.
3. Print out barrier error as documentation says, courtesy of
SeongJae Park.
4. Insert space between flag and message consistently in rcuperf,
courtesy of SeongJae Park.
5. Insert space between flag and message consistently in rcutorture
and locktorture, courtesy of SeongJae Park.
Thanx, Paul
------------------------------------------------------------------------
include/linux/torture.h | 2 +- kernel/rcu/rcuperf.c | 7 +++---- kernel/rcu/rcutorture.c | 10 +++++++--- kernel/torture.c | 27 +++++++++++++-------------- 4 files changed, 24 insertions(+), 22 deletions(-)
PATCH 1/5 torture: Convert torture_shutdown() to hrtimer
Upcoming changes to the timer wheel introduce significant inaccuracy and possibly also an ultimate limit on timeout duration. This is a problem for the current implementation of torture_shutdown() because
(1) shutdown times are user-specified, and can therefore be quite long, and (2) the torture scripting will kill a test instance that runs for more than a few minutes longer than scheduled. This commit therefore converts the torture_shutdown() timed waits to an hrtimer.
--- kernel/torture.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
kernel/torture.c +13 -14
@@ -43,6 +43,7 @@#include <linux/stat.h> #include <linux/slab.h> #include <linux/trace_clock.h> +#include <linux/ktime.h> #include <asm/byteorder.h> #include <linux/torture.h>
@@ -446,9 +447,8 @@ EXPORT_SYMBOL_GPL(torture_shuffle_cleanup);* Variables for auto-shutdown. This allows "lights out" torture runs * to be fully scripted. */ -static int shutdown_secs;/* desired test duration in seconds. */ static struct task_struct *shutdown_task; -static unsigned long shutdown_time;/* jiffies to system shutdown. */ +static ktime_t shutdown_time;/* time to system shutdown. */ static void (*torture_shutdown_hook)(void );/*
@@ -471,20 +471,20 @@ EXPORT_SYMBOL_GPL(torture_shutdown_absorb);*/ static int torture_shutdown (void *arg) { -long delta; -unsigned long jiffies_snap; +ktime_t ktime_snap;VERBOSE_TOROUT_STRING ("torture_shutdown task started" ); - jiffies_snap = jiffies; -while (ULONG_CMP_LT (jiffies_snap, shutdown_time) && + ktime_snap =ktime_get (); +while (ktime_before (ktime_snap, shutdown_time) && !torture_must_stop ()) { - delta = shutdown_time - jiffies_snap;if (verbose)pr_alert ("%s" TORTURE_FLAG -"torture_shutdown task: %lu jiffies remaining\n" , - torture_type, delta); -schedule_timeout_interruptible (delta); - jiffies_snap = jiffies; +"torture_shutdown task: %llu ms remaining\n" , + torture_type, +ktime_ms_delta (shutdown_time, ktime_snap)); +set_current_state (TASK_INTERRUPTIBLE ); +schedule_hrtimeout (&shutdown_time,HRTIMER_MODE_ABS ); + ktime_snap =ktime_get (); }if (torture_must_stop ()) {torture_kthread_stopping ("torture_shutdown" );
@@ -511,10 +511,9 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void)) {int ret =0 ; - shutdown_secs = ssecs; torture_shutdown_hook = cleanup; -if (shutdown_secs >0 ) { - shutdown_time = jiffies + shutdown_secs *HZ ; +if (ssecs >0 ) { + shutdown_time =ktime_add (ktime_get (),ktime_set (ssecs,0 )); ret =torture_create_kthread (torture_shutdown,NULL , shutdown_task); }
Signature · 1 line
2.5.2
PATCH 2/5 torture: Add task state to writer-task stall printk()s
In reply to Paul E. McKenneyThis commit adds a dump of the scheduler state for stalled rcutorture writer tasks. Yet another addition of debug for the intermittent failures to proceed, where grace periods move ahead but the rcutorture writer tasks fail to do so.
--- kernel/rcu/rcutorture.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/rcu/rcutorture.c +5 -2
@@ -1238,6 +1238,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 ; +struct task_struct *wtp;for_each_possible_cpu (cpu) {for (i =0 ; i <RCU_TORTURE_PIPE_LEN +1 ; i++) {
@@ -1312,10 +1313,12 @@ rcu_torture_stats_print(void)rcutorture_get_gp_data (cur_ops->ttype, &flags, &gpnum, &completed); -pr_alert ("??? Writer stall state %s(%d) g%lu c%lu f%#x\n" , + wtp =READ_ONCE (writer_task); +pr_alert ("??? Writer stall state %s(%d) g%lu c%lu f%#x ->state %#lx\n" ,rcu_torture_writer_state_getname (), rcu_torture_writer_state, - gpnum, completed, flags); + gpnum, completed, flags, + wtp ==NULL ? ~0UL : wtp->state);show_rcu_gp_kthreads ();rcu_ftrace_dump (DUMP_ALL ); }
Signature · 1 line
2.5.2
PATCH 3/5 rcutorture: Print out barrier error as document says
In reply to Paul E. McKenneyFrom: SeongJae Park <[email protected]>
Test for rcu_barrier() has introduced by commit fae4b54f28f0 ("rcu:
Introduce rcutorture testing for rcu_barrier()"). Updated document says that rtbe field of output indicates failure of the test. However, the code has not updated as so. This commit updates the code to print out the field as document says.
--- kernel/rcu/rcutorture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rcu/rcutorture.c +2 -1
@@ -1259,8 +1259,9 @@ rcu_torture_stats_print(void)atomic_read (&n_rcu_torture_alloc),atomic_read (&n_rcu_torture_alloc_fail), atomic_read(&n_rcu_torture_free)); -pr_cont ("rtmbe: %d rtbke: %ld rtbre: %ld " , +pr_cont ("rtmbe: %d rtbe: %ld rtbke: %ld rtbre: %ld " ,atomic_read (&n_rcu_torture_mberror), + n_rcu_torture_barrier_error, n_rcu_torture_boost_ktrerror, n_rcu_torture_boost_rterror); pr_cont("rtbf: %ld rtb: %ld nt: %ld ",
Signature · 1 line
2.5.2
PATCH 4/5 rcuperf: Insert space between flag and message consistently
In reply to Paul E. McKenneyFrom: SeongJae Park <[email protected]>
Few output messages of rcuperf has no space between flag and start of message while every other messages keeps a space consistently. It makes output messages to be inconsistent and weird especially when it be read by dmesg with color option enabled. This commit fixes the problem by modifying a pr_alert() call and PERFOUT_STRING() macro function.
--- kernel/rcu/rcuperf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/rcu/rcuperf.c +3 -4
@@ -52,7 +52,7 @@ MODULE_AUTHOR("Paul E. McKenney <[email protected]>");#define PERF_FLAG "-perf:"#define PERFOUT_STRING (s) \ - pr_alert("%s" PERF_FLAG s "\n", perf_type) + pr_alert("%s" PERF_FLAG " %s\n", perf_type, s)#define VERBOSE_PERFOUT_STRING (s) \ do { if (verbose) pr_alert("%s" PERF_FLAG " %s\n", perf_type, s); } while (0)#define VERBOSE_PERFOUT_ERRSTRING (s) \
@@ -400,9 +400,8 @@ rcu_perf_writer(void *arg) sp.sched_priority =0 ;sched_setscheduler_nocheck (current,SCHED_NORMAL , &sp); -pr_alert ("%s" PERF_FLAG -"rcu_perf_writer %ld has %d measurements\n" , - perf_type, me,MIN_MEAS ); +pr_alert ("%s%s rcu_perf_writer %ld has %d measurements\n" , + perf_type,PERF_FLAG , me,MIN_MEAS );if (atomic_inc_return (&n_rcu_perf_writer_finished) >= nrealwriters) {schedule_timeout_interruptible (10 );
Signature · 1 line
2.5.2
PATCH 5/5 torture: TOROUT_STRING(): Insert a space between flag and message
In reply to Paul E. McKenneyFrom: SeongJae Park <[email protected]>
TOROUT_STRING() macro function does not insert a space between flag and message while other similar couterparts do. The output will be inconsistent and weird especially when it is read by dmesg with color option enabled. This commit adds an space between flag and message in TOROUT_STRING() output.
--- include/linux/torture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/torture.h +1 -1
@@ -43,7 +43,7 @@#define TORTURE_FLAG "-torture:"#define TOROUT_STRING (s) \ - pr_alert("%s" TORTURE_FLAG s "\n", torture_type) + pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s)#define VERBOSE_TOROUT_STRING (s) \ do { if (verbose) pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s); } while (0)#define VERBOSE_TOROUT_ERRSTRING (s) \
Signature · 1 line
2.5.2