All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9
@ 2016-08-22 15:54 Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 1/5] torture: Convert torture_shutdown() to hrtimer Paul E. McKenney
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Paul E. McKenney @ 2016-08-22 15:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec,
	oleg, bobby.prani

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(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH tip/core/rcu 1/5] torture: Convert torture_shutdown() to hrtimer
  2016-08-22 15:54 [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9 Paul E. McKenney
@ 2016-08-22 15:54 ` Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 2/5] torture: Add task state to writer-task stall printk()s Paul E. McKenney
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2016-08-22 15:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec,
	oleg, bobby.prani, Paul E. McKenney

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.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/torture.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/kernel/torture.c b/kernel/torture.c
index 75961b3decfe..0d887eb62856 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -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);
 	}
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH tip/core/rcu 2/5] torture: Add task state to writer-task stall printk()s
  2016-08-22 15:54 [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9 Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 1/5] torture: Convert torture_shutdown() to hrtimer Paul E. McKenney
@ 2016-08-22 15:54 ` Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 3/5] rcutorture: Print out barrier error as document says Paul E. McKenney
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2016-08-22 15:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec,
	oleg, bobby.prani, Paul E. McKenney

This 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.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/rcutorture.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 971e2b138063..f0f32f888ec5 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -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);
 	}
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH tip/core/rcu 3/5] rcutorture: Print out barrier error as document says
  2016-08-22 15:54 [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9 Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 1/5] torture: Convert torture_shutdown() to hrtimer Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 2/5] torture: Add task state to writer-task stall printk()s Paul E. McKenney
@ 2016-08-22 15:54 ` Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 4/5] rcuperf: Insert space between flag and message consistently Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 5/5] torture: TOROUT_STRING(): Insert a space between flag and message Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2016-08-22 15:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec,
	oleg, bobby.prani, SeongJae Park, Paul E. McKenney

From: SeongJae Park <sj38.park@gmail.com>

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.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/rcutorture.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index f0f32f888ec5..ac29017623e5 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -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 ",
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH tip/core/rcu 4/5] rcuperf: Insert space between flag and message consistently
  2016-08-22 15:54 [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9 Paul E. McKenney
                   ` (2 preceding siblings ...)
  2016-08-22 15:54 ` [PATCH tip/core/rcu 3/5] rcutorture: Print out barrier error as document says Paul E. McKenney
@ 2016-08-22 15:54 ` Paul E. McKenney
  2016-08-22 15:54 ` [PATCH tip/core/rcu 5/5] torture: TOROUT_STRING(): Insert a space between flag and message Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2016-08-22 15:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec,
	oleg, bobby.prani, SeongJae Park, Paul E. McKenney

From: SeongJae Park <sj38.park@gmail.com>

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.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/rcuperf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index d38ab08a3fe7..123ccbd22449 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -52,7 +52,7 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck@linux.vnet.ibm.com>");
 
 #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);
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH tip/core/rcu 5/5] torture: TOROUT_STRING(): Insert a space between flag and message
  2016-08-22 15:54 [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9 Paul E. McKenney
                   ` (3 preceding siblings ...)
  2016-08-22 15:54 ` [PATCH tip/core/rcu 4/5] rcuperf: Insert space between flag and message consistently Paul E. McKenney
@ 2016-08-22 15:54 ` Paul E. McKenney
  4 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2016-08-22 15:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec,
	oleg, bobby.prani, SeongJae Park, Paul E. McKenney

From: SeongJae Park <sj38.park@gmail.com>

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.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/torture.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/torture.h b/include/linux/torture.h
index 6685a73736a2..a45702eb3e7b 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -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) \
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-22 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22 15:54 [PATCH tip/core/rcu 0/5] Torture-test updates for 4.9 Paul E. McKenney
2016-08-22 15:54 ` [PATCH tip/core/rcu 1/5] torture: Convert torture_shutdown() to hrtimer Paul E. McKenney
2016-08-22 15:54 ` [PATCH tip/core/rcu 2/5] torture: Add task state to writer-task stall printk()s Paul E. McKenney
2016-08-22 15:54 ` [PATCH tip/core/rcu 3/5] rcutorture: Print out barrier error as document says Paul E. McKenney
2016-08-22 15:54 ` [PATCH tip/core/rcu 4/5] rcuperf: Insert space between flag and message consistently Paul E. McKenney
2016-08-22 15:54 ` [PATCH tip/core/rcu 5/5] torture: TOROUT_STRING(): Insert a space between flag and message Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.