linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 0/8] random RCU fixes and updates
@ 2010-09-23  0:50 Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 1/8] rcu: upgrade stallwarn.txt documentation for CPU-bound RT processes Paul E. McKenney
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet

Hello!

This patchset contains fixes for problems identified in -next testing
and some statistics and documentation updates.  The patches are as follows:

1.	Update stallwarn.txt to include stall warnings caused by
	real-time processes (yes, even in mainline kernels).
2.	Fix some performance bugs in TINY_PREEMPT_RCU.
3.	Fix an overactive rcu_bootup_announce_oddness() warning.
4.	Eliminate a redundant #ifdef (from Christian Dietrich).
5.	Fix the new sparse-aware primitives to correctly handle
	macro arguments with side effects.
6.	Fix some issues sparse found in rcutorture.c.
7.	Add some tracing data to help compute estimates of how long
	RCU callbacks are queued.
8.	Fix up the Kconfig message for PROVE_RCU_REPEATEDLY.

For a testing-only version of this patchset from git, please see:

git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git rcu/testing

							Thanx, Paul

 Documentation/RCU/stallwarn.txt |   18 ++++++++++++++++++
 Documentation/RCU/trace.txt     |   13 ++++++++++++-
 include/linux/rcupdate.h        |   14 +++++++++++---
 kernel/rcutiny_plugin.h         |   12 ++++++++----
 kernel/rcutorture.c             |    8 +++++---
 kernel/rcutree.c                |    3 +++
 kernel/rcutree.h                |    3 +++
 kernel/rcutree_plugin.h         |    2 +-
 kernel/rcutree_trace.c          |   10 +++++++---
 kernel/srcu.c                   |    2 --
 lib/Kconfig.debug               |    4 ++++
 11 files changed, 72 insertions(+), 17 deletions(-)

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

* [PATCH tip/core/rcu 1/8] rcu: upgrade stallwarn.txt documentation for CPU-bound RT processes
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 2/8] rcu: performance fixes to TINY_PREEMPT_RCU callback checking Paul E. McKenney
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney

CPU-bound real-time processes can cause RCU CPU stall warnings, and
much other trouble as well.  Document the fact that they can cause
RCU CPU stall warnings.

Suggested-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 Documentation/RCU/stallwarn.txt |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/Documentation/RCU/stallwarn.txt b/Documentation/RCU/stallwarn.txt
index 44c6dcc..862c08e 100644
--- a/Documentation/RCU/stallwarn.txt
+++ b/Documentation/RCU/stallwarn.txt
@@ -80,6 +80,24 @@ o	A CPU looping with bottom halves disabled.  This condition can
 o	For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel
 	without invoking schedule().
 
+o	A CPU-bound real-time task in a CONFIG_PREEMPT kernel, which might
+	happen to preempt a low-priority task in the middle of an RCU
+	read-side critical section.   This is especially damaging if
+	that low-priority task is not permitted to run on any other CPU,
+	in which case the next RCU grace period can never complete, which
+	will eventually cause the system to run out of memory and hang.
+	While the system is in the process of running itself out of
+	memory, you might see stall-warning messages.
+
+o	A CPU-bound real-time task in a CONFIG_PREEMPT_RT kernel that
+	is running at a higher priority than the RCU softirq threads.
+	This will prevent RCU callbacks from ever being invoked,
+	and in a CONFIG_TREE_PREEMPT_RCU kernel will further prevent
+	RCU grace periods from ever completing.  Either way, the
+	system will eventually run out of memory and hang.  In the
+	CONFIG_TREE_PREEMPT_RCU case, you might see stall-warning
+	messages.
+
 o	A bug in the RCU implementation.
 
 o	A hardware failure.  This is quite unlikely, but has occurred
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 2/8] rcu: performance fixes to TINY_PREEMPT_RCU callback checking
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 1/8] rcu: upgrade stallwarn.txt documentation for CPU-bound RT processes Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 3/8] rcu: fix _oddness handling of verbose stall warnings Paul E. McKenney
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney

This commit tightens up checks in rcu_preempt_check_callbacks() to avoid
unnecessary special handling at rcu_read_unlock() time.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutiny_plugin.h |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
index c5bea11..6ceca4f 100644
--- a/kernel/rcutiny_plugin.h
+++ b/kernel/rcutiny_plugin.h
@@ -72,7 +72,7 @@ static void rcu_report_exp_done(void);
 /*
  * Return true if the CPU has not yet responded to the current grace period.
  */
-static int rcu_cpu_cur_gp(void)
+static int rcu_cpu_blocking_cur_gp(void)
 {
 	return rcu_preempt_ctrlblk.gpcpu != rcu_preempt_ctrlblk.gpnum;
 }
@@ -229,7 +229,7 @@ void rcu_preempt_note_context_switch(void)
 		 * cannot end.
 		 */
 		list_add(&t->rcu_node_entry, &rcu_preempt_ctrlblk.blkd_tasks);
-		if (rcu_cpu_cur_gp())
+		if (rcu_cpu_blocking_cur_gp())
 			rcu_preempt_ctrlblk.gp_tasks = &t->rcu_node_entry;
 	}
 
@@ -368,12 +368,16 @@ static void rcu_preempt_check_callbacks(void)
 {
 	struct task_struct *t = current;
 
-	if (!rcu_preempt_running_reader() && rcu_preempt_gp_in_progress())
+	if (rcu_preempt_gp_in_progress() &&
+	    (!rcu_preempt_running_reader() ||
+	     !rcu_cpu_blocking_cur_gp()))
 		rcu_preempt_cpu_qs();
 	if (&rcu_preempt_ctrlblk.rcb.rcucblist !=
 	    rcu_preempt_ctrlblk.rcb.donetail)
 		raise_softirq(RCU_SOFTIRQ);
-	if (rcu_preempt_gp_in_progress() && rcu_preempt_running_reader())
+	if (rcu_preempt_gp_in_progress() &&
+	    rcu_cpu_blocking_cur_gp() &&
+	    rcu_preempt_running_reader())
 		t->rcu_read_unlock_special |= RCU_READ_UNLOCK_NEED_QS;
 }
 
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 3/8] rcu: fix _oddness handling of verbose stall warnings
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 1/8] rcu: upgrade stallwarn.txt documentation for CPU-bound RT processes Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 2/8] rcu: performance fixes to TINY_PREEMPT_RCU callback checking Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 4/8] kernel: Removing undead ifdef CONFIG_DEBUG_LOCK_ALLOC Paul E. McKenney
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney

CONFIG_RCU_CPU_STALL_VERBOSE depends on CONFIG_TREE_PREEMPT_RCU, but
rcu_bootup_announce_oddness() complains if CONFIG_RCU_CPU_STALL_VERBOSE
is not set even in the case of CONFIG_TREE_RCU.  This commit therefore
fixes rcu_bootup_announce_oddness() to avoid insisting on impossibilities.

Reported-by: Guy Martin <gmsoft@tuxicoman.be>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree_plugin.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index e9e0bc7..71a4147 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -57,7 +57,7 @@ static void __init rcu_bootup_announce_oddness(void)
 	printk(KERN_INFO
 	       "\tRCU-based detection of stalled CPUs is disabled.\n");
 #endif
-#ifndef CONFIG_RCU_CPU_STALL_VERBOSE
+#if defined(CONFIG_TREE_PREEMPT_RCU) && !defined(CONFIG_RCU_CPU_STALL_VERBOSE)
 	printk(KERN_INFO "\tVerbose stalled-CPUs detection is disabled.\n");
 #endif
 #if NUM_RCU_LVL_4 != 0
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 4/8] kernel: Removing undead ifdef CONFIG_DEBUG_LOCK_ALLOC
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
                   ` (2 preceding siblings ...)
  2010-09-23  0:50 ` [PATCH tip/core/rcu 3/8] rcu: fix _oddness handling of verbose stall warnings Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse Paul E. McKenney
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Christian Dietrich, Paul E. McKenney

From: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>

The CONFIG_DEBUG_LOCK_ALLOC ifdef isn't necessary at this point, because it is
checked in an outer ifdef level already and has no effect here.

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/srcu.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/kernel/srcu.c b/kernel/srcu.c
index 2980da3..c71e075 100644
--- a/kernel/srcu.c
+++ b/kernel/srcu.c
@@ -46,11 +46,9 @@ static int init_srcu_struct_fields(struct srcu_struct *sp)
 int __init_srcu_struct(struct srcu_struct *sp, const char *name,
 		       struct lock_class_key *key)
 {
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
 	/* Don't re-initialize a lock while it is held. */
 	debug_check_no_locks_freed((void *)sp, sizeof(*sp));
 	lockdep_init_map(&sp->dep_map, name, key, 0);
-#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
 	return init_srcu_struct_fields(sp);
 }
 EXPORT_SYMBOL_GPL(__init_srcu_struct);
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
                   ` (3 preceding siblings ...)
  2010-09-23  0:50 ` [PATCH tip/core/rcu 4/8] kernel: Removing undead ifdef CONFIG_DEBUG_LOCK_ALLOC Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23 13:13   ` Arnd Bergmann
  2010-09-23  0:50 ` [PATCH tip/core/rcu 6/8] rcu: fix sparse errors in rcutorture.c Paul E. McKenney
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney, Arnd Bergmann

The current version of the __rcu_access_pointer(), __rcu_dereference_check(),
and __rcu_dereference_protected() macros evaluate their "p" argument
three times, not counting typeof()s.  This is bad news if that argument
contains a side effect.  This commit therefore evaluates this argument
only once in normal kernel builds.  However, the straightforward approach
defeats sparse's RCU-pointer checking, so when __CHECKER__ is defined,
the additional pair of evaluations of the "p" argument are performed in
order to permit sparse to detect misuse of RCU-protected pointers.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/rcupdate.h |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 89414d6..03cda7b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -310,24 +310,32 @@ extern int rcu_my_thread_group_empty(void);
  * (e.g., __rcu_bh, * __rcu_sched, and __srcu), should this make sense in
  * the future.
  */
+
+#ifdef __CHECKER__
+#define rcu_dereference_sparse(p, space) \
+	((void)(((typeof(*p) space *)p) == p))
+#else /* #ifdef __CHECKER__ */
+#define rcu_dereference_sparse(p, space)
+#endif /* #else #ifdef __CHECKER__ */
+
 #define __rcu_access_pointer(p, space) \
 	({ \
 		typeof(*p) *_________p1 = (typeof(*p)*__force )ACCESS_ONCE(p); \
-		(void) (((typeof (*p) space *)p) == p); \
+		rcu_dereference_sparse(p, space); \
 		((typeof(*p) __force __kernel *)(_________p1)); \
 	})
 #define __rcu_dereference_check(p, c, space) \
 	({ \
 		typeof(*p) *_________p1 = (typeof(*p)*__force )ACCESS_ONCE(p); \
 		rcu_lockdep_assert(c); \
-		(void) (((typeof (*p) space *)p) == p); \
+		rcu_dereference_sparse(p, space); \
 		smp_read_barrier_depends(); \
 		((typeof(*p) __force __kernel *)(_________p1)); \
 	})
 #define __rcu_dereference_protected(p, c, space) \
 	({ \
 		rcu_lockdep_assert(c); \
-		(void) (((typeof (*p) space *)p) == p); \
+		rcu_dereference_sparse(p, space); \
 		((typeof(*p) __force __kernel *)(p)); \
 	})
 
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 6/8] rcu: fix sparse errors in rcutorture.c
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
                   ` (4 preceding siblings ...)
  2010-09-23  0:50 ` [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 7/8] rcu: Add tracing data to support queueing models Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 8/8] rcu: Add advice to PROVE_RCU_REPEATEDLY kernel config parameter Paul E. McKenney
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney

Add the sparse __rcu address-space identifier and make a couple of
variables static.

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

diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index 7297102..9afa047 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -120,7 +120,7 @@ struct rcu_torture {
 };
 
 static LIST_HEAD(rcu_torture_freelist);
-static struct rcu_torture *rcu_torture_current;
+static struct rcu_torture __rcu *rcu_torture_current;
 static long rcu_torture_current_version;
 static struct rcu_torture rcu_tortures[10 * RCU_TORTURE_PIPE_LEN];
 static DEFINE_SPINLOCK(rcu_torture_lock);
@@ -153,7 +153,8 @@ int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT;
 #define FULLSTOP_SHUTDOWN 1	/* System shutdown with rcutorture running. */
 #define FULLSTOP_RMMOD    2	/* Normal rmmod of rcutorture. */
 static int fullstop = FULLSTOP_RMMOD;
-DEFINE_MUTEX(fullstop_mutex);	/* Protect fullstop transitions and spawning */
+static DEFINE_MUTEX(fullstop_mutex);
+				/* Protect fullstop transitions and spawning */
 				/*  of kthreads. */
 
 /*
@@ -737,7 +738,8 @@ rcu_torture_writer(void *arg)
 			continue;
 		rp->rtort_pipe_count = 0;
 		udelay(rcu_random(&rand) & 0x3ff);
-		old_rp = rcu_torture_current;
+		old_rp = rcu_dereference_check(rcu_torture_current,
+					       current == writer_task);
 		rp->rtort_mbtest = 1;
 		rcu_assign_pointer(rcu_torture_current, rp);
 		smp_wmb(); /* Mods to old_rp must follow rcu_assign_pointer() */
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 7/8] rcu: Add tracing data to support queueing models
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
                   ` (5 preceding siblings ...)
  2010-09-23  0:50 ` [PATCH tip/core/rcu 6/8] rcu: fix sparse errors in rcutorture.c Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  2010-09-23  0:50 ` [PATCH tip/core/rcu 8/8] rcu: Add advice to PROVE_RCU_REPEATEDLY kernel config parameter Paul E. McKenney
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney

The current tracing data is not sufficient to deduce the average time
that a callback spends waiting for a grace period to end.  Add three
per-CPU counters recording the number of callbacks invoked (ci), the
number of callbacks orphaned (co), and the number of callbacks adopted
(ca).  Given the existing callback queue length (ql), the average wait
time in absence of CPU hotplug operations is ql/ci.  The units of wait
time will be in terms of the duration over which ci was measured.

In the presence of CPU hotplug operations, there is room for argument,
but ql/(ci-co+ca) won't steer you too far wrong.

Also fixes a typo called out by Lucas De Marchi <lucas.de.marchi@gmail.com>.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 Documentation/RCU/trace.txt |   13 ++++++++++++-
 kernel/rcutree.c            |    3 +++
 kernel/rcutree.h            |    3 +++
 kernel/rcutree_trace.c      |   10 +++++++---
 4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/Documentation/RCU/trace.txt b/Documentation/RCU/trace.txt
index efd8cc9..a851118 100644
--- a/Documentation/RCU/trace.txt
+++ b/Documentation/RCU/trace.txt
@@ -125,6 +125,17 @@ o	"b" is the batch limit for this CPU.  If more than this number
 	of RCU callbacks is ready to invoke, then the remainder will
 	be deferred.
 
+o	"ci" is the number of RCU callbacks that have been invoked for
+	this CPU.  Note that ci+ql is the number of callbacks that have
+	been registered in absence of CPU-hotplug activity.
+
+o	"co" is the number of RCU callbacks that have been orphaned due to
+	this CPU going offline.
+
+o	"ca" is the number of RCU callbacks that have been adopted due to
+	other CPUs going offline.  Note that ci+co-ca+ql is the number of
+	RCU callbacks registered on this CPU.
+
 There is also an rcu/rcudata.csv file with the same information in
 comma-separated-variable spreadsheet format.
 
@@ -180,7 +191,7 @@ o	"s" is the "signaled" state that drives force_quiescent_state()'s
 
 o	"jfq" is the number of jiffies remaining for this grace period
 	before force_quiescent_state() is invoked to help push things
-	along.  Note that CPUs in dyntick-idle mode thoughout the grace
+	along.  Note that CPUs in dyntick-idle mode throughout the grace
 	period will not report on their own, but rather must be check by
 	some other CPU via force_quiescent_state().
 
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 42140a8..e750735 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1004,6 +1004,7 @@ static void rcu_send_cbs_to_orphanage(struct rcu_state *rsp)
 	for (i = 0; i < RCU_NEXT_SIZE; i++)
 		rdp->nxttail[i] = &rdp->nxtlist;
 	rsp->orphan_qlen += rdp->qlen;
+	rdp->n_cbs_orphaned += rdp->qlen;
 	rdp->qlen = 0;
 	raw_spin_unlock(&rsp->onofflock);  /* irqs remain disabled. */
 }
@@ -1025,6 +1026,7 @@ static void rcu_adopt_orphan_cbs(struct rcu_state *rsp)
 	*rdp->nxttail[RCU_NEXT_TAIL] = rsp->orphan_cbs_list;
 	rdp->nxttail[RCU_NEXT_TAIL] = rsp->orphan_cbs_tail;
 	rdp->qlen += rsp->orphan_qlen;
+	rdp->n_cbs_adopted += rsp->orphan_qlen;
 	rsp->orphan_cbs_list = NULL;
 	rsp->orphan_cbs_tail = &rsp->orphan_cbs_list;
 	rsp->orphan_qlen = 0;
@@ -1156,6 +1158,7 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	/* Update count, and requeue any remaining callbacks. */
 	rdp->qlen -= count;
+	rdp->n_cbs_invoked += count;
 	if (list != NULL) {
 		*tail = rdp->nxtlist;
 		rdp->nxtlist = list;
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 7918ba6..91d4170 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -202,6 +202,9 @@ struct rcu_data {
 	long		qlen;		/* # of queued callbacks */
 	long		qlen_last_fqs_check;
 					/* qlen at last check for QS forcing */
+	unsigned long	n_cbs_invoked;	/* count of RCU cbs invoked. */
+	unsigned long	n_cbs_orphaned;	/* RCU cbs sent to orphanage. */
+	unsigned long	n_cbs_adopted;	/* RCU cbs adopted from orphanage. */
 	unsigned long	n_force_qs_snap;
 					/* did other CPU force QS recently? */
 	long		blimit;		/* Upper limit on a processed batch */
diff --git a/kernel/rcutree_trace.c b/kernel/rcutree_trace.c
index 458e032..d15430b 100644
--- a/kernel/rcutree_trace.c
+++ b/kernel/rcutree_trace.c
@@ -64,7 +64,9 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 		   rdp->dynticks_fqs);
 #endif /* #ifdef CONFIG_NO_HZ */
 	seq_printf(m, " of=%lu ri=%lu", rdp->offline_fqs, rdp->resched_ipi);
-	seq_printf(m, " ql=%ld b=%ld\n", rdp->qlen, rdp->blimit);
+	seq_printf(m, " ql=%ld b=%ld", rdp->qlen, rdp->blimit);
+	seq_printf(m, " ci=%lu co=%lu ca=%lu\n",
+		   rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
 }
 
 #define PRINT_RCU_DATA(name, func, m) \
@@ -119,7 +121,9 @@ static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp)
 		   rdp->dynticks_fqs);
 #endif /* #ifdef CONFIG_NO_HZ */
 	seq_printf(m, ",%lu,%lu", rdp->offline_fqs, rdp->resched_ipi);
-	seq_printf(m, ",%ld,%ld\n", rdp->qlen, rdp->blimit);
+	seq_printf(m, ",%ld,%ld", rdp->qlen, rdp->blimit);
+	seq_printf(m, ",%lu,%lu,%lu\n",
+		   rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
 }
 
 static int show_rcudata_csv(struct seq_file *m, void *unused)
@@ -128,7 +132,7 @@ static int show_rcudata_csv(struct seq_file *m, void *unused)
 #ifdef CONFIG_NO_HZ
 	seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\",");
 #endif /* #ifdef CONFIG_NO_HZ */
-	seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\"\n");
+	seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\",\"ci\",\"co\",\"ca\"\n");
 #ifdef CONFIG_TREE_PREEMPT_RCU
 	seq_puts(m, "\"rcu_preempt:\"\n");
 	PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data_csv, m);
-- 
1.7.0.6


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

* [PATCH tip/core/rcu 8/8] rcu: Add advice to PROVE_RCU_REPEATEDLY kernel config parameter
  2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
                   ` (6 preceding siblings ...)
  2010-09-23  0:50 ` [PATCH tip/core/rcu 7/8] rcu: Add tracing data to support queueing models Paul E. McKenney
@ 2010-09-23  0:50 ` Paul E. McKenney
  7 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23  0:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, Valdis.Kletnieks, dhowells, eric.dumazet,
	Paul E. McKenney

The PROVE_RCU_REPEATEDLY has no "Say Y"/"Say N" advice, so this commit
adds it.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 lib/Kconfig.debug |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 52c2172..9886cf5 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -539,6 +539,10 @@ config PROVE_RCU_REPEATEDLY
 	 disabling, allowing multiple RCU-lockdep warnings to be printed
 	 on a single reboot.
 
+	 Say Y to allow multiple RCU-lockdep warnings per boot.
+
+	 Say N if you are unsure.
+
 config SPARSE_RCU_POINTER
 	bool "RCU debugging: sparse-based checks for pointer usage"
 	default n
-- 
1.7.0.6


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

* Re: [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse
  2010-09-23  0:50 ` [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse Paul E. McKenney
@ 2010-09-23 13:13   ` Arnd Bergmann
  2010-09-23 17:23     ` Paul E. McKenney
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2010-09-23 13:13 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	josh, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Thursday 23 September 2010, Paul E. McKenney wrote:
> The current version of the __rcu_access_pointer(), __rcu_dereference_check(),
> and __rcu_dereference_protected() macros evaluate their "p" argument
> three times, not counting typeof()s.  This is bad news if that argument
> contains a side effect.  This commit therefore evaluates this argument
> only once in normal kernel builds.  However, the straightforward approach
> defeats sparse's RCU-pointer checking, so when __CHECKER__ is defined,
> the additional pair of evaluations of the "p" argument are performed in
> order to permit sparse to detect misuse of RCU-protected pointers.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Arnd Bergmann <arnd@arndb.de>

Sorry for not following up with the alternative approach yet. We can always
do that later, for your patch should go into 2.6.36 to fix any problems
arising from unintended macro side-effects.

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse
  2010-09-23 13:13   ` Arnd Bergmann
@ 2010-09-23 17:23     ` Paul E. McKenney
  0 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2010-09-23 17:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	josh, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Thu, Sep 23, 2010 at 03:13:39PM +0200, Arnd Bergmann wrote:
> On Thursday 23 September 2010, Paul E. McKenney wrote:
> > The current version of the __rcu_access_pointer(), __rcu_dereference_check(),
> > and __rcu_dereference_protected() macros evaluate their "p" argument
> > three times, not counting typeof()s.  This is bad news if that argument
> > contains a side effect.  This commit therefore evaluates this argument
> > only once in normal kernel builds.  However, the straightforward approach
> > defeats sparse's RCU-pointer checking, so when __CHECKER__ is defined,
> > the additional pair of evaluations of the "p" argument are performed in
> > order to permit sparse to detect misuse of RCU-protected pointers.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> 
> Sorry for not following up with the alternative approach yet. We can always
> do that later, for your patch should go into 2.6.36 to fix any problems
> arising from unintended macro side-effects.
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>

No problem, when you get me a better approach, I will happily queue it!

							Thanx, Paul

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

end of thread, other threads:[~2010-09-23 17:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-23  0:50 [PATCH tip/core/rcu 0/8] random RCU fixes and updates Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 1/8] rcu: upgrade stallwarn.txt documentation for CPU-bound RT processes Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 2/8] rcu: performance fixes to TINY_PREEMPT_RCU callback checking Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 3/8] rcu: fix _oddness handling of verbose stall warnings Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 4/8] kernel: Removing undead ifdef CONFIG_DEBUG_LOCK_ALLOC Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 5/8] rcu: only one evaluation of arg in rcu_dereference_check() unless sparse Paul E. McKenney
2010-09-23 13:13   ` Arnd Bergmann
2010-09-23 17:23     ` Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 6/8] rcu: fix sparse errors in rcutorture.c Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 7/8] rcu: Add tracing data to support queueing models Paul E. McKenney
2010-09-23  0:50 ` [PATCH tip/core/rcu 8/8] rcu: Add advice to PROVE_RCU_REPEATEDLY kernel config parameter Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).