RCU Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH tip/core/rcu 0/9] Torture-test updates
@ 2019-10-03  1:47 Paul E. McKenney
  2019-10-03  1:47 ` [PATCH tip/core/rcu 1/9] rcu: Remove unused function rcutorture_record_progress() paulmck
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Paul E. McKenney @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel

Hello!

This series provides torture-test updates.

1.	Remove unused function rcutorture_record_progress(), courtesy
	of Ethan Hansen.

2.	Replace strncmp() with str_has_prefix(), courtesy of Chuhong Yuan.

3.	Remove CONFIG_HOTPLUG_CPU=n from scenarios.

4.	Emulate dyntick aspect of userspace nohz_full sojourn.

5.	Remove unused variable rcu_perf_writer_state, courtesy of
	Ethan Hansen.

6.	Separate warnings for each failure type.

7.	Make in-kernel-loop testing more brutal.

8.	locktorture: Do not include rwlock.h directly, courtesy of
	Wolfgang M. Reimer.

9.	Suppress levelspread uninitialized messages.

							Thanx, Paul

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

 include/linux/rcutiny.h                                     |    1 
 kernel/locking/locktorture.c                                |    9 +--
 kernel/rcu/rcu.h                                            |    4 -
 kernel/rcu/rcuperf.c                                        |   16 ------
 kernel/rcu/rcutorture.c                                     |   28 +++++++++---
 kernel/rcu/tree.c                                           |    1 
 tools/testing/selftests/rcutorture/configs/rcu/TASKS03      |    3 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE02       |    3 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE04       |    3 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE06       |    3 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE08       |    3 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE09       |    3 -
 tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL      |    3 -
 tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt |    1 
 14 files changed, 29 insertions(+), 52 deletions(-)

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

* [PATCH tip/core/rcu 1/9] rcu: Remove unused function rcutorture_record_progress()
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 2/9] locktorture: Replace strncmp() with str_has_prefix() paulmck
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Ethan Hansen, Paul E . McKenney

From: Ethan Hansen <1ethanhansen@gmail.com>

The function rcutorture_record_progress() is declared in rcu.h, but is
never used.  This commit therefore removes rcutorture_record_progress()
to clean code.

Signed-off-by: Ethan Hansen <1ethanhansen@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 kernel/rcu/rcu.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 8fd4f82..aeec70f 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -455,7 +455,6 @@ enum rcutorture_type {
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
 void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
 			    unsigned long *gp_seq);
-void rcutorture_record_progress(unsigned long vernum);
 void do_trace_rcu_torture_read(const char *rcutorturename,
 			       struct rcu_head *rhp,
 			       unsigned long secs,
@@ -468,7 +467,6 @@ static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
 	*flags = 0;
 	*gp_seq = 0;
 }
-static inline void rcutorture_record_progress(unsigned long vernum) { }
 #ifdef CONFIG_RCU_TRACE
 void do_trace_rcu_torture_read(const char *rcutorturename,
 			       struct rcu_head *rhp,
-- 
2.9.5


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

* [PATCH tip/core/rcu 2/9] locktorture: Replace strncmp() with str_has_prefix()
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
  2019-10-03  1:47 ` [PATCH tip/core/rcu 1/9] rcu: Remove unused function rcutorture_record_progress() paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 3/9] rcutorture: Remove CONFIG_HOTPLUG_CPU=n from scenarios paulmck
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Chuhong Yuan, Paul E . McKenney

From: Chuhong Yuan <hslester96@gmail.com>

The strncmp() function is error-prone because it is easy to get the
length wrong, especially if the string is subject to change, especially
given the need to account for the terminating nul byte.  This commit
therefore substitutes the newly introduced str_has_prefix(), which
does not require a separately specified length.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 kernel/locking/locktorture.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index c513031..8dd9002 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -889,16 +889,16 @@ static int __init lock_torture_init(void)
 		cxt.nrealwriters_stress = 2 * num_online_cpus();
 
 #ifdef CONFIG_DEBUG_MUTEXES
-	if (strncmp(torture_type, "mutex", 5) == 0)
+	if (str_has_prefix(torture_type, "mutex"))
 		cxt.debug_lock = true;
 #endif
 #ifdef CONFIG_DEBUG_RT_MUTEXES
-	if (strncmp(torture_type, "rtmutex", 7) == 0)
+	if (str_has_prefix(torture_type, "rtmutex"))
 		cxt.debug_lock = true;
 #endif
 #ifdef CONFIG_DEBUG_SPINLOCK
-	if ((strncmp(torture_type, "spin", 4) == 0) ||
-	    (strncmp(torture_type, "rw_lock", 7) == 0))
+	if ((str_has_prefix(torture_type, "spin")) ||
+	    (str_has_prefix(torture_type, "rw_lock")))
 		cxt.debug_lock = true;
 #endif
 
-- 
2.9.5


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

* [PATCH tip/core/rcu 3/9] rcutorture: Remove CONFIG_HOTPLUG_CPU=n from scenarios
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
  2019-10-03  1:47 ` [PATCH tip/core/rcu 1/9] rcu: Remove unused function rcutorture_record_progress() paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 2/9] locktorture: Replace strncmp() with str_has_prefix() paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 4/9] rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn paulmck
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@linux.ibm.com>

A number of mainstream CPU families are no longer capable of building
kernels having CONFIG_SMP=y and CONFIG_HOTPLUG_CPU=n, so this commit
removes this combination from the rcutorture scenarios having it.
People wishing to try out this combination may still do so using the
"--kconfig CONFIG_HOTPLUG_CPU=n CONFIG_SUSPEND=n CONFIG_HIBERNATION=n"
argument to the tools/testing/selftests/rcutorture/bin/kvm.sh script
that is used to run rcutorture.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 tools/testing/selftests/rcutorture/configs/rcu/TASKS03      | 3 ---
 tools/testing/selftests/rcutorture/configs/rcu/TREE02       | 3 ---
 tools/testing/selftests/rcutorture/configs/rcu/TREE04       | 3 ---
 tools/testing/selftests/rcutorture/configs/rcu/TREE06       | 3 ---
 tools/testing/selftests/rcutorture/configs/rcu/TREE08       | 3 ---
 tools/testing/selftests/rcutorture/configs/rcu/TREE09       | 3 ---
 tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL      | 3 ---
 tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt | 1 -
 8 files changed, 22 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TASKS03 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS03
index 28568b7..ea43990 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TASKS03
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TASKS03
@@ -1,8 +1,5 @@
 CONFIG_SMP=y
 CONFIG_NR_CPUS=2
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_PREEMPT_NONE=n
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE02 b/tools/testing/selftests/rcutorture/configs/rcu/TREE02
index 35e639e..65daee4 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE02
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE02
@@ -9,9 +9,6 @@ CONFIG_NO_HZ_IDLE=y
 CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_FAST_NO_HZ=n
 CONFIG_RCU_TRACE=n
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=3
 CONFIG_RCU_FANOUT_LEAF=3
 CONFIG_RCU_NOCB_CPU=n
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE04 b/tools/testing/selftests/rcutorture/configs/rcu/TREE04
index 24c9f60..f6d6a40 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE04
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE04
@@ -9,9 +9,6 @@ CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=y
 CONFIG_RCU_FAST_NO_HZ=y
 CONFIG_RCU_TRACE=y
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=4
 CONFIG_RCU_FANOUT_LEAF=3
 CONFIG_DEBUG_LOCK_ALLOC=n
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE06 b/tools/testing/selftests/rcutorture/configs/rcu/TREE06
index 05a4eec..bf4980d 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE06
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE06
@@ -9,9 +9,6 @@ CONFIG_NO_HZ_IDLE=y
 CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_FAST_NO_HZ=n
 CONFIG_RCU_TRACE=n
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=6
 CONFIG_RCU_FANOUT_LEAF=6
 CONFIG_RCU_NOCB_CPU=n
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE08 b/tools/testing/selftests/rcutorture/configs/rcu/TREE08
index fb1c763..c810c52 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE08
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE08
@@ -9,9 +9,6 @@ CONFIG_NO_HZ_IDLE=y
 CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_FAST_NO_HZ=n
 CONFIG_RCU_TRACE=n
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=3
 CONFIG_RCU_FANOUT_LEAF=2
 CONFIG_RCU_NOCB_CPU=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE09 b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
index 6710e74..8523a75 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE09
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
@@ -8,9 +8,6 @@ CONFIG_HZ_PERIODIC=n
 CONFIG_NO_HZ_IDLE=y
 CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_TRACE=n
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_BOOST=n
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL b/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL
index 4d8eb5b..5d546ef 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TRIVIAL
@@ -6,9 +6,6 @@ CONFIG_PREEMPT=n
 CONFIG_HZ_PERIODIC=n
 CONFIG_NO_HZ_IDLE=y
 CONFIG_NO_HZ_FULL=n
-CONFIG_HOTPLUG_CPU=n
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_RCU_EXPERT=y
diff --git a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
index af6fca0..1b96d68 100644
--- a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
+++ b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
@@ -6,7 +6,6 @@ Kconfig Parameters:
 
 CONFIG_DEBUG_LOCK_ALLOC -- Do three, covering CONFIG_PROVE_LOCKING & not.
 CONFIG_DEBUG_OBJECTS_RCU_HEAD -- Do one.
-CONFIG_HOTPLUG_CPU -- Do half.  (Every second.)
 CONFIG_HZ_PERIODIC -- Do one.
 CONFIG_NO_HZ_IDLE -- Do those not otherwise specified. (Groups of two.)
 CONFIG_NO_HZ_FULL -- Do two, one with partial CPU enablement.
-- 
2.9.5


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

* [PATCH tip/core/rcu 4/9] rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
                   ` (2 preceding siblings ...)
  2019-10-03  1:47 ` [PATCH tip/core/rcu 3/9] rcutorture: Remove CONFIG_HOTPLUG_CPU=n from scenarios paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 5/9] rcu: Remove unused variable rcu_perf_writer_state paulmck
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@linux.ibm.com>

During an actual call_rcu() flood, there would be frequent trips to
userspace (in-kernel call_rcu() floods must be otherwise housebroken).
Userspace execution on nohz_full CPUs implies an RCU dyntick idle/not-idle
transition pair, so this commit adds emulation of that pair.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 include/linux/rcutiny.h |  1 +
 kernel/rcu/rcutorture.c | 11 +++++++++++
 kernel/rcu/tree.c       |  1 +
 3 files changed, 13 insertions(+)

diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 9bf1dfe..37b6f0c 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -84,6 +84,7 @@ static inline void rcu_scheduler_starting(void) { }
 #endif /* #else #ifndef CONFIG_SRCU */
 static inline void rcu_end_inkernel_boot(void) { }
 static inline bool rcu_is_watching(void) { return true; }
+static inline void rcu_momentary_dyntick_idle(void) { }
 
 /* Avoid RCU read-side critical sections leaking across. */
 static inline void rcu_all_qs(void) { barrier(); }
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 3c9feca..7dcb2b8 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1759,6 +1759,11 @@ static unsigned long rcu_torture_fwd_prog_cbfree(void)
 		kfree(rfcp);
 		freed++;
 		rcu_torture_fwd_prog_cond_resched(freed);
+		if (tick_nohz_full_enabled()) {
+			local_irq_save(flags);
+			rcu_momentary_dyntick_idle();
+			local_irq_restore(flags);
+		}
 	}
 	return freed;
 }
@@ -1833,6 +1838,7 @@ static void rcu_torture_fwd_prog_nr(int *tested, int *tested_tries)
 static void rcu_torture_fwd_prog_cr(void)
 {
 	unsigned long cver;
+	unsigned long flags;
 	unsigned long gps;
 	int i;
 	long n_launders;
@@ -1891,6 +1897,11 @@ static void rcu_torture_fwd_prog_cr(void)
 		}
 		cur_ops->call(&rfcp->rh, rcu_torture_fwd_cb_cr);
 		rcu_torture_fwd_prog_cond_resched(n_launders + n_max_cbs);
+		if (tick_nohz_full_enabled()) {
+			local_irq_save(flags);
+			rcu_momentary_dyntick_idle();
+			local_irq_restore(flags);
+		}
 	}
 	stoppedat = jiffies;
 	n_launders_cb_snap = READ_ONCE(n_launders_cb);
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 8110514..5692db5 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -375,6 +375,7 @@ static void __maybe_unused rcu_momentary_dyntick_idle(void)
 	WARN_ON_ONCE(!(special & RCU_DYNTICK_CTRL_CTR));
 	rcu_preempt_deferred_qs(current);
 }
+EXPORT_SYMBOL_GPL(rcu_momentary_dyntick_idle);
 
 /**
  * rcu_is_cpu_rrupt_from_idle - see if interrupted from idle
-- 
2.9.5


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

* [PATCH tip/core/rcu 5/9] rcu: Remove unused variable rcu_perf_writer_state
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
                   ` (3 preceding siblings ...)
  2019-10-03  1:47 ` [PATCH tip/core/rcu 4/9] rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 6/9] rcutorture: Separate warnings for each failure type paulmck
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Ethan Hansen, Paul E . McKenney

From: Ethan Hansen <1ethanhansen@gmail.com>

The variable rcu_perf_writer_state is declared and initialized,
but is never actually referenced. Remove it to clean code.

Signed-off-by: Ethan Hansen <1ethanhansen@gmail.com>
[ ethansen: Also removed unused macros assigned to that variable. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 kernel/rcu/rcuperf.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 5a879d0..5f884d5 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -109,15 +109,6 @@ static unsigned long b_rcu_perf_writer_started;
 static unsigned long b_rcu_perf_writer_finished;
 static DEFINE_PER_CPU(atomic_t, n_async_inflight);
 
-static int rcu_perf_writer_state;
-#define RTWS_INIT		0
-#define RTWS_ASYNC		1
-#define RTWS_BARRIER		2
-#define RTWS_EXP_SYNC		3
-#define RTWS_SYNC		4
-#define RTWS_IDLE		5
-#define RTWS_STOPPING		6
-
 #define MAX_MEAS 10000
 #define MIN_MEAS 100
 
@@ -404,25 +395,20 @@ rcu_perf_writer(void *arg)
 			if (!rhp)
 				rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
 			if (rhp && atomic_read(this_cpu_ptr(&n_async_inflight)) < gp_async_max) {
-				rcu_perf_writer_state = RTWS_ASYNC;
 				atomic_inc(this_cpu_ptr(&n_async_inflight));
 				cur_ops->async(rhp, rcu_perf_async_cb);
 				rhp = NULL;
 			} else if (!kthread_should_stop()) {
-				rcu_perf_writer_state = RTWS_BARRIER;
 				cur_ops->gp_barrier();
 				goto retry;
 			} else {
 				kfree(rhp); /* Because we are stopping. */
 			}
 		} else if (gp_exp) {
-			rcu_perf_writer_state = RTWS_EXP_SYNC;
 			cur_ops->exp_sync();
 		} else {
-			rcu_perf_writer_state = RTWS_SYNC;
 			cur_ops->sync();
 		}
-		rcu_perf_writer_state = RTWS_IDLE;
 		t = ktime_get_mono_fast_ns();
 		*wdp = t - *wdp;
 		i_max = i;
@@ -463,10 +449,8 @@ rcu_perf_writer(void *arg)
 		rcu_perf_wait_shutdown();
 	} while (!torture_must_stop());
 	if (gp_async) {
-		rcu_perf_writer_state = RTWS_BARRIER;
 		cur_ops->gp_barrier();
 	}
-	rcu_perf_writer_state = RTWS_STOPPING;
 	writer_n_durations[me] = i_max;
 	torture_kthread_stopping("rcu_perf_writer");
 	return 0;
-- 
2.9.5


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

* [PATCH tip/core/rcu 6/9] rcutorture: Separate warnings for each failure type
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
                   ` (4 preceding siblings ...)
  2019-10-03  1:47 ` [PATCH tip/core/rcu 5/9] rcu: Remove unused variable rcu_perf_writer_state paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 7/9] rcutorture: Make in-kernel-loop testing more brutal paulmck
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@linux.ibm.com>

Currently, each of six different types of failure triggers a
single WARN_ON_ONCE(), and it is then necessary to stare at the
rcu_torture_stats(), Reader Pipe, and Reader Batch lines looking for
inappropriately non-zero values.  This can be annoying and error-prone,
so this commit provides a separate WARN_ON_ONCE() for each of the
six error conditions and adds short comments to each to ease error
identification.

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

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 7dcb2b8..a9e97c3 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1442,15 +1442,18 @@ rcu_torture_stats_print(void)
 		n_rcu_torture_barrier_error);
 
 	pr_alert("%s%s ", torture_type, TORTURE_FLAG);
-	if (atomic_read(&n_rcu_torture_mberror) != 0 ||
-	    n_rcu_torture_barrier_error != 0 ||
-	    n_rcu_torture_boost_ktrerror != 0 ||
-	    n_rcu_torture_boost_rterror != 0 ||
-	    n_rcu_torture_boost_failure != 0 ||
+	if (atomic_read(&n_rcu_torture_mberror) ||
+	    n_rcu_torture_barrier_error || n_rcu_torture_boost_ktrerror ||
+	    n_rcu_torture_boost_rterror || n_rcu_torture_boost_failure ||
 	    i > 1) {
 		pr_cont("%s", "!!! ");
 		atomic_inc(&n_rcu_torture_error);
-		WARN_ON_ONCE(1);
+		WARN_ON_ONCE(atomic_read(&n_rcu_torture_mberror));
+		WARN_ON_ONCE(n_rcu_torture_barrier_error);  // rcu_barrier()
+		WARN_ON_ONCE(n_rcu_torture_boost_ktrerror); // no boost kthread
+		WARN_ON_ONCE(n_rcu_torture_boost_rterror); // can't set RT prio
+		WARN_ON_ONCE(n_rcu_torture_boost_failure); // RCU boost failed
+		WARN_ON_ONCE(i > 1); // Too-short grace period
 	}
 	pr_cont("Reader Pipe: ");
 	for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)
-- 
2.9.5


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

* [PATCH tip/core/rcu 7/9] rcutorture: Make in-kernel-loop testing more brutal
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
                   ` (5 preceding siblings ...)
  2019-10-03  1:47 ` [PATCH tip/core/rcu 6/9] rcutorture: Separate warnings for each failure type paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 8/9] locking: locktorture: Do not include rwlock.h directly paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages paulmck
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@linux.ibm.com>

The rcu_torture_fwd_prog_nr() tests the ability of RCU to tolerate
in-kernel busy loops.  It invokes rcu_torture_fwd_prog_cond_resched()
within its delay loop, which, in PREEMPT && NO_HZ_FULL kernels results
in the occasional direct call to schedule().  Now, this direct call to
schedule() is appropriate for call_rcu() flood testing, in which either
the kernel should restrain itself or userspace transitions will supply
the needed restraint.  But in pure in-kernel loops, the occasional
cond_resched() should do the job.

This commit therefore makes rcu_torture_fwd_prog_nr() use cond_resched()
instead of rcu_torture_fwd_prog_cond_resched() in order to increase the
brutality of this aspect of rcutorture testing.

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

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index a9e97c3..f1339ee 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1811,7 +1811,7 @@ static void rcu_torture_fwd_prog_nr(int *tested, int *tested_tries)
 		udelay(10);
 		cur_ops->readunlock(idx);
 		if (!fwd_progress_need_resched || need_resched())
-			rcu_torture_fwd_prog_cond_resched(1);
+			cond_resched();
 	}
 	(*tested_tries)++;
 	if (!time_before(jiffies, stopat) &&
-- 
2.9.5


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

* [PATCH tip/core/rcu 8/9] locking: locktorture: Do not include rwlock.h directly
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
                   ` (6 preceding siblings ...)
  2019-10-03  1:47 ` [PATCH tip/core/rcu 7/9] rcutorture: Make in-kernel-loop testing more brutal paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  1:47 ` [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages paulmck
  8 siblings, 0 replies; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Wolfgang M. Reimer,
	Sebastian Andrzej Siewior, Paul E . McKenney

From: "Wolfgang M. Reimer" <linuxball@gmail.com>

Including rwlock.h directly will cause kernel builds to fail
if CONFIG_PREEMPT_RT is defined. The correct header file
(rwlock_rt.h OR rwlock.h) will be included by spinlock.h which
is included by locktorture.c anyway.

Remove the include of linux/rwlock.h.

Signed-off-by: Wolfgang M. Reimer <linuxball@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/locking/locktorture.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 8dd9002..99475a6 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -16,7 +16,6 @@
 #include <linux/kthread.h>
 #include <linux/sched/rt.h>
 #include <linux/spinlock.h>
-#include <linux/rwlock.h>
 #include <linux/mutex.h>
 #include <linux/rwsem.h>
 #include <linux/smp.h>
-- 
2.9.5


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

* [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages
  2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
                   ` (7 preceding siblings ...)
  2019-10-03  1:47 ` [PATCH tip/core/rcu 8/9] locking: locktorture: Do not include rwlock.h directly paulmck
@ 2019-10-03  1:47 ` paulmck
  2019-10-03  8:53   ` Geert Uytterhoeven
  8 siblings, 1 reply; 12+ messages in thread
From: paulmck @ 2019-10-03  1:47 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney

From: "Paul E. McKenney" <paulmck@kernel.org>

New tools bring new warnings, and with v5.3 comes:

kernel/rcu/srcutree.c: warning: 'levelspread[<U aa0>]' may be used uninitialized in this function [-Wuninitialized]:  => 121:34

This commit suppresses this warning by initializing the full array
to INT_MIN, which will result in failures should any out-of-bounds
references appear.

Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/rcu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index aeec70f..ab504fb 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -299,6 +299,8 @@ static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt)
 {
 	int i;
 
+	for (i = 0; i < RCU_NUM_LVLS; i++)
+		levelspread[i] = INT_MIN;
 	if (rcu_fanout_exact) {
 		levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
 		for (i = rcu_num_lvls - 2; i >= 0; i--)
-- 
2.9.5


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

* Re: [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages
  2019-10-03  1:47 ` [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages paulmck
@ 2019-10-03  8:53   ` Geert Uytterhoeven
  2019-10-05 16:16     ` Paul E. McKenney
  0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2019-10-03  8:53 UTC (permalink / raw)
  To: paulmck
  Cc: rcu, Linux Kernel Mailing List, Ingo Molnar, Lai Jiangshan,
	dipankar, Andrew Morton, Mathieu Desnoyers, Josh Triplett,
	Thomas Gleixner, Peter Zijlstra, Steven Rostedt, David Howells,
	Eric Dumazet, Frederic Weisbecker, Oleg Nesterov, Joel Fernandes

Hi Paul,

On Thu, Oct 3, 2019 at 3:49 AM <paulmck@kernel.org> wrote:
> From: "Paul E. McKenney" <paulmck@kernel.org>
>
> New tools bring new warnings, and with v5.3 comes:

According to the kisskb build logs, it happens with gcc 4.6.3 only ;-)

> kernel/rcu/srcutree.c: warning: 'levelspread[<U aa0>]' may be used uninitialized in this function [-Wuninitialized]:  => 121:34
>
> This commit suppresses this warning by initializing the full array
> to INT_MIN, which will result in failures should any out-of-bounds
> references appear.
>
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
(for the initialization loop, not for the actual INT_MIN value)

Unfortunately I don't have a gcc-4.6.3 Linux cross-compiler anymore.
I tried with msp430-gcc-4.6.3 and some hackery to get it to compile,
but that didn't let me reproduce the warning.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages
  2019-10-03  8:53   ` Geert Uytterhoeven
@ 2019-10-05 16:16     ` Paul E. McKenney
  0 siblings, 0 replies; 12+ messages in thread
From: Paul E. McKenney @ 2019-10-05 16:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: rcu, Linux Kernel Mailing List, Ingo Molnar, Lai Jiangshan,
	dipankar, Andrew Morton, Mathieu Desnoyers, Josh Triplett,
	Thomas Gleixner, Peter Zijlstra, Steven Rostedt, David Howells,
	Eric Dumazet, Frederic Weisbecker, Oleg Nesterov, Joel Fernandes

On Thu, Oct 03, 2019 at 10:53:03AM +0200, Geert Uytterhoeven wrote:
> Hi Paul,
> 
> On Thu, Oct 3, 2019 at 3:49 AM <paulmck@kernel.org> wrote:
> > From: "Paul E. McKenney" <paulmck@kernel.org>
> >
> > New tools bring new warnings, and with v5.3 comes:
> 
> According to the kisskb build logs, it happens with gcc 4.6.3 only ;-)
> 
> > kernel/rcu/srcutree.c: warning: 'levelspread[<U aa0>]' may be used uninitialized in this function [-Wuninitialized]:  => 121:34
> >
> > This commit suppresses this warning by initializing the full array
> > to INT_MIN, which will result in failures should any out-of-bounds
> > references appear.
> >
> > Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> 
> Thanks for your patch!
> 
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> (for the initialization loop, not for the actual INT_MIN value)

Applied, thank you!

> Unfortunately I don't have a gcc-4.6.3 Linux cross-compiler anymore.
> I tried with msp430-gcc-4.6.3 and some hackery to get it to compile,
> but that didn't let me reproduce the warning.

OK, please let me know when gcc-4.6.3 is old enough that this patch
should be reverted.  Or just submit the revert at that point, as the
case may be.  ;-)

							Thanx, Paul

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

end of thread, back to index

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-03  1:47 [PATCH tip/core/rcu 0/9] Torture-test updates Paul E. McKenney
2019-10-03  1:47 ` [PATCH tip/core/rcu 1/9] rcu: Remove unused function rcutorture_record_progress() paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 2/9] locktorture: Replace strncmp() with str_has_prefix() paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 3/9] rcutorture: Remove CONFIG_HOTPLUG_CPU=n from scenarios paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 4/9] rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 5/9] rcu: Remove unused variable rcu_perf_writer_state paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 6/9] rcutorture: Separate warnings for each failure type paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 7/9] rcutorture: Make in-kernel-loop testing more brutal paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 8/9] locking: locktorture: Do not include rwlock.h directly paulmck
2019-10-03  1:47 ` [PATCH tip/core/rcu 9/9] rcu: Suppress levelspread uninitialized messages paulmck
2019-10-03  8:53   ` Geert Uytterhoeven
2019-10-05 16:16     ` Paul E. McKenney

RCU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/rcu/0 rcu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 rcu rcu/ https://lore.kernel.org/rcu \
		rcu@vger.kernel.org rcu@archiver.kernel.org
	public-inbox-index rcu

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.rcu


AGPL code for this site: git clone https://public-inbox.org/ public-inbox