* [PATCH tip/core/rcu 02/12] rcu_tree: Avoid touching rnp->completed when a new GP is started
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 03/12] rcu: Fix a couple of typos in rcu_all_qs() comment header Paul E. McKenney
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: Lai Jiangshan <laijs@cn.fujitsu.com>
In rcu_gp_init(), rnp->completed equals to rsp->completed in THEORY,
we don't need to touch it normally. If something goes wrong,
it will complain and fixup rnp->completed and avoid oops.
This commit thus avoids the normal needless store to rnp->completed.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 48d640ca1a05..077d0b700f74 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1757,8 +1757,8 @@ static int rcu_gp_init(struct rcu_state *rsp)
rcu_preempt_check_blocked_tasks(rnp);
rnp->qsmask = rnp->qsmaskinit;
ACCESS_ONCE(rnp->gpnum) = rsp->gpnum;
- WARN_ON_ONCE(rnp->completed != rsp->completed);
- ACCESS_ONCE(rnp->completed) = rsp->completed;
+ if (WARN_ON_ONCE(rnp->completed != rsp->completed))
+ ACCESS_ONCE(rnp->completed) = rsp->completed;
if (rnp == rdp->mynode)
(void)__note_gp_changes(rsp, rnp, rdp);
rcu_preempt_boost_start_gp(rnp);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 03/12] rcu: Fix a couple of typos in rcu_all_qs() comment header
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 02/12] rcu_tree: Avoid touching rnp->completed when a new GP is started Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 04/12] rcu: Drive PROVE_RCU directly off of PROVE_LOCKING Paul E. McKenney
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 077d0b700f74..4e37c7fd9e29 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -292,10 +292,10 @@ void rcu_note_context_switch(void)
EXPORT_SYMBOL_GPL(rcu_note_context_switch);
/*
- * Register a quiesecent state for all RCU flavors. If there is an
+ * Register a quiescent state for all RCU flavors. If there is an
* emergency, invoke rcu_momentary_dyntick_idle() to do a heavy-weight
* dyntick-idle quiescent state visible to other CPUs (but only for those
- * RCU flavors in desparate need of a quiescent state, which will normally
+ * RCU flavors in desperate need of a quiescent state, which will normally
* be none of them). Either way, do a lightweight quiescent state for
* all RCU flavors.
*/
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 04/12] rcu: Drive PROVE_RCU directly off of PROVE_LOCKING
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 02/12] rcu_tree: Avoid touching rnp->completed when a new GP is started Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 03/12] rcu: Fix a couple of typos in rcu_all_qs() comment header Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 05/12] rcu: Remove CONFIG_RCU_FANOUT_EXACT from tree.c file Paul E. McKenney
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
In the past, it has been useful to enable PROVE_LOCKING without also
enabling PROVE_RCU. However, experience with PROVE_RCU over the past
few years has demonstrated its usefulness, so this commit makes
PROVE_LOCKING directly imply PROVE_RCU.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
lib/Kconfig.debug | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c5cefb3c009c..0766672e4c5f 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1180,16 +1180,7 @@ config DEBUG_CREDENTIALS
menu "RCU Debugging"
config PROVE_RCU
- bool "RCU debugging: prove RCU correctness"
- depends on PROVE_LOCKING
- default n
- help
- This feature enables lockdep extensions that check for correct
- use of RCU APIs. This is currently under development. Say Y
- if you want to debug RCU usage or help work on the PROVE_RCU
- feature.
-
- Say N if you are unsure.
+ def_bool PROVE_LOCKING
config PROVE_RCU_REPEATEDLY
bool "RCU debugging: don't disable PROVE_RCU on first splat"
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 05/12] rcu: Remove CONFIG_RCU_FANOUT_EXACT from tree.c file
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (2 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 04/12] rcu: Drive PROVE_RCU directly off of PROVE_LOCKING Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 06/12] rcu: Improve diagnostics for blocked critical sections in irq Paul E. McKenney
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
This commit moves the rcu_init_levelspread() functions from
kernel/rcu/tree.c to kernel/rcu/tree_plugin.h to get an ifdef out
of a .c file.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 29 -----------------------------
kernel/rcu/tree.h | 1 +
kernel/rcu/tree_plugin.h | 26 ++++++++++++++++++++++++++
3 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 4e37c7fd9e29..840663122dda 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3731,35 +3731,6 @@ void rcu_scheduler_starting(void)
}
/*
- * Compute the per-level fanout, either using the exact fanout specified
- * or balancing the tree, depending on CONFIG_RCU_FANOUT_EXACT.
- */
-#ifdef CONFIG_RCU_FANOUT_EXACT
-static void __init rcu_init_levelspread(struct rcu_state *rsp)
-{
- int i;
-
- rsp->levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
- for (i = rcu_num_lvls - 2; i >= 0; i--)
- rsp->levelspread[i] = CONFIG_RCU_FANOUT;
-}
-#else /* #ifdef CONFIG_RCU_FANOUT_EXACT */
-static void __init rcu_init_levelspread(struct rcu_state *rsp)
-{
- int ccur;
- int cprv;
- int i;
-
- cprv = nr_cpu_ids;
- for (i = rcu_num_lvls - 1; i >= 0; i--) {
- ccur = rsp->levelcnt[i];
- rsp->levelspread[i] = (cprv + ccur - 1) / ccur;
- cprv = ccur;
- }
-}
-#endif /* #else #ifdef CONFIG_RCU_FANOUT_EXACT */
-
-/*
* Helper function for rcu_init() that initializes one rcu_state structure.
*/
static void __init rcu_init_one(struct rcu_state *rsp,
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 119de399eb2f..eb47a83d1549 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -595,6 +595,7 @@ static void rcu_sysidle_init_percpu_data(struct rcu_dynticks *rdtp);
static bool rcu_nohz_full_cpu(struct rcu_state *rsp);
static void rcu_dynticks_task_enter(void);
static void rcu_dynticks_task_exit(void);
+static void __init rcu_init_levelspread(struct rcu_state *rsp);
#endif /* #ifndef RCU_TREE_NONCORE */
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 0a571e9a0f1d..93eeefeacc02 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -3091,3 +3091,29 @@ static void rcu_dynticks_task_exit(void)
ACCESS_ONCE(current->rcu_tasks_idle_cpu) = -1;
#endif /* #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL) */
}
+
+/*
+ * Compute the per-level fanout, either using the exact fanout specified
+ * or balancing the tree, depending on CONFIG_RCU_FANOUT_EXACT.
+ */
+static void __init rcu_init_levelspread(struct rcu_state *rsp)
+{
+#ifdef CONFIG_RCU_FANOUT_EXACT
+ int i;
+
+ rsp->levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
+ for (i = rcu_num_lvls - 2; i >= 0; i--)
+ rsp->levelspread[i] = CONFIG_RCU_FANOUT;
+#else /* #ifdef CONFIG_RCU_FANOUT_EXACT */
+ int ccur;
+ int cprv;
+ int i;
+
+ cprv = nr_cpu_ids;
+ for (i = rcu_num_lvls - 1; i >= 0; i--) {
+ ccur = rsp->levelcnt[i];
+ rsp->levelspread[i] = (cprv + ccur - 1) / ccur;
+ cprv = ccur;
+ }
+#endif /* #else #ifdef CONFIG_RCU_FANOUT_EXACT */
+}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 06/12] rcu: Improve diagnostics for blocked critical sections in irq
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (3 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 05/12] rcu: Remove CONFIG_RCU_FANOUT_EXACT from tree.c file Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 07/12] rcu: Use IS_ENABLED() to simplify rcu_bootup_announce_oddness() Paul E. McKenney
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
If an RCU read-side critical section occurs within an interrupt handler
or a softirq handler, it cannot have been preempted. Therefore, there is
a check in rcu_read_unlock_special() checking for this error. However,
when this check triggers, it lacks diagnostic information. This commit
therefore moves rcu_read_unlock()'s lockdep annotation to follow the
call to __rcu_read_unlock() and changes rcu_read_unlock_special()'s
WARN_ON_ONCE() to an lockdep_rcu_suspicious() in order to locate where
the offending RCU read-side critical section began. In addition, the
value of the ->rcu_read_unlock_special field is printed.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
include/linux/lockdep.h | 7 ++++++-
include/linux/rcupdate.h | 2 +-
kernel/rcu/tree_plugin.h | 8 +++++++-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 74ab23176e9b..066ba4157541 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -531,8 +531,13 @@ do { \
# define might_lock_read(lock) do { } while (0)
#endif
-#ifdef CONFIG_PROVE_RCU
+#ifdef CONFIG_LOCKDEP
void lockdep_rcu_suspicious(const char *file, const int line, const char *s);
+#else
+static inline void
+lockdep_rcu_suspicious(const char *file, const int line, const char *s)
+{
+}
#endif
#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 3e6afed51051..70b896e16f19 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -942,9 +942,9 @@ static inline void rcu_read_unlock(void)
{
rcu_lockdep_assert(rcu_is_watching(),
"rcu_read_unlock() used illegally while idle");
- rcu_lock_release(&rcu_lock_map);
__release(RCU);
__rcu_read_unlock();
+ rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
}
/**
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 93eeefeacc02..fec7034d41db 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -334,7 +334,13 @@ void rcu_read_unlock_special(struct task_struct *t)
}
/* Hardware IRQ handlers cannot block, complain if they get here. */
- if (WARN_ON_ONCE(in_irq() || in_serving_softirq())) {
+ if (in_irq() || in_serving_softirq()) {
+ lockdep_rcu_suspicious(__FILE__, __LINE__,
+ "rcu_read_unlock() from irq or softirq with blocking in critical section!!!\n");
+ pr_alert("->rcu_read_unlock_special: %#x (b: %d, nq: %d)\n",
+ t->rcu_read_unlock_special.s,
+ t->rcu_read_unlock_special.b.blocked,
+ t->rcu_read_unlock_special.b.need_qs);
local_irq_restore(flags);
return;
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 07/12] rcu: Use IS_ENABLED() to simplify rcu_bootup_announce_oddness()
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (4 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 06/12] rcu: Improve diagnostics for blocked critical sections in irq Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 08/12] rcu: Add boot-up check for non-default CONFIG_RCU_FANOUT_LEAF values Paul E. McKenney
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
This commit gets rid of some inline #ifdefs by replacing them with
IS_ENABLED.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree_plugin.h | 48 ++++++++++++++++++++----------------------------
1 file changed, 20 insertions(+), 28 deletions(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index fec7034d41db..2484b3f716e0 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -58,38 +58,30 @@ static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */
*/
static void __init rcu_bootup_announce_oddness(void)
{
-#ifdef CONFIG_RCU_TRACE
- pr_info("\tRCU debugfs-based tracing is enabled.\n");
-#endif
-#if (defined(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 64) || (!defined(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 32)
- pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
- CONFIG_RCU_FANOUT);
-#endif
-#ifdef CONFIG_RCU_FANOUT_EXACT
- pr_info("\tHierarchical RCU autobalancing is disabled.\n");
-#endif
-#ifdef CONFIG_RCU_FAST_NO_HZ
- pr_info("\tRCU dyntick-idle grace-period acceleration is enabled.\n");
-#endif
-#ifdef CONFIG_PROVE_RCU
- pr_info("\tRCU lockdep checking is enabled.\n");
-#endif
-#ifdef CONFIG_RCU_TORTURE_TEST_RUNNABLE
- pr_info("\tRCU torture testing starts during boot.\n");
-#endif
-#if defined(CONFIG_RCU_CPU_STALL_INFO)
- pr_info("\tAdditional per-CPU info printed with stalls.\n");
-#endif
-#if NUM_RCU_LVL_4 != 0
- pr_info("\tFour-level hierarchy is enabled.\n");
-#endif
+ if (IS_ENABLED(CONFIG_RCU_TRACE))
+ pr_info("\tRCU debugfs-based tracing is enabled.\n");
+ if ((IS_ENABLED(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 64) ||
+ (!IS_ENABLED(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 32))
+ pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
+ CONFIG_RCU_FANOUT);
+ if (IS_ENABLED(CONFIG_RCU_FANOUT_EXACT))
+ pr_info("\tHierarchical RCU autobalancing is disabled.\n");
+ if (IS_ENABLED(CONFIG_RCU_FAST_NO_HZ))
+ pr_info("\tRCU dyntick-idle grace-period acceleration is enabled.\n");
+ if (IS_ENABLED(CONFIG_PROVE_RCU))
+ pr_info("\tRCU lockdep checking is enabled.\n");
+ if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_RUNNABLE))
+ pr_info("\tRCU torture testing starts during boot.\n");
+ if (IS_ENABLED(CONFIG_RCU_CPU_STALL_INFO))
+ pr_info("\tAdditional per-CPU info printed with stalls.\n");
+ if (NUM_RCU_LVL_4 != 0)
+ pr_info("\tFour-level hierarchy is enabled.\n");
if (rcu_fanout_leaf != CONFIG_RCU_FANOUT_LEAF)
pr_info("\tBoot-time adjustment of leaf fanout to %d.\n", rcu_fanout_leaf);
if (nr_cpu_ids != NR_CPUS)
pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids);
-#ifdef CONFIG_RCU_BOOST
- pr_info("\tRCU kthread priority: %d.\n", kthread_prio);
-#endif
+ if (IS_ENABLED(CONFIG_RCU_BOOST))
+ pr_info("\tRCU kthread priority: %d.\n", kthread_prio);
}
#ifdef CONFIG_PREEMPT_RCU
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 08/12] rcu: Add boot-up check for non-default CONFIG_RCU_FANOUT_LEAF values
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (5 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 07/12] rcu: Use IS_ENABLED() to simplify rcu_bootup_announce_oddness() Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 09/12] rcu: Reverse rcu_dereference_check() conditions Paul E. McKenney
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree_plugin.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 2484b3f716e0..12273dc0ee53 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -76,6 +76,9 @@ static void __init rcu_bootup_announce_oddness(void)
pr_info("\tAdditional per-CPU info printed with stalls.\n");
if (NUM_RCU_LVL_4 != 0)
pr_info("\tFour-level hierarchy is enabled.\n");
+ if (CONFIG_RCU_FANOUT_LEAF != 16)
+ pr_info("\tBuild-time adjustment of leaf fanout to %d.\n",
+ CONFIG_RCU_FANOUT_LEAF);
if (rcu_fanout_leaf != CONFIG_RCU_FANOUT_LEAF)
pr_info("\tBoot-time adjustment of leaf fanout to %d.\n", rcu_fanout_leaf);
if (nr_cpu_ids != NR_CPUS)
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 09/12] rcu: Reverse rcu_dereference_check() conditions
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (6 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 08/12] rcu: Add boot-up check for non-default CONFIG_RCU_FANOUT_LEAF values Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 10/12] torture: Avoid script syntax error when insufficient CPUs Paul E. McKenney
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
The rcu_dereference_check() family of primitives evaluates the RCU
lockdep expression first, and only then evaluates the expression passed
in. This works fine normally, but can potentially fail in environments
(such as NMI handlers) where lockdep cannot be invoked. The problem is
that even if the expression passed in is "1", the compiler would need to
prove that the RCU lockdep expression (rcu_read_lock_held(), for example)
is free of side effects in order to be able to elide it. Given that
rcu_read_lock_held() is sometimes separately compiled, the compiler cannot
always use this optimization.
This commit therefore reverse the order of evaluation, so that the
expression passed in is evaluated first, and the RCU lockdep expression is
evaluated only if the passed-in expression evaluated to false, courtesy
of the C-language short-circuit boolean evaluation rules. This compells
the compiler to forego executing the RCU lockdep expression in cases
where the passed-in expression evaluates to "1" at compile time, so that
(for example) rcu_dereference_raw() can be guaranteed to execute safely
within an NMI handler.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/rcupdate.h | 6 +++---
include/linux/srcu.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 70b896e16f19..416ae2848c6c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -729,7 +729,7 @@ static inline void rcu_preempt_sleep_check(void)
* annotated as __rcu.
*/
#define rcu_dereference_check(p, c) \
- __rcu_dereference_check((p), rcu_read_lock_held() || (c), __rcu)
+ __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
/**
* rcu_dereference_bh_check() - rcu_dereference_bh with debug checking
@@ -739,7 +739,7 @@ static inline void rcu_preempt_sleep_check(void)
* This is the RCU-bh counterpart to rcu_dereference_check().
*/
#define rcu_dereference_bh_check(p, c) \
- __rcu_dereference_check((p), rcu_read_lock_bh_held() || (c), __rcu)
+ __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)
/**
* rcu_dereference_sched_check() - rcu_dereference_sched with debug checking
@@ -749,7 +749,7 @@ static inline void rcu_preempt_sleep_check(void)
* This is the RCU-sched counterpart to rcu_dereference_check().
*/
#define rcu_dereference_sched_check(p, c) \
- __rcu_dereference_check((p), rcu_read_lock_sched_held() || (c), \
+ __rcu_dereference_check((p), (c) || rcu_read_lock_sched_held(), \
__rcu)
#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 9cfd9623fb03..bdeb4567b71e 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -182,7 +182,7 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
* lockdep_is_held() calls.
*/
#define srcu_dereference_check(p, sp, c) \
- __rcu_dereference_check((p), srcu_read_lock_held(sp) || (c), __rcu)
+ __rcu_dereference_check((p), (c) || srcu_read_lock_held(sp), __rcu)
/**
* srcu_dereference - fetch SRCU-protected pointer for later dereferencing
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 10/12] torture: Avoid script syntax error when insufficient CPUs
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (7 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 09/12] rcu: Reverse rcu_dereference_check() conditions Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 11/12] rcu: Get rcu_sched_force_quiescent_state() where it belongs Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 12/12] rcu: Remove redundant check of cpu_online() Paul E. McKenney
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Parentheses are special to bash, so use an overflow flag that doesn't
use them.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
tools/testing/selftests/rcutorture/bin/kvm.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 368d64ac779e..dd2812ceb0ba 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -310,7 +310,7 @@ function dump(first, pastlast)
cfr[jn] = cf[j] "." cfrep[cf[j]];
}
if (cpusr[jn] > ncpus && ncpus != 0)
- ovf = "(!)";
+ ovf = "-ovf";
else
ovf = "";
print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`";
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 11/12] rcu: Get rcu_sched_force_quiescent_state() where it belongs
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (8 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 10/12] torture: Avoid script syntax error when insufficient CPUs Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
2015-03-03 17:03 ` [PATCH tip/core/rcu 12/12] rcu: Remove redundant check of cpu_online() Paul E. McKenney
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
The very similar functions rcu_force_quiescent_state(),
rcu_bh_force_quiescent_state(), and rcu_sched_force_quiescent_state()
are supposed to be together, but have drifted apart. This commit
restores rcu_sched_force_quiescent_state() to its rightful place.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 840663122dda..9820119f40b5 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -410,6 +410,15 @@ void rcu_bh_force_quiescent_state(void)
EXPORT_SYMBOL_GPL(rcu_bh_force_quiescent_state);
/*
+ * Force a quiescent state for RCU-sched.
+ */
+void rcu_sched_force_quiescent_state(void)
+{
+ force_quiescent_state(&rcu_sched_state);
+}
+EXPORT_SYMBOL_GPL(rcu_sched_force_quiescent_state);
+
+/*
* Show the state of the grace-period kthreads.
*/
void show_rcu_gp_kthreads(void)
@@ -483,15 +492,6 @@ void rcutorture_record_progress(unsigned long vernum)
EXPORT_SYMBOL_GPL(rcutorture_record_progress);
/*
- * Force a quiescent state for RCU-sched.
- */
-void rcu_sched_force_quiescent_state(void)
-{
- force_quiescent_state(&rcu_sched_state);
-}
-EXPORT_SYMBOL_GPL(rcu_sched_force_quiescent_state);
-
-/*
* Does the CPU have callbacks ready to be invoked?
*/
static int
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH tip/core/rcu 12/12] rcu: Remove redundant check of cpu_online()
2015-03-03 17:03 ` [PATCH tip/core/rcu 01/12] rcu: Consolidate rcu_synchronize and wakeme_after_rcu() Paul E. McKenney
` (9 preceding siblings ...)
2015-03-03 17:03 ` [PATCH tip/core/rcu 11/12] rcu: Get rcu_sched_force_quiescent_state() where it belongs Paul E. McKenney
@ 2015-03-03 17:03 ` Paul E. McKenney
10 siblings, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2015-03-03 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, tglx,
peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Yao Dongdong, Paul E. McKenney
From: Yao Dongdong <yaodongdong@huawei.com>
Because invoke_cpu_core() checks whether the current CPU is online,
there is no need for __call_rcu_core() to redundantly check it.
There should not be any performance degradation because the called
function is visible to the compiler. This commit therefore removes
the redundant check.
Signed-off-by: Yao Dongdong <yaodongdong@huawei.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 9820119f40b5..75366019e15c 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2741,7 +2741,7 @@ static void __call_rcu_core(struct rcu_state *rsp, struct rcu_data *rdp,
* If called from an extended quiescent state, invoke the RCU
* core in order to force a re-evaluation of RCU's idleness.
*/
- if (!rcu_is_watching() && cpu_online(smp_processor_id()))
+ if (!rcu_is_watching())
invoke_rcu_core();
/* If interrupts were disabled or CPU offline, don't invoke RCU core. */
--
1.8.1.5
^ permalink raw reply related [flat|nested] 13+ messages in thread