Skip to contentSkip to conversation

RCU Kconfig fixes for v4.2

PATCH In review Paul E. McKenney 2 participants 20 messages Apr 21, 2015 – Apr 22, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover RCU Kconfig fixes for v4.2

Hello!

This patch series reduces the number of questions that RCU asks Kconfig users. After this series is applied, removing the RCU-related definitions from .config and running "make oldconfig" results in only the following:

RCU Implementation

Quoted 1 line

1. Tree-based hierarchical RCU (TREE_RCU) (NEW)

choice[1]: 1
Make expert-level adjustments to RCU configuration (RCU_EXPERT) [N/y/?] (NEW)

Those expert users wishing to tune RCU answer Y to this question.

The patches in this series are as follows:

1. Drive TASKS_RCU directly from Kconfig, for example, by having
RCU_TORTURE_TESTS select it.

2. Remove CONFIG_TASKS_RCU=y from the three TASKS_RCU test
scenarios, since this is set by virtue of having rcutorture configured.

3. Drive RCU_USER_QS directly from Kconfig, relying on the fact
that NO_HZ_FULL selects it.

4. Convert CONFIG_RCU_FANOUT_EXACT to a boot parameter, where it
is used by rcutorture.

5. Update rcutorture test scenarios to use the boot parameter
created in #4 instead of the Kconfig parameter.

6. Create a boot parameter to do a diagnostic dump of the shape
of the rcu_node combining tree, which is useful for verifying that intended changes to that tree actually happened.

7. Create an RCU_EXPERT Kconfig parameter and hide the
RCU_FAST_NO_HZ, RCU_BOOST, CONTEXT_TRACKING_FORCE, and RCU_NOCB_CPU boolean parameters behind it.

8. Make rcutorture test scenarios force RCU_EXPERT, but have
SRCU-P, TASKS03, and TREE09 retain !RCU_EXPERT in order to test the vanilla configuration.

9. Remove the dependency of RCU_FANOUT_LEAF on RCU_FANOUT.

10. Change RCU to allow it to tolerate an undefined RCU_FANOUT,
and then hide RCU_FANOUT behind RCU_EXPERT.

11. Change RCU to allow it to tolerate an undefined RCU_FANOUT_LEAF,
and then hide RCU_FANOUT_LEAF behind RCU_EXPERT.

12. Change RCU to allow it to tolerate an undefined RCU_KTHREAD_PRIO,
and then hide RCU_KTHREAD_PRIO behind RCU_EXPERT.

Thanx, Paul

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

 b/Documentation/kernel-parameters.txt                          |   11 +
 b/init/Kconfig                                                 |   62 ++++------
 b/kernel/rcu/tree.c                                            |   50 ++++++--
 b/kernel/rcu/tree.h                                            |   29 ++++
 b/kernel/rcu/tree_plugin.h                                     |   14 +-
 b/lib/Kconfig.debug                                            |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N        |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS01       |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02       |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS03       |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE01        |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE02        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE02-T      |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE03        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE04        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE05        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE06        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot   |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE07        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE08        |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE08-T      |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE08.boot   |    1 
 23 files changed, 127 insertions(+), 65 deletions(-)
#1 lore raw

PATCH 1/12 rcu: Directly drive TASKS_RCU from Kconfig

From: "Paul E. McKenney" <[email protected]>

Currently, Kconfig will ask the user whether TASKS_RCU should be set. This is silly because Kconfig already has all the information that it needs to set this parameter. This commit therefore directly drives the value of TASKS_RCU via "select" statements. Which means that as subsystems require TASKS_RCU, those subsystems will need to add "select" statements of their own.

---
 init/Kconfig      | 4 +---
 lib/Kconfig.debug | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)
init/Kconfig +1 -3
index 9a0592516f48..353714745015 100644
@@ -507,7 +507,7 @@ config SRCU
 	  sections.
 
 config TASKS_RCU
-	bool "Task_based RCU implementation using voluntary context switch"
+	bool
 	default n
 	select SRCU
 	help
@@ -515,8 +515,6 @@ config TASKS_RCU
 	  only voluntary context switch (not preemption!), idle, and
 	  user-mode execution as quiescent states.
 
-	  If unsure, say N.
-
 config RCU_STALL_COMMON
 	def_bool ( TREE_RCU || PREEMPT_RCU || RCU_TRACE )
 	help
lib/Kconfig.debug +1 -0
index 285c2292c1ce..4e52ea4bcdcc 100644
@@ -1220,6 +1220,7 @@ config RCU_TORTURE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
+	select TASKS_RCU
 	default n
 	help
 	  This option provides a kernel module that runs torture tests
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/12 rcutorture: TASKS_RCU set directly, so don't explicitly set it

From: "Paul E. McKenney" <[email protected]>

The TASKS01, TASKS02, and TASKS03 rcutorture config fragments currently set CONFIG_TASKS_RCU. However, now that the value of this Kconfig parameter is set via "select" statements, it is no longer necessary to set it explicitly. This commit therefore removes it from the Kconfig fragments.

---
 tools/testing/selftests/rcutorture/configs/rcu/TASKS01 | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TASKS02 | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TASKS03 | 1 -
 3 files changed, 3 deletions(-)
tools/testing/selftests/rcutorture/configs/rcu/TASKS01 +0 -1
index 97f0a0b27ef7..32c5de503316 100644
@@ -6,4 +6,3 @@ CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_RCU=y
-CONFIG_TASKS_RCU=y
tools/testing/selftests/rcutorture/configs/rcu/TASKS02 +0 -1
index 696d2ea74d13..ad2be91e5ee7 100644
@@ -2,4 +2,3 @@ CONFIG_SMP=n
 CONFIG_PREEMPT_NONE=y
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=n
-CONFIG_TASKS_RCU=y
tools/testing/selftests/rcutorture/configs/rcu/TASKS03 +0 -1
index 9c60da5b5d1d..111494018301 100644
@@ -6,7 +6,6 @@ CONFIG_HIBERNATION=n
 CONFIG_PREEMPT_NONE=n
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=y
-CONFIG_TASKS_RCU=y
 CONFIG_HZ_PERIODIC=n
 CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=y
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 3/12 rcu: Directly drive RCU_USER_QS from Kconfig

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

Currently, Kconfig will ask the user whether RCU_USER_QS should be set. This is silly because Kconfig already has all the information that it needs to set this parameter. This commit therefore directly drives the value of RCU_USER_QS via NO_HZ_FULL's "select" statement.

---
 init/Kconfig | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
init/Kconfig +1 -9
index 353714745015..6d2cf6453be7 100644
@@ -527,9 +527,7 @@ config CONTEXT_TRACKING
        bool
 
 config RCU_USER_QS
-	bool "Consider userspace as in RCU extended quiescent state"
-	depends on HAVE_CONTEXT_TRACKING && SMP
-	select CONTEXT_TRACKING
+	bool
 	help
 	  This option sets hooks on kernel / userspace boundaries and
 	  puts RCU in extended quiescent state when the CPU runs in
@@ -537,12 +535,6 @@ config RCU_USER_QS
 	  excluded from the global RCU state machine and thus doesn't
 	  try to keep the timer tick on for RCU.
 
-	  Unless you want to hack and help the development of the full
-	  dynticks mode, you shouldn't enable this option.  It also
-	  adds unnecessary overhead.
-
-	  If unsure say N
-
 config CONTEXT_TRACKING_FORCE
 	bool "Force context tracking"
 	depends on CONTEXT_TRACKING
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 4/12 rcu: Covert CONFIG_RCU_FANOUT_EXACT to boot parameter

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

The CONFIG_RCU_FANOUT_EXACT Kconfig parameter is used primarily (and perhaps only) by rcutorture to verify that RCU works correctly in specific rcu_node combining-tree configurations. It therefore does not make much sense have this as a question to people attempting to configure their kernels. So this commit creates an rcutree.rcu_fanout_exact= boot parameter that rcutorture can use, and eliminates the original CONFIG_RCU_FANOUT_EXACT Kconfig parameter.

---
 Documentation/kernel-parameters.txt |  6 ++++++
 init/Kconfig                        | 14 --------------
 kernel/rcu/tree.c                   |  7 +++++--
 kernel/rcu/tree_plugin.h            |  2 +-
 4 files changed, 12 insertions(+), 17 deletions(-)
Documentation/kernel-parameters.txt +6 -0
index 64528a2fc67c..24b0d95acd45 100644
@@ -2986,6 +2986,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			the rcu_node combining tree.  This only has effect
 			when CONFIG_RCU_TORTURE_TEST_SLOW_PREINIT is set.
 
+	rcutree.rcu_fanout_exact= [KNL]
+			Disable autobalancing of the rcu_node combining
+			tree.  This is used by rcutorture, and might
+			possibly be useful for architectures having high
+			cache-to-cache transfer latencies.
+
 	rcutree.rcu_fanout_leaf= [KNL]
 			Increase the number of CPUs assigned to each
 			leaf rcu_node structure.  Useful for very large
init/Kconfig +0 -14
index 6d2cf6453be7..67598f3143f5 100644
@@ -609,20 +609,6 @@ config RCU_FANOUT_LEAF
 
 	  Take the default if unsure.
 
-config RCU_FANOUT_EXACT
-	bool "Disable tree-based hierarchical RCU auto-balancing"
-	depends on TREE_RCU || PREEMPT_RCU
-	default n
-	help
-	  This option forces use of the exact RCU_FANOUT value specified,
-	  regardless of imbalances in the hierarchy.  This is useful for
-	  testing RCU itself, and might one day be useful on systems with
-	  strong NUMA behavior.
-
-	  Without RCU_FANOUT_EXACT, the code will balance the hierarchy.
-
-	  Say N if unsure.
-
 config RCU_FAST_NO_HZ
 	bool "Accelerate last non-dyntick-idle CPU's grace periods"
 	depends on NO_HZ_COMMON && SMP
kernel/rcu/tree.c +5 -2
index 3467e321280c..fdca17e7a1b5 100644
@@ -114,6 +114,9 @@ static struct rcu_state *const rcu_state_p;
 static struct rcu_data __percpu *const rcu_data_p;
 LIST_HEAD(rcu_struct_flavors);
 
+/* Control rcu_node-tree auto-balancing at boot time. */
+static bool rcu_fanout_exact;
+module_param(rcu_fanout_exact, bool, 0444);
 /* Increase (but not decrease) the CONFIG_RCU_FANOUT_LEAF at boot time. */
 static int rcu_fanout_leaf = CONFIG_RCU_FANOUT_LEAF;
 module_param(rcu_fanout_leaf, int, 0444);
@@ -3937,13 +3940,13 @@ 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.
+ * or balancing the tree, depending on the rcu_fanout_exact boot parameter.
  */
 static void __init rcu_init_levelspread(int *levelspread, const int *levelcnt)
 {
 	int i;
 
-	if (IS_ENABLED(CONFIG_RCU_FANOUT_EXACT)) {
+	if (rcu_fanout_exact) {
 		levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
 		for (i = rcu_num_lvls - 2; i >= 0; i--)
 			levelspread[i] = CONFIG_RCU_FANOUT;
kernel/rcu/tree_plugin.h +1 -1
index e6ef194da4b7..074689cedda9 100644
@@ -74,7 +74,7 @@ static void __init rcu_bootup_announce_oddness(void)
 	    (!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))
+	if (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");
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH 5/12 rcutorture: Update configuration fragments for rcutree.rcu_fanout_exact

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit updates rcutortures configuration-fragment files to account for the move from the CONFIG_RCU_FANOUT_EXACT Kconfig parameter to the new rcutree.rcu_fanout_exact= boot parameter.

---
 tools/testing/selftests/rcutorture/configs/rcu/TREE02        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE02-T      | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE03        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE04        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE05        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE06        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot   | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE07        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE08        | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE08-T      | 1 -
 tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE08.boot   | 1 +
 12 files changed, 3 insertions(+), 9 deletions(-)
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot
tools/testing/selftests/rcutorture/configs/rcu/TREE02 +0 -1
index 629122fb8b4a..ea131cc5f7dd 100644
@@ -14,7 +14,6 @@ CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=3
 CONFIG_RCU_FANOUT_LEAF=3
-CONFIG_RCU_FANOUT_EXACT=n
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=n
tools/testing/selftests/rcutorture/configs/rcu/TREE02-T +0 -1
index a25de47888a4..2ac9e68ea3d1 100644
@@ -14,7 +14,6 @@ CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=3
 CONFIG_RCU_FANOUT_LEAF=3
-CONFIG_RCU_FANOUT_EXACT=n
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=n
tools/testing/selftests/rcutorture/configs/rcu/TREE03 +0 -1
index 05a81380a5c2..d75d986fa688 100644
@@ -11,7 +11,6 @@ CONFIG_RCU_TRACE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_RCU_FANOUT=2
 CONFIG_RCU_FANOUT_LEAF=2
-CONFIG_RCU_FANOUT_EXACT=n
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_CPU_STALL_INFO=n
tools/testing/selftests/rcutorture/configs/rcu/TREE04 +0 -1
index 4eb6d374a0ca..30b0a5679e48 100644
@@ -15,7 +15,6 @@ CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=4
 CONFIG_RCU_FANOUT_LEAF=4
-CONFIG_RCU_FANOUT_EXACT=n
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_CPU_STALL_INFO=y
tools/testing/selftests/rcutorture/configs/rcu/TREE05 +0 -1
index 212e3bfd2b2a..79572319896f 100644
@@ -12,7 +12,6 @@ CONFIG_RCU_TRACE=n
 CONFIG_HOTPLUG_CPU=y
 CONFIG_RCU_FANOUT=6
 CONFIG_RCU_FANOUT_LEAF=6
-CONFIG_RCU_FANOUT_EXACT=n
 CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_NONE=y
 CONFIG_DEBUG_LOCK_ALLOC=y
tools/testing/selftests/rcutorture/configs/rcu/TREE06 +0 -1
index 7eee63b44218..b94c400def4a 100644
@@ -14,7 +14,6 @@ CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=6
 CONFIG_RCU_FANOUT_LEAF=6
-CONFIG_RCU_FANOUT_EXACT=y
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot +1 -0
index da9a03a398db..dd90f28ed700 100644
@@ -1,3 +1,4 @@
 rcupdate.rcu_self_test=1
 rcupdate.rcu_self_test_bh=1
 rcupdate.rcu_self_test_sched=1
+rcutree.rcu_fanout_exact=1
tools/testing/selftests/rcutorture/configs/rcu/TREE07 +0 -1
index 92a97fa97dec..d715f99c3297 100644
@@ -15,7 +15,6 @@ CONFIG_RCU_TRACE=y
 CONFIG_HOTPLUG_CPU=y
 CONFIG_RCU_FANOUT=2
 CONFIG_RCU_FANOUT_LEAF=2
-CONFIG_RCU_FANOUT_EXACT=n
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_CPU_STALL_INFO=y
tools/testing/selftests/rcutorture/configs/rcu/TREE08 +0 -1
index acce6552f7f0..5f77ebeec4d1 100644
@@ -13,7 +13,6 @@ CONFIG_HOTPLUG_CPU=n
 CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=3
-CONFIG_RCU_FANOUT_EXACT=y
 CONFIG_RCU_FANOUT_LEAF=2
 CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_ALL=y
tools/testing/selftests/rcutorture/configs/rcu/TREE08-T +0 -1
index 3eaeccacb083..b2b8cea69dc9 100644
@@ -13,7 +13,6 @@ CONFIG_HOTPLUG_CPU=n
 CONFIG_SUSPEND=n
 CONFIG_HIBERNATION=n
 CONFIG_RCU_FANOUT=3
-CONFIG_RCU_FANOUT_EXACT=y
 CONFIG_RCU_FANOUT_LEAF=2
 CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_ALL=y
tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot new file +1 -0
new file mode 100644
index 000000000000..883149b5f2d1
@@ -0,0 +1 @@
+rcutree.rcu_fanout_exact=1
tools/testing/selftests/rcutorture/configs/rcu/TREE08.boot +1 -0
index 2561daf605ad..fb066dc82769 100644
@@ -1,3 +1,4 @@
 rcutorture.torture_type=sched
 rcupdate.rcu_self_test=1
 rcupdate.rcu_self_test_sched=1
+rcutree.rcu_fanout_exact=1
Signature · 1 line
1.8.1.5
#6 lore raw

Re: [PATCH tip/core/rcu 05/12] rcutorture: Update configuration fragments for rcutree.rcu_fanout_exact

Quoted 7 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit updates rcutortures configuration-fragment files to account for the move from the CONFIG_RCU_FANOUT_EXACT Kconfig parameter to the new rcutree.rcu_fanout_exact= boot parameter.

There are some some references to it in tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt. I think it will be good to modify them with this commit.

--
Pranith

#7 lore raw

Re: [PATCH tip/core/rcu 05/12] rcutorture: Update configuration fragments for rcutree.rcu_fanout_exact

Quoted 8 lines · Pranith Kumar
Quoted 6 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit updates rcutortures configuration-fragment files to account for the move from the CONFIG_RCU_FANOUT_EXACT Kconfig parameter to the new rcutree.rcu_fanout_exact= boot parameter.

Quoted 5 lines
Quoted 1 line

There are some some references to it in tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt. I think it will be good to modify them with this commit.

Good point! Actually, this is a bit out of date by now, so I should just bring it up to the present time. Please see below.

Thanx, Paul

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

rcutorture: Update TREE_RCU-kconfig.txt

This commit updates TREE_RCU-kconfig.txt to reflect changes in RCU's Kconfig setup. This commit also updates rcutorture's Kconfig fragments to account for Kconfig parameters that are now driven directly off of other Kconfig parameters.

tools/testing/selftests/rcutorture/configs/rcu/TASKS01 +2 -1
index 9318de8d5e88..2cc0e60eba6e 100644
@@ -5,5 +5,6 @@ CONFIG_PREEMPT_NONE=n
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=y
 CONFIG_DEBUG_LOCK_ALLOC=y
-CONFIG_PROVE_RCU=y
+CONFIG_PROVE_LOCKING=n
+#CHECK#CONFIG_PROVE_RCU=n
 CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TINY02 +1 -1
index 36e41df3d27a..f1892e0371c9 100644
@@ -8,7 +8,7 @@ CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_TRACE=y
 CONFIG_PROVE_LOCKING=y
-CONFIG_PROVE_RCU=y
+#CHECK#CONFIG_PROVE_RCU=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_PREEMPT_COUNT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE04 +1 -1
index d34e4b05941f..3f5112751cda 100644
@@ -17,6 +17,6 @@ CONFIG_RCU_FANOUT=4
 CONFIG_RCU_FANOUT_LEAF=4
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
-CONFIG_RCU_CPU_STALL_INFO=y
+CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE05 +1 -1
index 2f9b93a777dd..c04dfea6fd21 100644
@@ -16,7 +16,7 @@ CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_NONE=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
-CONFIG_PROVE_RCU=y
+#CHECK#CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE06 +1 -1
index f7b2e87af79a..f51d2c73a68e 100644
@@ -17,7 +17,7 @@ CONFIG_RCU_FANOUT_LEAF=6
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
-CONFIG_PROVE_RCU=y
+#CHECK#CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
 CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE07 +1 -1
index ce18d597b553..f422af4ff5a3 100644
@@ -17,6 +17,6 @@ CONFIG_RCU_FANOUT=2
 CONFIG_RCU_FANOUT_LEAF=2
 CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
-CONFIG_RCU_CPU_STALL_INFO=y
+CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE08 +1 -1
index fc1fed642917..a24d2ca30646 100644
@@ -18,7 +18,7 @@ CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_ALL=y
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_PROVE_LOCKING=y
-CONFIG_PROVE_RCU=y
+#CHECK#CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt +13 -23
index ec03c883db00..b24c0004fc49 100644
@@ -12,13 +12,12 @@ CONFIG_NO_HZ_IDLE -- Do those not otherwise specified. (Groups of two.)
 CONFIG_NO_HZ_FULL -- Do two, one with CONFIG_NO_HZ_FULL_SYSIDLE.
 CONFIG_NO_HZ_FULL_SYSIDLE -- Do one.
 CONFIG_PREEMPT -- Do half.  (First three and #8.)
-CONFIG_PROVE_LOCKING -- Do all but two, covering CONFIG_PROVE_RCU and not.
-CONFIG_PROVE_RCU -- Do all but one under CONFIG_PROVE_LOCKING.
+CONFIG_PROVE_LOCKING -- Do several, covering CONFIG_DEBUG_LOCK_ALLOC=y and not.
+CONFIG_PROVE_RCU -- Hardwired to CONFIG_PROVE_LOCKING.
 CONFIG_RCU_BOOST -- one of PREEMPT_RCU.
 CONFIG_RCU_KTHREAD_PRIO -- set to 2 for _BOOST testing.
-CONFIG_RCU_CPU_STALL_INFO -- Do one.
-CONFIG_RCU_FANOUT -- Cover hierarchy as currently, but overlap with others.
-CONFIG_RCU_FANOUT_EXACT -- Do one.
+CONFIG_RCU_CPU_STALL_INFO -- Now default, avoid at least twice.
+CONFIG_RCU_FANOUT -- Cover hierarchy, but overlap with others.
 CONFIG_RCU_FANOUT_LEAF -- Do one non-default.
 CONFIG_RCU_FAST_NO_HZ -- Do one, but not with CONFIG_RCU_NOCB_CPU_ALL.
 CONFIG_RCU_NOCB_CPU -- Do three, see below.
@@ -27,28 +26,19 @@ CONFIG_RCU_NOCB_CPU_NONE -- Do one.
 CONFIG_RCU_NOCB_CPU_ZERO -- Do one.
 CONFIG_RCU_TRACE -- Do half.
 CONFIG_SMP -- Need one !SMP for PREEMPT_RCU.
+!RCU_EXPERT -- Do a few, but these have to be vanilla configurations.
 RCU-bh: Do one with PREEMPT and one with !PREEMPT.
 RCU-sched: Do one with PREEMPT but not BOOST.
 
 
-Hierarchy:
-
-TREE01.	CONFIG_NR_CPUS=8, CONFIG_RCU_FANOUT=8, CONFIG_RCU_FANOUT_EXACT=n.
-TREE02.	CONFIG_NR_CPUS=8, CONFIG_RCU_FANOUT=3, CONFIG_RCU_FANOUT_EXACT=n,
-	CONFIG_RCU_FANOUT_LEAF=3.
-TREE03.	CONFIG_NR_CPUS=8, CONFIG_RCU_FANOUT=4, CONFIG_RCU_FANOUT_EXACT=n,
-	CONFIG_RCU_FANOUT_LEAF=4.
-TREE04.	CONFIG_NR_CPUS=8, CONFIG_RCU_FANOUT=2, CONFIG_RCU_FANOUT_EXACT=n,
-	CONFIG_RCU_FANOUT_LEAF=2.
-TREE05.	CONFIG_NR_CPUS=8, CONFIG_RCU_FANOUT=6, CONFIG_RCU_FANOUT_EXACT=n
-	CONFIG_RCU_FANOUT_LEAF=6.
-TREE06.	CONFIG_NR_CPUS=8, CONFIG_RCU_FANOUT=6, CONFIG_RCU_FANOUT_EXACT=y
-	CONFIG_RCU_FANOUT_LEAF=6.
-TREE07.	CONFIG_NR_CPUS=16, CONFIG_RCU_FANOUT=2, CONFIG_RCU_FANOUT_EXACT=n,
-	CONFIG_RCU_FANOUT_LEAF=2.
-TREE08.	CONFIG_NR_CPUS=16, CONFIG_RCU_FANOUT=3, CONFIG_RCU_FANOUT_EXACT=y,
-	CONFIG_RCU_FANOUT_LEAF=2.
-TREE09.	CONFIG_NR_CPUS=1.
+Boot parameters:
+
+nohz_full - do at least one.
+maxcpu -- do at least one.
+rcupdate.rcu_self_test_bh -- Do at least one each, offloaded and not.
+rcupdate.rcu_self_test_sched -- Do at least one each, offloaded and not.
+rcupdate.rcu_self_test -- Do at least one each, offloaded and not.
+rcutree.rcu_fanout_exact -- Do at least one.
 
 
 Kconfig Parameters Ignored:
#8 lore raw

PATCH 6/12 rcu: Enable diagnostic dump of rcu_node combining tree

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

The purpose of this commit is to make it easier to verify that RCU's combining tree is set up correctly, which is useful to have when making changes in how that tree is initialized.

---
 Documentation/kernel-parameters.txt |  5 +++++
 kernel/rcu/tree.c                   | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
Documentation/kernel-parameters.txt +5 -0
index 24b0d95acd45..1271ec79bd4f 100644
@@ -2968,6 +2968,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Set maximum number of finished RCU callbacks to
 			process in one batch.
 
+	rcutree.dump_tree=	[KNL]
+			Dump the structure of the rcu_node combining tree
+			out at early boot.  This is used for diagnostic
+			purposes, to verify correct tree setup.
+
 	rcutree.gp_cleanup_delay=	[KNL]
 			Set the number of jiffies to delay each step of
 			RCU grace-period cleanup.  This only has effect
kernel/rcu/tree.c +27 -0
index fdca17e7a1b5..c8b3700918e6 100644
@@ -114,6 +114,9 @@ static struct rcu_state *const rcu_state_p;
 static struct rcu_data __percpu *const rcu_data_p;
 LIST_HEAD(rcu_struct_flavors);
 
+/* Dump rcu_node combining tree at boot to verify correct setup. */
+static bool dump_tree;
+module_param(dump_tree, bool, 0444);
 /* Control rcu_node-tree auto-balancing at boot time. */
 static bool rcu_fanout_exact;
 module_param(rcu_fanout_exact, bool, 0444);
@@ -4117,6 +4120,28 @@ static void __init rcu_init_geometry(void)
 		rcu_num_nodes += num_rcu_lvl[i];
 }
 
+/*
+ * Dump out the structure of the rcu_node combining tree associated
+ * with the rcu_state structure referenced by rsp.
+ */
+void __init rcu_dump_rcu_node_tree(struct rcu_state *rsp)
+{
+	int level = 0;
+	struct rcu_node *rnp;
+
+	pr_info("rcu_node tree layout dump\n");
+	pr_info(" ");
+	rcu_for_each_node_breadth_first(rsp, rnp) {
+		if (rnp->level != level) {
+			pr_cont("\n");
+			pr_info(" ");
+			level = rnp->level;
+		}
+		pr_cont("%d:%d ^%d  ", rnp->grplo, rnp->grphi, rnp->grpnum);
+	}
+	pr_cont("\n");
+}
+
 void __init rcu_init(void)
 {
 	int cpu;
@@ -4127,6 +4152,8 @@ void __init rcu_init(void)
 	rcu_init_geometry();
 	rcu_init_one(&rcu_bh_state, &rcu_bh_data);
 	rcu_init_one(&rcu_sched_state, &rcu_sched_data);
+	if (dump_tree)
+		rcu_dump_rcu_node_tree(&rcu_sched_state);
 	__rcu_init_preempt();
 	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
 
Signature · 1 line
1.8.1.5
#9 lore raw

PATCH 7/12 rcu: Create RCU_EXPERT Kconfig and hide booleans behind it

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit creates an RCU_EXPERT Kconfig and hides the boolean RCU-related user-visible Kconfig parameters behind it, namely RCU_FAST_NO_HZ, RCU_BOOST, CONTEXT_TRACKING_FORCE, and RCU_NOCB_CPU. This prevents Kconfig from asking about these parameters unless the user really wants to be asked.

---
 init/Kconfig | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
init/Kconfig +19 -4
index 67598f3143f5..aa68d72fe051 100644
@@ -499,6 +499,21 @@ config TINY_RCU
 
 endchoice
 
+config RCU_EXPERT
+	bool "Make expert-level adjustments to RCU configuration"
+	default n
+	help
+	  This option needs to be enabled if you wish to make
+	  expert-level adjustments to RCU configuration.  By default,
+	  no such adjustments can be made, which has the often-beneficial
+	  side-effect of preventing "make oldconfig" from asking you all
+	  sorts of detailed questions about how you would like numerous
+	  obscure RCU options to be set up.
+
+	  Say Y if you need to make expert-level adjustments to RCU.
+
+	  Say N if you are unsure.
+
 config SRCU
 	bool
 	help
@@ -537,7 +552,7 @@ config RCU_USER_QS
 
 config CONTEXT_TRACKING_FORCE
 	bool "Force context tracking"
-	depends on CONTEXT_TRACKING
+	depends on CONTEXT_TRACKING && RCU_EXPERT
 	default y if !NO_HZ_FULL
 	help
 	  The major pre-requirement for full dynticks to work is to
@@ -611,7 +626,7 @@ config RCU_FANOUT_LEAF
 
 config RCU_FAST_NO_HZ
 	bool "Accelerate last non-dyntick-idle CPU's grace periods"
-	depends on NO_HZ_COMMON && SMP
+	depends on NO_HZ_COMMON && SMP && RCU_EXPERT
 	default n
 	help
 	  This option permits CPUs to enter dynticks-idle state even if
@@ -637,7 +652,7 @@ config TREE_RCU_TRACE
 
 config RCU_BOOST
 	bool "Enable RCU priority boosting"
-	depends on RT_MUTEXES && PREEMPT_RCU
+	depends on RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT
 	default n
 	help
 	  This option boosts the priority of preempted RCU readers that
@@ -693,7 +708,7 @@ config RCU_BOOST_DELAY
 
 config RCU_NOCB_CPU
 	bool "Offload RCU callback processing from boot-selected CPUs"
-	depends on TREE_RCU || PREEMPT_RCU
+	depends on (TREE_RCU || PREEMPT_RCU) && RCU_EXPERT
 	default n
 	help
 	  Use this option to reduce OS jitter for aggressive HPC or
Signature · 1 line
1.8.1.5
#10 lore raw

PATCH 8/12 rcutorture: Make rcutorture scripts force RCU_EXPERT

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit causes the rcutorture scripts to force RCU_EXPERT so that these scripts can cause rcutorture to torture RCU in the various required configurations. However, SRCU-P, TASKS03, and TREE09 retain !RCU_EXPERT in order to ensure testing of the vanilla configuration.

---
 tools/testing/selftests/rcutorture/configs/rcu/SRCU-N  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TASKS01 | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE01  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE02  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE03  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE04  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE05  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE06  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE07  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE08  | 1 +
 10 files changed, 10 insertions(+)
tools/testing/selftests/rcutorture/configs/rcu/SRCU-N +1 -0
index 9fbb41b9b314..1a087c3c8bb8 100644
@@ -5,3 +5,4 @@ CONFIG_HOTPLUG_CPU=y
 CONFIG_PREEMPT_NONE=y
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TASKS01 +1 -0
index 32c5de503316..9318de8d5e88 100644
@@ -6,3 +6,4 @@ CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_RCU=y
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE01 +1 -0
index f8a10a7500c6..8e9137f66831 100644
@@ -16,3 +16,4 @@ CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE02 +1 -0
index ea131cc5f7dd..aeea6a204d14 100644
@@ -20,3 +20,4 @@ CONFIG_PROVE_LOCKING=n
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE03 +1 -0
index d75d986fa688..72aa7d87ea99 100644
@@ -17,3 +17,4 @@ CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_RCU_BOOST=y
 CONFIG_RCU_KTHREAD_PRIO=2
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE04 +1 -0
index 30b0a5679e48..d34e4b05941f 100644
@@ -19,3 +19,4 @@ CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_CPU_STALL_INFO=y
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE05 +1 -0
index 79572319896f..2f9b93a777dd 100644
@@ -19,3 +19,4 @@ CONFIG_PROVE_LOCKING=y
 CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE06 +1 -0
index b94c400def4a..f7b2e87af79a 100644
@@ -20,3 +20,4 @@ CONFIG_PROVE_LOCKING=y
 CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE07 +1 -0
index d715f99c3297..ce18d597b553 100644
@@ -19,3 +19,4 @@ CONFIG_RCU_NOCB_CPU=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_CPU_STALL_INFO=y
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TREE08 +1 -0
index 5f77ebeec4d1..fc1fed642917 100644
@@ -22,3 +22,4 @@ CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
Signature · 1 line
1.8.1.5
#11 lore raw

PATCH 9/12 rcu: Break dependency of RCU_FANOUT_LEAF on RCU_FANOUT

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

RCU_FANOUT_LEAF's range and default values depend on the value of RCU_FANOUT, which at the time seemed like a cute way to save two lines of Kconfig code. However, adding a dependency from both of these Kconfig parameters on RCU_EXPERT requires that RCU_FANOUT_LEAF operate correctly even if RCU_FANOUT is undefined. This commit therefore allows RCU_FANOUT_LEAF to take on the full range of permitted values, even in cases where RCU_FANOUT is undefined.

---
 init/Kconfig | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
init/Kconfig +4 -2
index aa68d72fe051..35559e07db18 100644
@@ -599,9 +599,11 @@ config RCU_FANOUT
 
 config RCU_FANOUT_LEAF
 	int "Tree-based hierarchical RCU leaf-level fanout value"
-	range 2 RCU_FANOUT if 64BIT
-	range 2 RCU_FANOUT if !64BIT
+	range 2 64 if 64BIT
+	range 2 32 if !64BIT
 	depends on TREE_RCU || PREEMPT_RCU
+	default 64 if 64BIT
+	default 32 if !64BIT
 	default 16
 	help
 	  This option controls the leaf-level fanout of hierarchical
Signature · 1 line
1.8.1.5
#12 lore raw

Re: [PATCH tip/core/rcu 09/12] rcu: Break dependency of RCU_FANOUT_LEAF on RCU_FANOUT

Quoted 21 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

RCU_FANOUT_LEAF's range and default values depend on the value of RCU_FANOUT, which at the time seemed like a cute way to save two lines of Kconfig code. However, adding a dependency from both of these Kconfig parameters on RCU_EXPERT requires that RCU_FANOUT_LEAF operate correctly even if RCU_FANOUT is undefined. This commit therefore allows RCU_FANOUT_LEAF to take on the full range of permitted values, even in cases where RCU_FANOUT is undefined.

---
 init/Kconfig | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
init/Kconfig +0 -0
index aa68d72fe051..35559e07db18 100644
@@ -599,9 +599,11 @@ config RCU_FANOUT
 

init/Kconfig config RCU_FANOUT · line 607

Quoted 10 lines
init/Kconfig +4 -2
 config RCU_FANOUT_LEAF
        int "Tree-based hierarchical RCU leaf-level fanout value"
-       range 2 RCU_FANOUT if 64BIT
-       range 2 RCU_FANOUT if !64BIT
+       range 2 64 if 64BIT
+       range 2 32 if !64BIT
        depends on TREE_RCU || PREEMPT_RCU
+       default 64 if 64BIT
+       default 32 if !64BIT
        default 16

What is the effect of this 'default 16' line? It is either 64 or 32 based on 64BIT, not sure when it is 16...

Quoted 5 lines
init/Kconfig +0 -1
        help
          This option controls the leaf-level fanout of hierarchical
--

1.8.1.5

Signature · 1 line
Pranith
#13 lore raw

Re: [PATCH tip/core/rcu 09/12] rcu: Break dependency of RCU_FANOUT_LEAF on RCU_FANOUT

Quoted 23 lines · Pranith Kumar
Quoted 21 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

RCU_FANOUT_LEAF's range and default values depend on the value of RCU_FANOUT, which at the time seemed like a cute way to save two lines of Kconfig code. However, adding a dependency from both of these Kconfig parameters on RCU_EXPERT requires that RCU_FANOUT_LEAF operate correctly even if RCU_FANOUT is undefined. This commit therefore allows RCU_FANOUT_LEAF to take on the full range of permitted values, even in cases where RCU_FANOUT is undefined.

---
 init/Kconfig | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
init/Kconfig +0 -0
index aa68d72fe051..35559e07db18 100644
@@ -599,9 +599,11 @@ config RCU_FANOUT
 
Quoted 13 lines

init/Kconfig config RCU_FANOUT · line 607

Quoted 10 lines
init/Kconfig +4 -2
 config RCU_FANOUT_LEAF
        int "Tree-based hierarchical RCU leaf-level fanout value"
-       range 2 RCU_FANOUT if 64BIT
-       range 2 RCU_FANOUT if !64BIT
+       range 2 64 if 64BIT
+       range 2 32 if !64BIT
        depends on TREE_RCU || PREEMPT_RCU
+       default 64 if 64BIT
+       default 32 if !64BIT
        default 16

What is the effect of this 'default 16' line? It is either 64 or 32 based on 64BIT, not sure when it is 16...

Good catch, fixes to delete the two added "default" statements. The default thus is now 16, as it was before.

Thanx, Paul

#14 lore raw

PATCH 10/12 rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit introduces an RCU_FANOUT C-preprocessor macro so that RCU will build even when CONFIG_RCU_FANOUT is undefined. The RCU_FANOUT macro is set to the value of CONFIG_RCU_FANOUT when defined, otherwise it is set to 32 for 32-bit systems and 64 for 64-bit systems. This commit then makes CONFIG_RCU_FANOUT depend on CONFIG_RCU_EXPERT, so that Kconfig users won't be asked about CONFIG_RCU_FANOUT unless they want to be.

---
 init/Kconfig             |  2 +-
 kernel/rcu/tree.c        |  4 ++--
 kernel/rcu/tree.h        | 17 ++++++++++++++---
 kernel/rcu/tree_plugin.h |  6 +++---
 4 files changed, 20 insertions(+), 9 deletions(-)
init/Kconfig +1 -1
index 35559e07db18..efb098ac159d 100644
@@ -581,7 +581,7 @@ config RCU_FANOUT
 	int "Tree-based hierarchical RCU fanout value"
 	range 2 64 if 64BIT
 	range 2 32 if !64BIT
-	depends on TREE_RCU || PREEMPT_RCU
+	depends on (TREE_RCU || PREEMPT_RCU) && RCU_EXPERT
 	default 64 if 64BIT
 	default 32 if !64BIT
 	help
kernel/rcu/tree.c +2 -2
index c8b3700918e6..6fb8e2f0ec19 100644
@@ -3952,7 +3952,7 @@ static void __init rcu_init_levelspread(int *levelspread, const int *levelcnt)
 	if (rcu_fanout_exact) {
 		levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
 		for (i = rcu_num_lvls - 2; i >= 0; i--)
-			levelspread[i] = CONFIG_RCU_FANOUT;
+			levelspread[i] = RCU_FANOUT;
 	} else {
 		int ccur;
 		int cprv;
@@ -4083,7 +4083,7 @@ static void __init rcu_init_geometry(void)
 	 */
 	rcu_capacity[0] = rcu_fanout_leaf;
 	for (i = 1; i < RCU_NUM_LVLS; i++)
-		rcu_capacity[i] = rcu_capacity[i - 1] * CONFIG_RCU_FANOUT;
+		rcu_capacity[i] = rcu_capacity[i - 1] * RCU_FANOUT;
 
 	/*
 	 * The tree must be able to accommodate the configured number of CPUs.
kernel/rcu/tree.h +14 -3
index f12fe832dbd3..ecb259273139 100644
@@ -35,10 +35,21 @@
  * In practice, this did work well going from three levels to four.
  * Of course, your mileage may vary.
  */
+
+#ifdef CONFIG_RCU_FANOUT
+#define RCU_FANOUT CONFIG_RCU_FANOUT
+#else /* #ifdef CONFIG_RCU_FANOUT */
+# ifdef CONFIG_64BIT
+# define RCU_FANOUT 64
+# else
+# define RCU_FANOUT 32
+# endif
+#endif /* #else #ifdef CONFIG_RCU_FANOUT */
+
 #define RCU_FANOUT_1	      (CONFIG_RCU_FANOUT_LEAF)
-#define RCU_FANOUT_2	      (RCU_FANOUT_1 * CONFIG_RCU_FANOUT)
-#define RCU_FANOUT_3	      (RCU_FANOUT_2 * CONFIG_RCU_FANOUT)
-#define RCU_FANOUT_4	      (RCU_FANOUT_3 * CONFIG_RCU_FANOUT)
+#define RCU_FANOUT_2	      (RCU_FANOUT_1 * RCU_FANOUT)
+#define RCU_FANOUT_3	      (RCU_FANOUT_2 * RCU_FANOUT)
+#define RCU_FANOUT_4	      (RCU_FANOUT_3 * RCU_FANOUT)
 
 #if NR_CPUS <= RCU_FANOUT_1
 #  define RCU_NUM_LVLS	      1
kernel/rcu/tree_plugin.h +3 -3
index 074689cedda9..2e52502bfc95 100644
@@ -70,10 +70,10 @@ static void __init rcu_bootup_announce_oddness(void)
 {
 	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))
+	if ((IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 64) ||
+	    (!IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 32))
 		pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
-		       CONFIG_RCU_FANOUT);
+		       RCU_FANOUT);
 	if (rcu_fanout_exact)
 		pr_info("\tHierarchical RCU autobalancing is disabled.\n");
 	if (IS_ENABLED(CONFIG_RCU_FAST_NO_HZ))
Signature · 1 line
1.8.1.5
#15 lore raw

PATCH 11/12 rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT_LEAF

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit introduces an RCU_FANOUT_LEAF C-preprocessor macro so that RCU will build even when CONFIG_RCU_FANOUT_LEAF is undefined. The RCU_FANOUT_LEAF macro is set to the value of CONFIG_RCU_FANOUT_LEAF when defined, otherwise it is set to 32 for 32-bit systems and 64 for 64-bit systems. This commit then makes CONFIG_RCU_FANOUT_LEAF depend on CONFIG_RCU_EXPERT, so that Kconfig users won't be asked about CONFIG_RCU_FANOUT_LEAF unless they want to be.

---
 init/Kconfig             |  2 +-
 kernel/rcu/tree.c        |  8 ++++----
 kernel/rcu/tree.h        | 12 +++++++++++-
 kernel/rcu/tree_plugin.h |  6 +++---
 4 files changed, 19 insertions(+), 9 deletions(-)
init/Kconfig +1 -1
index efb098ac159d..17285e8e555d 100644
@@ -601,7 +601,7 @@ config RCU_FANOUT_LEAF
 	int "Tree-based hierarchical RCU leaf-level fanout value"
 	range 2 64 if 64BIT
 	range 2 32 if !64BIT
-	depends on TREE_RCU || PREEMPT_RCU
+	depends on (TREE_RCU || PREEMPT_RCU) && RCU_EXPERT
 	default 64 if 64BIT
 	default 32 if !64BIT
 	default 16
kernel/rcu/tree.c +4 -4
index 6fb8e2f0ec19..0a6d46df2194 100644
@@ -120,8 +120,8 @@ module_param(dump_tree, bool, 0444);
 /* Control rcu_node-tree auto-balancing at boot time. */
 static bool rcu_fanout_exact;
 module_param(rcu_fanout_exact, bool, 0444);
-/* Increase (but not decrease) the CONFIG_RCU_FANOUT_LEAF at boot time. */
-static int rcu_fanout_leaf = CONFIG_RCU_FANOUT_LEAF;
+/* Increase (but not decrease) the RCU_FANOUT_LEAF at boot time. */
+static int rcu_fanout_leaf = RCU_FANOUT_LEAF;
 module_param(rcu_fanout_leaf, int, 0444);
 int rcu_num_lvls __read_mostly = RCU_NUM_LVLS;
 /* Number of rcu_nodes at specified level. */
@@ -4071,7 +4071,7 @@ static void __init rcu_init_geometry(void)
 		jiffies_till_next_fqs = d;
 
 	/* If the compile-time values are accurate, just leave. */
-	if (rcu_fanout_leaf == CONFIG_RCU_FANOUT_LEAF &&
+	if (rcu_fanout_leaf == RCU_FANOUT_LEAF &&
 	    nr_cpu_ids == NR_CPUS)
 		return;
 	pr_info("RCU: Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%d\n",
@@ -4097,7 +4097,7 @@ static void __init rcu_init_geometry(void)
 	 */
 	if (nr_cpu_ids > rcu_capacity[RCU_NUM_LVLS - 1])
 		panic("rcu_init_geometry: rcu_capacity[] is too small");
-	else if (rcu_fanout_leaf < CONFIG_RCU_FANOUT_LEAF ||
+	else if (rcu_fanout_leaf < RCU_FANOUT_LEAF ||
 		 rcu_fanout_leaf > sizeof(unsigned long) * 8) {
 		WARN_ON(1);
 		return;
kernel/rcu/tree.h +11 -1
index ecb259273139..da9f6adb5ff9 100644
@@ -46,7 +46,17 @@
 # endif
 #endif /* #else #ifdef CONFIG_RCU_FANOUT */
 
-#define RCU_FANOUT_1	      (CONFIG_RCU_FANOUT_LEAF)
+#ifdef CONFIG_RCU_FANOUT_LEAF
+#define RCU_FANOUT_LEAF CONFIG_RCU_FANOUT_LEAF
+#else /* #ifdef CONFIG_RCU_FANOUT_LEAF */
+# ifdef CONFIG_64BIT
+# define RCU_FANOUT_LEAF 64
+# else
+# define RCU_FANOUT_LEAF 32
+# endif
+#endif /* #else #ifdef CONFIG_RCU_FANOUT_LEAF */
+
+#define RCU_FANOUT_1	      (RCU_FANOUT_LEAF)
 #define RCU_FANOUT_2	      (RCU_FANOUT_1 * RCU_FANOUT)
 #define RCU_FANOUT_3	      (RCU_FANOUT_2 * RCU_FANOUT)
 #define RCU_FANOUT_4	      (RCU_FANOUT_3 * RCU_FANOUT)
kernel/rcu/tree_plugin.h +3 -3
index 2e52502bfc95..a2f64e4fdb57 100644
@@ -86,10 +86,10 @@ static void __init rcu_bootup_announce_oddness(void)
 		pr_info("\tAdditional per-CPU info printed with stalls.\n");
 	if (RCU_NUM_LVLS >= 4)
 		pr_info("\tFour(or more)-level hierarchy is enabled.\n");
-	if (CONFIG_RCU_FANOUT_LEAF != 16)
+	if (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)
+			RCU_FANOUT_LEAF);
+	if (rcu_fanout_leaf != 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);
Signature · 1 line
1.8.1.5
#16 lore raw

Re: [PATCH tip/core/rcu 11/12] rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT_LEAF

kernel/rcu/tree_plugin.h static void __init rcu_bootup_announce_oddness(void) · line 89

Quoted 10 lines · Paul E. McKenney
kernel/rcu/tree_plugin.h +1 -1
index 2e52502bfc95..a2f64e4fdb57 100644
@@ -86,10 +86,10 @@ static void __init rcu_bootup_announce_oddness(void)
                pr_info("\tAdditional per-CPU info printed with stalls.\n");
        if (RCU_NUM_LVLS >= 4)
                pr_info("\tFour(or more)-level hierarchy is enabled.\n");
-       if (CONFIG_RCU_FANOUT_LEAF != 16)
+       if (RCU_FANOUT_LEAF != 16)

So if CONFIG_RCU_FANOUT_LEAF is either by default 32 or 64, this check against 16 for build-time adjustment is a bit misleading, no?

Signature · 1 line
Pranith
#17 lore raw

Re: [PATCH tip/core/rcu 11/12] rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT_LEAF

Quoted 16 lines · Pranith Kumar

kernel/rcu/tree_plugin.h static void __init rcu_bootup_announce_oddness(void) · line 89

Quoted 10 lines · Paul E. McKenney
kernel/rcu/tree_plugin.h +1 -1
index 2e52502bfc95..a2f64e4fdb57 100644
@@ -86,10 +86,10 @@ static void __init rcu_bootup_announce_oddness(void)
                pr_info("\tAdditional per-CPU info printed with stalls.\n");
        if (RCU_NUM_LVLS >= 4)
                pr_info("\tFour(or more)-level hierarchy is enabled.\n");
-       if (CONFIG_RCU_FANOUT_LEAF != 16)
+       if (RCU_FANOUT_LEAF != 16)

So if CONFIG_RCU_FANOUT_LEAF is either by default 32 or 64, this check against 16 for build-time adjustment is a bit misleading, no?

Indeed!

However, with the fix that puts the default back to 16, this should be once again correct.

Thanx, Paul

#18 lore raw

PATCH 12/12 rcu: Make RCU able to tolerate undefined CONFIG_RCU_KTHREAD_PRIO

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

This commit updates the initialization of the kthread_prio boot parameter so that RCU will build even when CONFIG_RCU_KTHREAD_PRIO is undefined. The kthread_prio boot parameter is set to CONFIG_RCU_KTHREAD_PRIO if that is defined, otherwise to 1 if CONFIG_RCU_BOOST is defined and to zero otherwise. This commit then makes CONFIG_RCU_KTHREAD_PRIO depend on CONFIG_RCU_EXPERT, so that Kconfig users won't be asked about CONFIG_RCU_KTHREAD_PRIO unless they want to be.

---
 init/Kconfig      | 1 +
 kernel/rcu/tree.c | 4 ++++
 2 files changed, 5 insertions(+)
init/Kconfig +1 -0
index 17285e8e555d..9d6e9ffb47f1 100644
@@ -671,6 +671,7 @@ config RCU_KTHREAD_PRIO
 	range 0 99 if !RCU_BOOST
 	default 1 if RCU_BOOST
 	default 0 if !RCU_BOOST
+	depends on RCU_EXPERT
 	help
 	  This option specifies the SCHED_FIFO priority value that will be
 	  assigned to the rcuc/n and rcub/n threads and is also the value
kernel/rcu/tree.c +4 -0
index 0a6d46df2194..b432f2ea6bba 100644
@@ -161,7 +161,11 @@ static void invoke_rcu_core(void);
 static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp);
 
 /* rcuc/rcub kthread realtime priority */
+#ifdef CONFIG_RCU_KTHREAD_PRIO
 static int kthread_prio = CONFIG_RCU_KTHREAD_PRIO;
+#else /* #ifdef CONFIG_RCU_KTHREAD_PRIO */
+static int kthread_prio = IS_ENABLED(CONFIG_RCU_BOOST) ? 1 : 0;
+#endif /* #else #ifdef CONFIG_RCU_KTHREAD_PRIO */
 module_param(kthread_prio, int, 0644);
 
 /* Delay in jiffies for grace-period initialization delays, debug only. */
Signature · 1 line
1.8.1.5
Reviewed-by on the v1 series
#19 lore raw
In reply to Paul E. McKenney
Quoted 48 lines · Paul E. McKenney

Hello!

This patch series reduces the number of questions that RCU asks Kconfig users. After this series is applied, removing the RCU-related definitions from .config and running "make oldconfig" results in only the following:

RCU Implementation

Quoted 1 line

1. Tree-based hierarchical RCU (TREE_RCU) (NEW)

choice[1]: 1
Make expert-level adjustments to RCU configuration (RCU_EXPERT) [N/y/?] (NEW)

Those expert users wishing to tune RCU answer Y to this question.

The patches in this series are as follows:

1. Drive TASKS_RCU directly from Kconfig, for example, by having
RCU_TORTURE_TESTS select it.

2. Remove CONFIG_TASKS_RCU=y from the three TASKS_RCU test
scenarios, since this is set by virtue of having rcutorture configured.

3. Drive RCU_USER_QS directly from Kconfig, relying on the fact
that NO_HZ_FULL selects it.

4. Convert CONFIG_RCU_FANOUT_EXACT to a boot parameter, where it
is used by rcutorture.

5. Update rcutorture test scenarios to use the boot parameter
created in #4 instead of the Kconfig parameter.

6. Create a boot parameter to do a diagnostic dump of the shape
of the rcu_node combining tree, which is useful for verifying that intended changes to that tree actually happened.

7. Create an RCU_EXPERT Kconfig parameter and hide the
RCU_FAST_NO_HZ, RCU_BOOST, CONTEXT_TRACKING_FORCE, and RCU_NOCB_CPU boolean parameters behind it.

8. Make rcutorture test scenarios force RCU_EXPERT, but have
SRCU-P, TASKS03, and TREE09 retain !RCU_EXPERT in order to test the vanilla configuration.

9. Remove the dependency of RCU_FANOUT_LEAF on RCU_FANOUT.

10. Change RCU to allow it to tolerate an undefined RCU_FANOUT,
and then hide RCU_FANOUT behind RCU_EXPERT.

Quoted 8 lines

11. Change RCU to allow it to tolerate an undefined RCU_FANOUT_LEAF,
and then hide RCU_FANOUT_LEAF behind RCU_EXPERT.

12. Change RCU to allow it to tolerate an undefined RCU_KTHREAD_PRIO,
and then hide RCU_KTHREAD_PRIO behind RCU_EXPERT.

Thanx, Paul

With or without the minor changes:

Signature · 1 line
Pranith