rcutorture: Allow rcutorture without RCU Tasks Rude
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 17 Mar 2022 23:16:45 +0000 (16:16 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 20 Apr 2022 23:53:19 +0000 (16:53 -0700)
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
kernel/rcu/Kconfig.debug
kernel/rcu/rcutorture.c
tools/testing/selftests/rcutorture/configs/rcu/RUDE01

index 8eac165..65d45c0 100644 (file)
@@ -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"
index c217a5e..f4a4468 100644 (file)
@@ -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
index 65d045f..d528245 100644 (file)
@@ -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,
        };
 
index 7093422..6fd6acb 100644 (file)
@@ -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