rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rcu 0/12] RCU-tasks torture-test updates
@ 2022-04-19  0:11 Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 01/12] rcu: Make TASKS_RUDE_RCU select IRQ_WORK Paul E. McKenney
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:11 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt

Hello!

This series contains torture-tests updates for the RCU tasks flavors,
most notably ensuring that building rcutorture and friends does not
change the RCU-tasks-related Kconfig options.

1.	Make TASKS_RUDE_RCU select IRQ_WORK.

2.	Make the TASKS_RCU Kconfig option be selected.

3.	Allow rcutorture without RCU Tasks Trace.

4.	Allow rcutorture without RCU Tasks.

5.	Allow rcutorture without RCU Tasks Rude.

6.	Add CONFIG_PREEMPT_DYNAMIC=n to TASKS02 scenario.

7.	Allow specifying per-scenario stat_interval.

8.	Allow refscale without RCU Tasks.

9.	Allow refscale without RCU Tasks Rude/Trace.

10.	Allow rcuscale without RCU Tasks.

11.	Allow rcuscale without RCU Tasks Rude/Trace.

12.	Adjust for TASKS_RCU Kconfig option being selected.

						Thanx, Paul

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

 b/arch/Kconfig                                                    |    1 
 b/kernel/bpf/Kconfig                                              |    1 
 b/kernel/rcu/Kconfig                                              |    1 
 b/kernel/rcu/Kconfig.debug                                        |    1 
 b/kernel/rcu/rcuscale.c                                           |   12 +
 b/kernel/rcu/rcutorture.c                                         |  101 +++++-----
 b/kernel/rcu/refscale.c                                           |   12 +
 b/kernel/trace/Kconfig                                            |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/RUDE01           |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N           |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS01          |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02          |    3 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02.boot     |    1 
 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS03          |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TRACE01          |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TRACE02          |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/TREE09           |    2 
 b/tools/testing/selftests/rcutorture/configs/rcu/ver_functions.sh |   16 +
 b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon    |    4 
 b/tools/testing/selftests/rcutorture/configs/rcuscale/TREE        |    2 
 b/tools/testing/selftests/rcutorture/configs/refscale/CFcommon    |    2 
 b/tools/testing/selftests/rcutorture/configs/refscale/NOPREEMPT   |    2 
 b/tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT        |    2 
 b/tools/testing/selftests/rcutorture/configs/scf/PREEMPT          |    1 
 kernel/rcu/Kconfig                                                |   64 ++++--
 kernel/rcu/Kconfig.debug                                          |    8 
 kernel/rcu/rcuscale.c                                             |   12 +
 kernel/rcu/rcutorture.c                                           |   26 ++
 kernel/rcu/refscale.c                                             |   12 +
 tools/testing/selftests/rcutorture/configs/rcu/TASKS02            |    1 
 tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon      |    3 
 tools/testing/selftests/rcutorture/configs/refscale/CFcommon      |    2 
 32 files changed, 219 insertions(+), 85 deletions(-)

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

* [PATCH rcu 01/12] rcu: Make TASKS_RUDE_RCU select IRQ_WORK
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected Paul E. McKenney
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney, Hyeonggon Yoo

The TASKS_RUDE_RCU does not select IRQ_WORK, which can result in build
failures for kernels that do not otherwise select IRQ_WORK.  This commit
therefore causes the TASKS_RUDE_RCU Kconfig option to select IRQ_WORK.

Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index bf8e341e75b4..f559870fbf8b 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -86,6 +86,7 @@ config TASKS_RCU
 
 config TASKS_RUDE_RCU
 	def_bool 0
+	select IRQ_WORK
 	help
 	  This option enables a task-based RCU implementation that uses
 	  only context switch (including preemption) and user-mode
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 01/12] rcu: Make TASKS_RUDE_RCU select IRQ_WORK Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19 14:13   ` Masami Hiramatsu
  2022-04-19  0:12 ` [PATCH rcu 03/12] rcutorture: Allow rcutorture without RCU Tasks Trace Paul E. McKenney
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney,
	Hyeonggon Yoo, Zhouyi Zhou, Andrii Nakryiko, Alexei Starovoitov,
	Mathieu Desnoyers, Masami Hiramatsu

Currently, any kernel built with CONFIG_PREEMPTION=y also gets
CONFIG_TASKS_RCU=y, which is not helpful to people trying to build
preemptible kernels of minimal size.

Because CONFIG_TASKS_RCU=y is needed only in kernels doing tracing of
one form or another, this commit moves from TASKS_RCU deciding when it
should be enabled to the tracing Kconfig options explicitly selecting it.
This allows building preemptible kernels without TASKS_RCU, if desired.

This commit also updates the SRCU-N and TREE09 rcutorture scenarios
in order to avoid Kconfig errors that would otherwise result from
CONFIG_TASKS_RCU being selected without its CONFIG_RCU_EXPERT dependency
being met.

[ paulmck: Apply BPF_SYSCALL feedback from Andrii Nakryiko. ]

Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Tested-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

--- Update SRCU-N and TREE09 to avoid Kconfig errors.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 arch/Kconfig                                          | 1 +
 kernel/bpf/Kconfig                                    | 1 +
 kernel/rcu/Kconfig                                    | 3 ++-
 kernel/trace/Kconfig                                  | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/SRCU-N | 2 ++
 tools/testing/selftests/rcutorture/configs/rcu/TREE09 | 2 ++
 6 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 29b0167c088b..1bf29ce754af 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -35,6 +35,7 @@ config KPROBES
 	depends on MODULES
 	depends on HAVE_KPROBES
 	select KALLSYMS
+	select TASKS_RCU if PREEMPTION
 	help
 	  Kprobes allows you to trap at almost any kernel address and
 	  execute a callback function.  register_kprobe() establishes
diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig
index d56ee177d5f8..2dfe1079f772 100644
--- a/kernel/bpf/Kconfig
+++ b/kernel/bpf/Kconfig
@@ -27,6 +27,7 @@ config BPF_SYSCALL
 	bool "Enable bpf() system call"
 	select BPF
 	select IRQ_WORK
+	select TASKS_RCU if PREEMPTION
 	select TASKS_TRACE_RCU
 	select BINARY_PRINTF
 	select NET_SOCK_MSG if NET
diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index f559870fbf8b..4f665ae0cf55 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -78,7 +78,8 @@ config TASKS_RCU_GENERIC
 	  task-based RCU implementations.  Not for manual selection.
 
 config TASKS_RCU
-	def_bool PREEMPTION
+	def_bool 0
+	select IRQ_WORK
 	help
 	  This option enables a task-based RCU implementation that uses
 	  only voluntary context switch (not preemption!), idle, and
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 2c43e327a619..bf5da6c4e999 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -144,6 +144,7 @@ config TRACING
 	select BINARY_PRINTF
 	select EVENT_TRACING
 	select TRACE_CLOCK
+	select TASKS_RCU if PREEMPTION
 
 config GENERIC_TRACER
 	bool
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
index 2da8b49589a0..07f5e0a70ae7 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
+++ b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
@@ -6,3 +6,5 @@ CONFIG_PREEMPT_NONE=y
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=n
 #CHECK#CONFIG_RCU_EXPERT=n
+CONFIG_KPROBES=n
+CONFIG_FTRACE=n
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE09 b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
index 8523a7515cbf..fc45645bb5f4 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE09
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
@@ -13,3 +13,5 @@ CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 #CHECK#CONFIG_RCU_EXPERT=n
+CONFIG_KPROBES=n
+CONFIG_FTRACE=n
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 03/12] rcutorture: Allow rcutorture without RCU Tasks Trace
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 01/12] rcu: Make TASKS_RUDE_RCU select IRQ_WORK Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 04/12] rcutorture: Allow rcutorture without RCU Tasks Paul E. McKenney
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Unless a kernel builds rcutorture, whether built-in or as a module, that
kernel is also built with CONFIG_TASKS_TRACE_RCU, whether anything else
needs Tasks Trace RCU or not.  This unnecessarily increases kernel size.
This commit therefore decouples the presence of rcutorture from the
presence of RCU Tasks Trace.

However, there is a need to select CONFIG_TASKS_TRACE_RCU for
testing purposes.  Except that casual users must not be bothered with
questions -- for them, this needs to be fully automated.  There is thus
a CONFIG_FORCE_TASKS_TRACE_RCU that selects CONFIG_TASKS_TRACE_RCU,
is user-selectable, but which depends on CONFIG_RCU_EXPERT.

[ paulmck: Apply kernel test robot feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig                            |  22 ++--
 kernel/rcu/Kconfig.debug                      |   1 -
 kernel/rcu/rcutorture.c                       | 101 ++++++++++--------
 .../selftests/rcutorture/configs/rcu/TRACE01  |   2 +
 .../selftests/rcutorture/configs/rcu/TRACE02  |   2 +
 5 files changed, 75 insertions(+), 53 deletions(-)

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index 4f665ae0cf55..2befd328e6a0 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -95,15 +95,23 @@ config TASKS_RUDE_RCU
 	  switches on all online CPUs, including idle ones, so use
 	  with caution.
 
-config TASKS_TRACE_RCU
-	def_bool 0
-	select IRQ_WORK
+config FORCE_TASKS_TRACE_RCU
+	bool "Force selection of Tasks Trace RCU"
+	depends on RCU_EXPERT
+	select TASKS_TRACE_RCU
+	default n
 	help
 	  This option enables a task-based RCU implementation that uses
 	  explicit rcu_read_lock_trace() read-side markers, and allows
-	  these readers to appear in the idle loop as well as on the CPU
-	  hotplug code paths.  It can force IPIs on online CPUs, including
-	  idle ones, so use with caution.
+	  these readers to appear in the idle loop as well as on the
+	  CPU hotplug code paths.  It can force IPIs on online CPUs,
+	  including idle ones, so use with caution.  Not for manual
+	  selection in most cases.
+
+config TASKS_TRACE_RCU
+	bool
+	default n
+	select IRQ_WORK
 
 config RCU_STALL_COMMON
 	def_bool TREE_RCU
@@ -227,7 +235,7 @@ config RCU_NOCB_CPU
 
 config TASKS_TRACE_RCU_READ_MB
 	bool "Tasks Trace RCU readers use memory barriers in user and idle"
-	depends on RCU_EXPERT
+	depends on RCU_EXPERT && TASKS_TRACE_RCU
 	default PREEMPT_RT || NR_CPUS < 8
 	help
 	  Use this option to further reduce the number of IPIs sent
diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index 4fd64999300f..d7f4bb1c4979 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -49,7 +49,6 @@ config RCU_TORTURE_TEST
 	select SRCU
 	select TASKS_RCU
 	select TASKS_RUDE_RCU
-	select TASKS_TRACE_RCU
 	default n
 	help
 	  This option provides a kernel module that runs torture tests
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 55d049c39608..7dd3e14ec907 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -737,6 +737,48 @@ static struct rcu_torture_ops busted_srcud_ops = {
 	.name		= "busted_srcud"
 };
 
+/*
+ * Definitions for trivial CONFIG_PREEMPT=n-only torture testing.
+ * This implementation does not necessarily work well with CPU hotplug.
+ */
+
+static void synchronize_rcu_trivial(void)
+{
+	int cpu;
+
+	for_each_online_cpu(cpu) {
+		rcutorture_sched_setaffinity(current->pid, cpumask_of(cpu));
+		WARN_ON_ONCE(raw_smp_processor_id() != cpu);
+	}
+}
+
+static int rcu_torture_read_lock_trivial(void) __acquires(RCU)
+{
+	preempt_disable();
+	return 0;
+}
+
+static void rcu_torture_read_unlock_trivial(int idx) __releases(RCU)
+{
+	preempt_enable();
+}
+
+static struct rcu_torture_ops trivial_ops = {
+	.ttype		= RCU_TRIVIAL_FLAVOR,
+	.init		= rcu_sync_torture_init,
+	.readlock	= rcu_torture_read_lock_trivial,
+	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
+	.readunlock	= rcu_torture_read_unlock_trivial,
+	.readlock_held	= torture_readlock_not_held,
+	.get_gp_seq	= rcu_no_completed,
+	.sync		= synchronize_rcu_trivial,
+	.exp_sync	= synchronize_rcu_trivial,
+	.fqs		= NULL,
+	.stats		= NULL,
+	.irq_capable	= 1,
+	.name		= "trivial"
+};
+
 /*
  * Definitions for RCU-tasks torture testing.
  */
@@ -780,48 +822,6 @@ static struct rcu_torture_ops tasks_ops = {
 	.name		= "tasks"
 };
 
-/*
- * Definitions for trivial CONFIG_PREEMPT=n-only torture testing.
- * This implementation does not necessarily work well with CPU hotplug.
- */
-
-static void synchronize_rcu_trivial(void)
-{
-	int cpu;
-
-	for_each_online_cpu(cpu) {
-		rcutorture_sched_setaffinity(current->pid, cpumask_of(cpu));
-		WARN_ON_ONCE(raw_smp_processor_id() != cpu);
-	}
-}
-
-static int rcu_torture_read_lock_trivial(void) __acquires(RCU)
-{
-	preempt_disable();
-	return 0;
-}
-
-static void rcu_torture_read_unlock_trivial(int idx) __releases(RCU)
-{
-	preempt_enable();
-}
-
-static struct rcu_torture_ops trivial_ops = {
-	.ttype		= RCU_TRIVIAL_FLAVOR,
-	.init		= rcu_sync_torture_init,
-	.readlock	= rcu_torture_read_lock_trivial,
-	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
-	.readunlock	= rcu_torture_read_unlock_trivial,
-	.readlock_held	= torture_readlock_not_held,
-	.get_gp_seq	= rcu_no_completed,
-	.sync		= synchronize_rcu_trivial,
-	.exp_sync	= synchronize_rcu_trivial,
-	.fqs		= NULL,
-	.stats		= NULL,
-	.irq_capable	= 1,
-	.name		= "trivial"
-};
-
 /*
  * Definitions for rude RCU-tasks torture testing.
  */
@@ -851,6 +851,8 @@ static struct rcu_torture_ops tasks_rude_ops = {
 	.name		= "tasks-rude"
 };
 
+#ifdef CONFIG_TASKS_TRACE_RCU
+
 /*
  * Definitions for tracing RCU-tasks torture testing.
  */
@@ -893,6 +895,15 @@ static struct rcu_torture_ops tasks_tracing_ops = {
 	.name		= "tasks-tracing"
 };
 
+#define TASKS_TRACING_OPS &tasks_tracing_ops,
+
+#else // #ifdef CONFIG_TASKS_TRACE_RCU
+
+#define TASKS_TRACING_OPS
+
+#endif // #else #ifdef CONFIG_TASKS_TRACE_RCU
+
+
 static unsigned long rcutorture_seq_diff(unsigned long new, unsigned long old)
 {
 	if (!cur_ops->gp_diff)
@@ -3096,9 +3107,9 @@ rcu_torture_init(void)
 	int flags = 0;
 	unsigned long gp_seq = 0;
 	static struct rcu_torture_ops *torture_ops[] = {
-		&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops,
-		&busted_srcud_ops, &tasks_ops, &tasks_rude_ops,
-		&tasks_tracing_ops, &trivial_ops,
+		&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops, &busted_srcud_ops,
+		&tasks_ops, &tasks_rude_ops, TASKS_TRACING_OPS
+		&trivial_ops,
 	};
 
 	if (!torture_init_begin(torture_type, verbose))
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TRACE01 b/tools/testing/selftests/rcutorture/configs/rcu/TRACE01
index e4d74e5fc1d0..0f5605ed1e48 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TRACE01
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TRACE01
@@ -7,5 +7,7 @@ CONFIG_PREEMPT=n
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_PROVE_LOCKING=n
 #CHECK#CONFIG_PROVE_RCU=n
+CONFIG_FORCE_TASKS_TRACE_RCU=y
+#CHECK#CONFIG_TASKS_TRACE_RCU=y
 CONFIG_TASKS_TRACE_RCU_READ_MB=y
 CONFIG_RCU_EXPERT=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TRACE02 b/tools/testing/selftests/rcutorture/configs/rcu/TRACE02
index 77541eeb4e9f..093ea6e8e65c 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TRACE02
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TRACE02
@@ -7,5 +7,7 @@ CONFIG_PREEMPT=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
 #CHECK#CONFIG_PROVE_RCU=y
+CONFIG_FORCE_TASKS_TRACE_RCU=y
+#CHECK#CONFIG_TASKS_TRACE_RCU=y
 CONFIG_TASKS_TRACE_RCU_READ_MB=n
 CONFIG_RCU_EXPERT=y
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 04/12] rcutorture: Allow rcutorture without RCU Tasks
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (2 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 03/12] rcutorture: Allow rcutorture without RCU Tasks Trace Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 05/12] rcutorture: Allow rcutorture without RCU Tasks Rude Paul E. McKenney
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Currently, a CONFIG_PREEMPT_NONE=y kernel substitutes normal RCU for
RCU Tasks.  Unless that kernel builds rcutorture, whether built-in or as
a module, in which case RCU Tasks is (unnecessarily) used.  This both
increases kernel size and increases the complexity of certain tracing
operations.  This commit therefore decouples the presence of rcutorture
from the presence of RCU Tasks.

However, there is a need to select CONFIG_TASKS_RCU for testing purposes.
Except that casual users must not be bothered with questions -- for them,
this needs to be fully automated.  There is thus a CONFIG_FORCE_TASKS_RCU
that selects CONFIG_TASKS_RCU, is user-selectable, but which depends
on CONFIG_RCU_EXPERT.

[ paulmck: Apply kernel test robot feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig                             | 18 +++++++++++++-----
 kernel/rcu/Kconfig.debug                       |  1 -
 kernel/rcu/rcutorture.c                        | 13 ++++++++++++-
 .../selftests/rcutorture/configs/rcu/TASKS01   |  1 +
 .../selftests/rcutorture/configs/rcu/TASKS02   |  3 +++
 .../selftests/rcutorture/configs/rcu/TASKS03   |  2 ++
 6 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index 2befd328e6a0..8eac165db09f 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -77,13 +77,21 @@ config TASKS_RCU_GENERIC
 	  This option enables generic infrastructure code supporting
 	  task-based RCU implementations.  Not for manual selection.
 
+config FORCE_TASKS_RCU
+	bool "Force selection of TASKS_RCU"
+	depends on RCU_EXPERT
+	select TASKS_RCU
+	default n
+	help
+	  This option force-enables a task-based RCU implementation
+	  that uses only voluntary context switch (not preemption!),
+	  idle, and user-mode execution as quiescent states.  Not for
+	  manual selection in most cases.
+
 config TASKS_RCU
-	def_bool 0
+	bool
+	default n
 	select IRQ_WORK
-	help
-	  This option enables a task-based RCU implementation that uses
-	  only voluntary context switch (not preemption!), idle, and
-	  user-mode execution as quiescent states.  Not for manual selection.
 
 config TASKS_RUDE_RCU
 	def_bool 0
diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index d7f4bb1c4979..c217a5e655a4 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -47,7 +47,6 @@ config RCU_TORTURE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
-	select TASKS_RCU
 	select TASKS_RUDE_RCU
 	default n
 	help
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 7dd3e14ec907..65d045ff9766 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -779,6 +779,8 @@ static struct rcu_torture_ops trivial_ops = {
 	.name		= "trivial"
 };
 
+#ifdef CONFIG_TASKS_RCU
+
 /*
  * Definitions for RCU-tasks torture testing.
  */
@@ -822,6 +824,15 @@ static struct rcu_torture_ops tasks_ops = {
 	.name		= "tasks"
 };
 
+#define TASKS_OPS &tasks_ops,
+
+#else // #ifdef CONFIG_TASKS_RCU
+
+#define TASKS_OPS
+
+#endif // #else #ifdef CONFIG_TASKS_RCU
+
+
 /*
  * Definitions for rude RCU-tasks torture testing.
  */
@@ -3108,7 +3119,7 @@ rcu_torture_init(void)
 	unsigned long gp_seq = 0;
 	static struct rcu_torture_ops *torture_ops[] = {
 		&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops, &busted_srcud_ops,
-		&tasks_ops, &tasks_rude_ops, TASKS_TRACING_OPS
+		TASKS_OPS &tasks_rude_ops, TASKS_TRACING_OPS
 		&trivial_ops,
 	};
 
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TASKS01 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS01
index 3ca112444ce7..d84801b9a7ae 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TASKS01
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TASKS01
@@ -7,4 +7,5 @@ CONFIG_PREEMPT=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
 #CHECK#CONFIG_PROVE_RCU=y
+CONFIG_TASKS_RCU=y
 CONFIG_RCU_EXPERT=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TASKS02 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02
index ad2be91e5ee7..d333b69bc831 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TASKS02
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02
@@ -2,3 +2,6 @@ CONFIG_SMP=n
 CONFIG_PREEMPT_NONE=y
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=n
+#CHECK#CONFIG_TASKS_RCU=y
+CONFIG_FORCE_TASKS_RCU=y
+CONFIG_RCU_EXPERT=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TASKS03 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS03
index dc02083803ce..dea26c568678 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TASKS03
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TASKS03
@@ -7,3 +7,5 @@ CONFIG_HZ_PERIODIC=n
 CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=y
 #CHECK#CONFIG_RCU_EXPERT=n
+CONFIG_TASKS_RCU=y
+CONFIG_RCU_EXPERT=y
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 05/12] rcutorture: Allow rcutorture without RCU Tasks Rude
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (3 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 04/12] rcutorture: Allow rcutorture without RCU Tasks Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 06/12] rcutorture: Add CONFIG_PREEMPT_DYNAMIC=n to TASKS02 scenario Paul E. McKenney
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Unless a kernel builds rcutorture, whether built-in or as a module, that
kernel is also built with CONFIG_TASKS_RUDE_RCU, whether anything else
needs Tasks Rude RCU or not.  This unnecessarily increases kernel size.
This commit therefore decouples the presence of rcutorture from the
presence of RCU Tasks Rude.

However, there is a need to select CONFIG_TASKS_RUDE_RCU for testing
purposes.  Except that casual users must not be bothered with
questions -- for them, this needs to be fully automated.  There is
thus a CONFIG_FORCE_TASKS_RUDE_RCU that selects CONFIG_TASKS_RUDE_RCU,
is user-selectable, but which depends on CONFIG_RCU_EXPERT.

[ paulmck: Apply kernel test robot feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig                            | 21 ++++++++++++-------
 kernel/rcu/Kconfig.debug                      |  1 -
 kernel/rcu/rcutorture.c                       | 13 +++++++++++-
 .../selftests/rcutorture/configs/rcu/RUDE01   |  2 ++
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index 8eac165db09f..65d45c00fd1b 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -93,15 +93,22 @@ config TASKS_RCU
 	default n
 	select IRQ_WORK
 
+config FORCE_TASKS_RUDE_RCU
+	bool "Force selection of Tasks Rude RCU"
+	depends on RCU_EXPERT
+	select TASKS_RUDE_RCU
+	default n
+	help
+	  This option force-enables a task-based RCU implementation
+	  that uses only context switch (including preemption) and
+	  user-mode execution as quiescent states.  It forces IPIs and
+	  context switches on all online CPUs, including idle ones,
+	  so use with caution.	Not for manual selection in most cases.
+
 config TASKS_RUDE_RCU
-	def_bool 0
+	bool
+	default n
 	select IRQ_WORK
-	help
-	  This option enables a task-based RCU implementation that uses
-	  only context switch (including preemption) and user-mode
-	  execution as quiescent states.  It forces IPIs and context
-	  switches on all online CPUs, including idle ones, so use
-	  with caution.
 
 config FORCE_TASKS_TRACE_RCU
 	bool "Force selection of Tasks Trace RCU"
diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index c217a5e655a4..f4a4468cbf03 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -47,7 +47,6 @@ config RCU_TORTURE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
-	select TASKS_RUDE_RCU
 	default n
 	help
 	  This option provides a kernel module that runs torture tests
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 65d045ff9766..d528245108c2 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -833,6 +833,8 @@ static struct rcu_torture_ops tasks_ops = {
 #endif // #else #ifdef CONFIG_TASKS_RCU
 
 
+#ifdef CONFIG_TASKS_RUDE_RCU
+
 /*
  * Definitions for rude RCU-tasks torture testing.
  */
@@ -862,6 +864,15 @@ static struct rcu_torture_ops tasks_rude_ops = {
 	.name		= "tasks-rude"
 };
 
+#define TASKS_RUDE_OPS &tasks_rude_ops,
+
+#else // #ifdef CONFIG_TASKS_RUDE_RCU
+
+#define TASKS_RUDE_OPS
+
+#endif // #else #ifdef CONFIG_TASKS_RUDE_RCU
+
+
 #ifdef CONFIG_TASKS_TRACE_RCU
 
 /*
@@ -3119,7 +3130,7 @@ rcu_torture_init(void)
 	unsigned long gp_seq = 0;
 	static struct rcu_torture_ops *torture_ops[] = {
 		&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops, &busted_srcud_ops,
-		TASKS_OPS &tasks_rude_ops, TASKS_TRACING_OPS
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 		&trivial_ops,
 	};
 
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/RUDE01 b/tools/testing/selftests/rcutorture/configs/rcu/RUDE01
index 7093422050f6..6fd6acb94518 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/RUDE01
+++ b/tools/testing/selftests/rcutorture/configs/rcu/RUDE01
@@ -8,3 +8,5 @@ CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
 #CHECK#CONFIG_PROVE_RCU=y
 CONFIG_RCU_EXPERT=y
+CONFIG_FORCE_TASKS_RUDE_RCU=y
+#CHECK#CONFIG_TASKS_RUDE_RCU=y
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 06/12] rcutorture: Add CONFIG_PREEMPT_DYNAMIC=n to TASKS02 scenario
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (4 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 05/12] rcutorture: Allow rcutorture without RCU Tasks Rude Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 07/12] rcutorture: Allow specifying per-scenario stat_interval Paul E. McKenney
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Now that CONFIG_PREEMPT_DYNAMIC=y is the default, TASKS02 no longer
builds a pure non-preemptible kernel that uses Tiny RCU.  This commit
therefore fixes this new hole in rcutorture testing by adding
CONFIG_PREEMPT_DYNAMIC=n to the TASKS02 rcutorture scenario.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/configs/rcu/TASKS02 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TASKS02 b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02
index d333b69bc831..2f9fcffff5ae 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TASKS02
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02
@@ -2,6 +2,7 @@ CONFIG_SMP=n
 CONFIG_PREEMPT_NONE=y
 CONFIG_PREEMPT_VOLUNTARY=n
 CONFIG_PREEMPT=n
+CONFIG_PREEMPT_DYNAMIC=n
 #CHECK#CONFIG_TASKS_RCU=y
 CONFIG_FORCE_TASKS_RCU=y
 CONFIG_RCU_EXPERT=y
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 07/12] rcutorture: Allow specifying per-scenario stat_interval
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (5 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 06/12] rcutorture: Add CONFIG_PREEMPT_DYNAMIC=n to TASKS02 scenario Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 08/12] refscale: Allow refscale without RCU Tasks Paul E. McKenney
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

The rcutorture test suite makes double use of the rcutorture.stat_interval
module parameter.  As its name suggests, it controls the frequency
of statistics printing, but it also controls the rcu_torture_writer()
stall timeout.  The current setting of 15 seconds works surprisingly well.
However, given that the RCU tasks stall-warning timeout is ten -minutes-,
15 seconds is too short for TASKS02, which runs a non-preemptible kernel
on a single CPU.

This commit therefore adds checks for per-scenario specification of the
rcutorture.stat_interval module parameter.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 .../rcutorture/configs/rcu/TASKS02.boot          |  1 +
 .../rcutorture/configs/rcu/ver_functions.sh      | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TASKS02.boot b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02.boot
index cd2a188eeb6d..b9b6d67cbc5f 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TASKS02.boot
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TASKS02.boot
@@ -1 +1,2 @@
 rcutorture.torture_type=tasks
+rcutorture.stat_interval=60
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/ver_functions.sh b/tools/testing/selftests/rcutorture/configs/rcu/ver_functions.sh
index effa415f9b92..e2bc99c785e7 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/ver_functions.sh
+++ b/tools/testing/selftests/rcutorture/configs/rcu/ver_functions.sh
@@ -9,7 +9,7 @@
 
 # rcutorture_param_n_barrier_cbs bootparam-string
 #
-# Adds n_barrier_cbs rcutorture module parameter to kernels having it.
+# Adds n_barrier_cbs rcutorture module parameter if not already specified.
 rcutorture_param_n_barrier_cbs () {
 	if echo $1 | grep -q "rcutorture\.n_barrier_cbs"
 	then
@@ -30,13 +30,25 @@ rcutorture_param_onoff () {
 	fi
 }
 
+# rcutorture_param_stat_interval bootparam-string
+#
+# Adds stat_interval rcutorture module parameter if not already specified.
+rcutorture_param_stat_interval () {
+	if echo $1 | grep -q "rcutorture\.stat_interval"
+	then
+		:
+	else
+		echo rcutorture.stat_interval=15
+	fi
+}
+
 # per_version_boot_params bootparam-string config-file seconds
 #
 # Adds per-version torture-module parameters to kernels supporting them.
 per_version_boot_params () {
 	echo $1 `rcutorture_param_onoff "$1" "$2"` \
 		`rcutorture_param_n_barrier_cbs "$1"` \
-		rcutorture.stat_interval=15 \
+		`rcutorture_param_stat_interval "$1"` \
 		rcutorture.shutdown_secs=$3 \
 		rcutorture.test_no_idle_hz=1 \
 		rcutorture.verbose=1
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 08/12] refscale: Allow refscale without RCU Tasks
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (6 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 07/12] rcutorture: Allow specifying per-scenario stat_interval Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 09/12] refscale: Allow refscale without RCU Tasks Rude/Trace Paul E. McKenney
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Currently, a CONFIG_PREEMPT_NONE=y kernel substitutes normal RCU for
RCU Tasks.  Unless that kernel builds refscale, whether built-in or as a
module, in which case RCU Tasks is (unnecessarily) built in.  This both
increases kernel size and increases the complexity of certain tracing
operations.  This commit therefore decouples the presence of refscale
from the presence of RCU Tasks.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig.debug                             |  1 -
 kernel/rcu/refscale.c                                | 12 +++++++++++-
 .../selftests/rcutorture/configs/refscale/CFcommon   |  2 ++
 .../selftests/rcutorture/configs/refscale/NOPREEMPT  |  2 ++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index f4a4468cbf03..454924e03ef3 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -63,7 +63,6 @@ config RCU_REF_SCALE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
-	select TASKS_RCU
 	select TASKS_RUDE_RCU
 	select TASKS_TRACE_RCU
 	default n
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 5489ff7f478e..5079e47b3d18 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -207,6 +207,8 @@ static struct ref_scale_ops srcu_ops = {
 	.name		= "srcu"
 };
 
+#ifdef CONFIG_TASKS_RCU
+
 // Definitions for RCU Tasks ref scale testing: Empty read markers.
 // These definitions also work for RCU Rude readers.
 static void rcu_tasks_ref_scale_read_section(const int nloops)
@@ -232,6 +234,14 @@ static struct ref_scale_ops rcu_tasks_ops = {
 	.name		= "rcu-tasks"
 };
 
+#define RCU_TASKS_OPS &rcu_tasks_ops,
+
+#else // #ifdef CONFIG_TASKS_RCU
+
+#define RCU_TASKS_OPS
+
+#endif // #else // #ifdef CONFIG_TASKS_RCU
+
 // Definitions for RCU Tasks Trace ref scale testing.
 static void rcu_trace_ref_scale_read_section(const int nloops)
 {
@@ -790,7 +800,7 @@ ref_scale_init(void)
 	long i;
 	int firsterr = 0;
 	static struct ref_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &rcu_trace_ops, &rcu_tasks_ops, &refcnt_ops, &rwlock_ops,
+		&rcu_ops, &srcu_ops, &rcu_trace_ops, RCU_TASKS_OPS &refcnt_ops, &rwlock_ops,
 		&rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops, &clock_ops,
 	};
 
diff --git a/tools/testing/selftests/rcutorture/configs/refscale/CFcommon b/tools/testing/selftests/rcutorture/configs/refscale/CFcommon
index a98b58b54bb1..14fdafc576ce 100644
--- a/tools/testing/selftests/rcutorture/configs/refscale/CFcommon
+++ b/tools/testing/selftests/rcutorture/configs/refscale/CFcommon
@@ -1,2 +1,4 @@
 CONFIG_RCU_REF_SCALE_TEST=y
 CONFIG_PRINTK_TIME=y
+CONFIG_FORCE_TASKS_RCU=y
+#CHECK#CONFIG_TASKS_RCU=y
diff --git a/tools/testing/selftests/rcutorture/configs/refscale/NOPREEMPT b/tools/testing/selftests/rcutorture/configs/refscale/NOPREEMPT
index 7f06838a91e6..ef2b501a6971 100644
--- a/tools/testing/selftests/rcutorture/configs/refscale/NOPREEMPT
+++ b/tools/testing/selftests/rcutorture/configs/refscale/NOPREEMPT
@@ -15,3 +15,5 @@ CONFIG_PROVE_LOCKING=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_RCU_EXPERT=y
+CONFIG_KPROBES=n
+CONFIG_FTRACE=n
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 09/12] refscale: Allow refscale without RCU Tasks Rude/Trace
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (7 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 08/12] refscale: Allow refscale without RCU Tasks Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 10/12] rcuscale: Allow rcuscale without RCU Tasks Paul E. McKenney
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Currently, a CONFIG_PREEMPT_NONE=y kernel substitutes normal RCU for
RCU Tasks Rude and RCU Tasks Trace.  Unless that kernel builds refscale,
whether built-in or as a module, in which case these RCU Tasks flavors are
(unnecessarily) built in.  This both increases kernel size and increases
the complexity of certain tracing operations.  This commit therefore
decouples the presence of refscale from the presence of RCU Tasks Rude
and RCU Tasks Trace.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig.debug                             |  2 --
 kernel/rcu/refscale.c                                | 12 +++++++++++-
 .../selftests/rcutorture/configs/refscale/CFcommon   |  2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index 454924e03ef3..dceaa3e754e5 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -63,8 +63,6 @@ config RCU_REF_SCALE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
-	select TASKS_RUDE_RCU
-	select TASKS_TRACE_RCU
 	default n
 	help
 	  This option provides a kernel module that runs performance tests
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 5079e47b3d18..909644abee67 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -242,6 +242,8 @@ static struct ref_scale_ops rcu_tasks_ops = {
 
 #endif // #else // #ifdef CONFIG_TASKS_RCU
 
+#ifdef CONFIG_TASKS_TRACE_RCU
+
 // Definitions for RCU Tasks Trace ref scale testing.
 static void rcu_trace_ref_scale_read_section(const int nloops)
 {
@@ -271,6 +273,14 @@ static struct ref_scale_ops rcu_trace_ops = {
 	.name		= "rcu-trace"
 };
 
+#define RCU_TRACE_OPS &rcu_trace_ops,
+
+#else // #ifdef CONFIG_TASKS_TRACE_RCU
+
+#define RCU_TRACE_OPS
+
+#endif // #else // #ifdef CONFIG_TASKS_TRACE_RCU
+
 // Definitions for reference count
 static atomic_t refcnt;
 
@@ -800,7 +810,7 @@ ref_scale_init(void)
 	long i;
 	int firsterr = 0;
 	static struct ref_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &rcu_trace_ops, RCU_TASKS_OPS &refcnt_ops, &rwlock_ops,
+		&rcu_ops, &srcu_ops, RCU_TRACE_OPS RCU_TASKS_OPS &refcnt_ops, &rwlock_ops,
 		&rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops, &clock_ops,
 	};
 
diff --git a/tools/testing/selftests/rcutorture/configs/refscale/CFcommon b/tools/testing/selftests/rcutorture/configs/refscale/CFcommon
index 14fdafc576ce..fbea3b13baba 100644
--- a/tools/testing/selftests/rcutorture/configs/refscale/CFcommon
+++ b/tools/testing/selftests/rcutorture/configs/refscale/CFcommon
@@ -2,3 +2,5 @@ CONFIG_RCU_REF_SCALE_TEST=y
 CONFIG_PRINTK_TIME=y
 CONFIG_FORCE_TASKS_RCU=y
 #CHECK#CONFIG_TASKS_RCU=y
+CONFIG_FORCE_TASKS_TRACE_RCU=y
+#CHECK#CONFIG_TASKS_TRACE_RCU=y
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 10/12] rcuscale: Allow rcuscale without RCU Tasks
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (8 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 09/12] refscale: Allow refscale without RCU Tasks Rude/Trace Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 11/12] rcuscale: Allow rcuscale without RCU Tasks Rude/Trace Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 12/12] scftorture: Adjust for TASKS_RCU Kconfig option being selected Paul E. McKenney
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Currently, a CONFIG_PREEMPT_NONE=y kernel substitutes normal RCU for
RCU Tasks.  Unless that kernel builds rcuscale, whether built-in or as
a module, in which case RCU Tasks is (unnecessarily) built.  This both
increases kernel size and increases the complexity of certain tracing
operations.  This commit therefore decouples the presence of rcuscale
from the presence of RCU Tasks.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig.debug                             |  1 -
 kernel/rcu/rcuscale.c                                | 12 +++++++++++-
 .../selftests/rcutorture/configs/rcuscale/CFcommon   |  4 ++--
 .../selftests/rcutorture/configs/rcuscale/TREE       |  2 ++
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index dceaa3e754e5..71e73fceff87 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -28,7 +28,6 @@ config RCU_SCALE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
-	select TASKS_RCU
 	select TASKS_RUDE_RCU
 	select TASKS_TRACE_RCU
 	default n
diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 5e4f1f83d38e..311dbcb064ed 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -268,6 +268,8 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+#ifdef CONFIG_TASKS_RCU
+
 /*
  * Definitions for RCU-tasks scalability testing.
  */
@@ -295,6 +297,14 @@ static struct rcu_scale_ops tasks_ops = {
 	.name		= "tasks"
 };
 
+#define TASKS_OPS &tasks_ops,
+
+#else // #ifdef CONFIG_TASKS_RCU
+
+#define TASKS_OPS
+
+#endif // #else // #ifdef CONFIG_TASKS_RCU
+
 /*
  * Definitions for RCU-tasks-trace scalability testing.
  */
@@ -797,7 +807,7 @@ rcu_scale_init(void)
 	long i;
 	int firsterr = 0;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, &tasks_ops, &tasks_tracing_ops
+		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS &tasks_tracing_ops
 	};
 
 	if (!torture_init_begin(scale_type, verbose))
diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon
index 90942bb5bebc..2ed3b46a9c37 100644
--- a/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon
+++ b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon
@@ -1,5 +1,5 @@
 CONFIG_RCU_SCALE_TEST=y
 CONFIG_PRINTK_TIME=y
 CONFIG_TASKS_RCU_GENERIC=y
-CONFIG_TASKS_RCU=y
-CONFIG_TASKS_TRACE_RCU=y
+CONFIG_FORCE_TASKS_RCU=y
+#CHECK#CONFIG_TASKS_RCU=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/TREE b/tools/testing/selftests/rcutorture/configs/rcuscale/TREE
index f110d9ffbe4c..b10706fd03a4 100644
--- a/tools/testing/selftests/rcutorture/configs/rcuscale/TREE
+++ b/tools/testing/selftests/rcutorture/configs/rcuscale/TREE
@@ -16,3 +16,5 @@ CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_RCU_EXPERT=y
 CONFIG_RCU_TRACE=y
+CONFIG_KPROBES=n
+CONFIG_FTRACE=n
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 11/12] rcuscale: Allow rcuscale without RCU Tasks Rude/Trace
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (9 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 10/12] rcuscale: Allow rcuscale without RCU Tasks Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  2022-04-19  0:12 ` [PATCH rcu 12/12] scftorture: Adjust for TASKS_RCU Kconfig option being selected Paul E. McKenney
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

Currently, a CONFIG_PREEMPT_NONE=y kernel substitutes normal RCU for
RCU Tasks Rude and RCU Tasks Trace.  Unless that kernel builds rcuscale,
whether built-in or as a module, in which case these RCU Tasks flavors are
(unnecessarily) built in.  This both increases kernel size and increases
the complexity of certain tracing operations.  This commit therefore
decouples the presence of rcuscale from the presence of RCU Tasks Rude
and RCU Tasks Trace.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/Kconfig.debug                             |  2 --
 kernel/rcu/rcuscale.c                                | 12 +++++++++++-
 .../selftests/rcutorture/configs/rcuscale/CFcommon   |  3 ++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index 71e73fceff87..68092e1db64b 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -28,8 +28,6 @@ config RCU_SCALE_TEST
 	depends on DEBUG_KERNEL
 	select TORTURE_TEST
 	select SRCU
-	select TASKS_RUDE_RCU
-	select TASKS_TRACE_RCU
 	default n
 	help
 	  This option provides a kernel module that runs performance
diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 311dbcb064ed..277a5bfb37d4 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -305,6 +305,8 @@ static struct rcu_scale_ops tasks_ops = {
 
 #endif // #else // #ifdef CONFIG_TASKS_RCU
 
+#ifdef CONFIG_TASKS_TRACE_RCU
+
 /*
  * Definitions for RCU-tasks-trace scalability testing.
  */
@@ -334,6 +336,14 @@ static struct rcu_scale_ops tasks_tracing_ops = {
 	.name		= "tasks-tracing"
 };
 
+#define TASKS_TRACING_OPS &tasks_tracing_ops,
+
+#else // #ifdef CONFIG_TASKS_TRACE_RCU
+
+#define TASKS_TRACING_OPS
+
+#endif // #else // #ifdef CONFIG_TASKS_TRACE_RCU
+
 static unsigned long rcuscale_seq_diff(unsigned long new, unsigned long old)
 {
 	if (!cur_ops->gp_diff)
@@ -807,7 +817,7 @@ rcu_scale_init(void)
 	long i;
 	int firsterr = 0;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS &tasks_tracing_ops
+		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))
diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon
index 2ed3b46a9c37..6a00157bee5b 100644
--- a/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon
+++ b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon
@@ -1,5 +1,6 @@
 CONFIG_RCU_SCALE_TEST=y
 CONFIG_PRINTK_TIME=y
-CONFIG_TASKS_RCU_GENERIC=y
 CONFIG_FORCE_TASKS_RCU=y
 #CHECK#CONFIG_TASKS_RCU=y
+CONFIG_FORCE_TASKS_TRACE_RCU=y
+#CHECK#CONFIG_TASKS_TRACE_RCU=y
-- 
2.31.1.189.g2e36527f23


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

* [PATCH rcu 12/12] scftorture: Adjust for TASKS_RCU Kconfig option being selected
  2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
                   ` (10 preceding siblings ...)
  2022-04-19  0:12 ` [PATCH rcu 11/12] rcuscale: Allow rcuscale without RCU Tasks Rude/Trace Paul E. McKenney
@ 2022-04-19  0:12 ` Paul E. McKenney
  11 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19  0:12 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney

This commit adjusts the scftorture PREEMPT and NOPREEMPT scenarios to
account for the TASKS_RCU Kconfig option being explicitly selected rather
than computed in isolation.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT | 2 ++
 tools/testing/selftests/rcutorture/configs/scf/PREEMPT   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT b/tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT
index b8429d6c6ebc..3a59346b3de7 100644
--- a/tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT
+++ b/tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT
@@ -7,3 +7,5 @@ CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=y
 CONFIG_DEBUG_LOCK_ALLOC=n
 CONFIG_PROVE_LOCKING=n
+CONFIG_KPROBES=n
+CONFIG_FTRACE=n
diff --git a/tools/testing/selftests/rcutorture/configs/scf/PREEMPT b/tools/testing/selftests/rcutorture/configs/scf/PREEMPT
index ae4992b141b0..cb37e08037d6 100644
--- a/tools/testing/selftests/rcutorture/configs/scf/PREEMPT
+++ b/tools/testing/selftests/rcutorture/configs/scf/PREEMPT
@@ -7,3 +7,4 @@ CONFIG_NO_HZ_IDLE=y
 CONFIG_NO_HZ_FULL=n
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_PROVE_LOCKING=y
+CONFIG_RCU_EXPERT=y
-- 
2.31.1.189.g2e36527f23


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

* Re: [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected
  2022-04-19  0:12 ` [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected Paul E. McKenney
@ 2022-04-19 14:13   ` Masami Hiramatsu
  2022-04-19 14:25     ` Paul E. McKenney
  0 siblings, 1 reply; 15+ messages in thread
From: Masami Hiramatsu @ 2022-04-19 14:13 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: rcu, linux-kernel, kernel-team, rostedt, Hyeonggon Yoo,
	Zhouyi Zhou, Andrii Nakryiko, Alexei Starovoitov,
	Mathieu Desnoyers, Masami Hiramatsu

On Mon, 18 Apr 2022 17:12:23 -0700
"Paul E. McKenney" <paulmck@kernel.org> wrote:

> Currently, any kernel built with CONFIG_PREEMPTION=y also gets
> CONFIG_TASKS_RCU=y, which is not helpful to people trying to build
> preemptible kernels of minimal size.
> 
> Because CONFIG_TASKS_RCU=y is needed only in kernels doing tracing of
> one form or another, this commit moves from TASKS_RCU deciding when it
> should be enabled to the tracing Kconfig options explicitly selecting it.
> This allows building preemptible kernels without TASKS_RCU, if desired.
> 
> This commit also updates the SRCU-N and TREE09 rcutorture scenarios
> in order to avoid Kconfig errors that would otherwise result from
> CONFIG_TASKS_RCU being selected without its CONFIG_RCU_EXPERT dependency
> being met.

Thanks for fixing this dependency.

This looks good to me (for kprobe part)

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you,

> 
> [ paulmck: Apply BPF_SYSCALL feedback from Andrii Nakryiko. ]
> 
> Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> Tested-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> 
> --- Update SRCU-N and TREE09 to avoid Kconfig errors.
> 
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> ---
>  arch/Kconfig                                          | 1 +
>  kernel/bpf/Kconfig                                    | 1 +
>  kernel/rcu/Kconfig                                    | 3 ++-
>  kernel/trace/Kconfig                                  | 1 +
>  tools/testing/selftests/rcutorture/configs/rcu/SRCU-N | 2 ++
>  tools/testing/selftests/rcutorture/configs/rcu/TREE09 | 2 ++
>  6 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 29b0167c088b..1bf29ce754af 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -35,6 +35,7 @@ config KPROBES
>  	depends on MODULES
>  	depends on HAVE_KPROBES
>  	select KALLSYMS
> +	select TASKS_RCU if PREEMPTION
>  	help
>  	  Kprobes allows you to trap at almost any kernel address and
>  	  execute a callback function.  register_kprobe() establishes
> diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig
> index d56ee177d5f8..2dfe1079f772 100644
> --- a/kernel/bpf/Kconfig
> +++ b/kernel/bpf/Kconfig
> @@ -27,6 +27,7 @@ config BPF_SYSCALL
>  	bool "Enable bpf() system call"
>  	select BPF
>  	select IRQ_WORK
> +	select TASKS_RCU if PREEMPTION
>  	select TASKS_TRACE_RCU
>  	select BINARY_PRINTF
>  	select NET_SOCK_MSG if NET
> diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> index f559870fbf8b..4f665ae0cf55 100644
> --- a/kernel/rcu/Kconfig
> +++ b/kernel/rcu/Kconfig
> @@ -78,7 +78,8 @@ config TASKS_RCU_GENERIC
>  	  task-based RCU implementations.  Not for manual selection.
>  
>  config TASKS_RCU
> -	def_bool PREEMPTION
> +	def_bool 0
> +	select IRQ_WORK
>  	help
>  	  This option enables a task-based RCU implementation that uses
>  	  only voluntary context switch (not preemption!), idle, and
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index 2c43e327a619..bf5da6c4e999 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -144,6 +144,7 @@ config TRACING
>  	select BINARY_PRINTF
>  	select EVENT_TRACING
>  	select TRACE_CLOCK
> +	select TASKS_RCU if PREEMPTION
>  
>  config GENERIC_TRACER
>  	bool
> diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
> index 2da8b49589a0..07f5e0a70ae7 100644
> --- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
> +++ b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
> @@ -6,3 +6,5 @@ CONFIG_PREEMPT_NONE=y
>  CONFIG_PREEMPT_VOLUNTARY=n
>  CONFIG_PREEMPT=n
>  #CHECK#CONFIG_RCU_EXPERT=n
> +CONFIG_KPROBES=n
> +CONFIG_FTRACE=n
> diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE09 b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
> index 8523a7515cbf..fc45645bb5f4 100644
> --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE09
> +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
> @@ -13,3 +13,5 @@ CONFIG_DEBUG_LOCK_ALLOC=n
>  CONFIG_RCU_BOOST=n
>  CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
>  #CHECK#CONFIG_RCU_EXPERT=n
> +CONFIG_KPROBES=n
> +CONFIG_FTRACE=n
> -- 
> 2.31.1.189.g2e36527f23
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected
  2022-04-19 14:13   ` Masami Hiramatsu
@ 2022-04-19 14:25     ` Paul E. McKenney
  0 siblings, 0 replies; 15+ messages in thread
From: Paul E. McKenney @ 2022-04-19 14:25 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: rcu, linux-kernel, kernel-team, rostedt, Hyeonggon Yoo,
	Zhouyi Zhou, Andrii Nakryiko, Alexei Starovoitov,
	Mathieu Desnoyers

On Tue, Apr 19, 2022 at 11:13:58PM +0900, Masami Hiramatsu wrote:
> On Mon, 18 Apr 2022 17:12:23 -0700
> "Paul E. McKenney" <paulmck@kernel.org> wrote:
> 
> > Currently, any kernel built with CONFIG_PREEMPTION=y also gets
> > CONFIG_TASKS_RCU=y, which is not helpful to people trying to build
> > preemptible kernels of minimal size.
> > 
> > Because CONFIG_TASKS_RCU=y is needed only in kernels doing tracing of
> > one form or another, this commit moves from TASKS_RCU deciding when it
> > should be enabled to the tracing Kconfig options explicitly selecting it.
> > This allows building preemptible kernels without TASKS_RCU, if desired.
> > 
> > This commit also updates the SRCU-N and TREE09 rcutorture scenarios
> > in order to avoid Kconfig errors that would otherwise result from
> > CONFIG_TASKS_RCU being selected without its CONFIG_RCU_EXPERT dependency
> > being met.
> 
> Thanks for fixing this dependency.
> 
> This looks good to me (for kprobe part)
> 
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!  I will apply this on my next rebase.

							Thanx, Paul

> Thank you,
> 
> > 
> > [ paulmck: Apply BPF_SYSCALL feedback from Andrii Nakryiko. ]
> > 
> > Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > Tested-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > Cc: Andrii Nakryiko <andrii@kernel.org>
> > Cc: Alexei Starovoitov <ast@kernel.org>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > Cc: Masami Hiramatsu <mhiramat@kernel.org>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > 
> > --- Update SRCU-N and TREE09 to avoid Kconfig errors.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > ---
> >  arch/Kconfig                                          | 1 +
> >  kernel/bpf/Kconfig                                    | 1 +
> >  kernel/rcu/Kconfig                                    | 3 ++-
> >  kernel/trace/Kconfig                                  | 1 +
> >  tools/testing/selftests/rcutorture/configs/rcu/SRCU-N | 2 ++
> >  tools/testing/selftests/rcutorture/configs/rcu/TREE09 | 2 ++
> >  6 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/Kconfig b/arch/Kconfig
> > index 29b0167c088b..1bf29ce754af 100644
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -35,6 +35,7 @@ config KPROBES
> >  	depends on MODULES
> >  	depends on HAVE_KPROBES
> >  	select KALLSYMS
> > +	select TASKS_RCU if PREEMPTION
> >  	help
> >  	  Kprobes allows you to trap at almost any kernel address and
> >  	  execute a callback function.  register_kprobe() establishes
> > diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig
> > index d56ee177d5f8..2dfe1079f772 100644
> > --- a/kernel/bpf/Kconfig
> > +++ b/kernel/bpf/Kconfig
> > @@ -27,6 +27,7 @@ config BPF_SYSCALL
> >  	bool "Enable bpf() system call"
> >  	select BPF
> >  	select IRQ_WORK
> > +	select TASKS_RCU if PREEMPTION
> >  	select TASKS_TRACE_RCU
> >  	select BINARY_PRINTF
> >  	select NET_SOCK_MSG if NET
> > diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> > index f559870fbf8b..4f665ae0cf55 100644
> > --- a/kernel/rcu/Kconfig
> > +++ b/kernel/rcu/Kconfig
> > @@ -78,7 +78,8 @@ config TASKS_RCU_GENERIC
> >  	  task-based RCU implementations.  Not for manual selection.
> >  
> >  config TASKS_RCU
> > -	def_bool PREEMPTION
> > +	def_bool 0
> > +	select IRQ_WORK
> >  	help
> >  	  This option enables a task-based RCU implementation that uses
> >  	  only voluntary context switch (not preemption!), idle, and
> > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> > index 2c43e327a619..bf5da6c4e999 100644
> > --- a/kernel/trace/Kconfig
> > +++ b/kernel/trace/Kconfig
> > @@ -144,6 +144,7 @@ config TRACING
> >  	select BINARY_PRINTF
> >  	select EVENT_TRACING
> >  	select TRACE_CLOCK
> > +	select TASKS_RCU if PREEMPTION
> >  
> >  config GENERIC_TRACER
> >  	bool
> > diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
> > index 2da8b49589a0..07f5e0a70ae7 100644
> > --- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
> > +++ b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-N
> > @@ -6,3 +6,5 @@ CONFIG_PREEMPT_NONE=y
> >  CONFIG_PREEMPT_VOLUNTARY=n
> >  CONFIG_PREEMPT=n
> >  #CHECK#CONFIG_RCU_EXPERT=n
> > +CONFIG_KPROBES=n
> > +CONFIG_FTRACE=n
> > diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE09 b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
> > index 8523a7515cbf..fc45645bb5f4 100644
> > --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE09
> > +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE09
> > @@ -13,3 +13,5 @@ CONFIG_DEBUG_LOCK_ALLOC=n
> >  CONFIG_RCU_BOOST=n
> >  CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
> >  #CHECK#CONFIG_RCU_EXPERT=n
> > +CONFIG_KPROBES=n
> > +CONFIG_FTRACE=n
> > -- 
> > 2.31.1.189.g2e36527f23
> > 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>

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

end of thread, other threads:[~2022-04-19 14:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19  0:11 [PATCH rcu 0/12] RCU-tasks torture-test updates Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 01/12] rcu: Make TASKS_RUDE_RCU select IRQ_WORK Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 02/12] rcu: Make the TASKS_RCU Kconfig option be selected Paul E. McKenney
2022-04-19 14:13   ` Masami Hiramatsu
2022-04-19 14:25     ` Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 03/12] rcutorture: Allow rcutorture without RCU Tasks Trace Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 04/12] rcutorture: Allow rcutorture without RCU Tasks Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 05/12] rcutorture: Allow rcutorture without RCU Tasks Rude Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 06/12] rcutorture: Add CONFIG_PREEMPT_DYNAMIC=n to TASKS02 scenario Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 07/12] rcutorture: Allow specifying per-scenario stat_interval Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 08/12] refscale: Allow refscale without RCU Tasks Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 09/12] refscale: Allow refscale without RCU Tasks Rude/Trace Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 10/12] rcuscale: Allow rcuscale without RCU Tasks Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 11/12] rcuscale: Allow rcuscale without RCU Tasks Rude/Trace Paul E. McKenney
2022-04-19  0:12 ` [PATCH rcu 12/12] scftorture: Adjust for TASKS_RCU Kconfig option being selected 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).