]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rcutorture: Allow rcutorture without RCU Tasks
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 17 Mar 2022 22:18:27 +0000 (15:18 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 20 Apr 2022 23:53:19 +0000 (16:53 -0700)
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
kernel/rcu/Kconfig.debug
kernel/rcu/rcutorture.c
tools/testing/selftests/rcutorture/configs/rcu/TASKS01
tools/testing/selftests/rcutorture/configs/rcu/TASKS02
tools/testing/selftests/rcutorture/configs/rcu/TASKS03

index 2befd328e6a0ef45e28c6d162dfe4656f91c260b..8eac165db09fa1744bebded107ae0580343a0509 100644 (file)
@@ -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
index d7f4bb1c49795b2c8a7cc10e07606fc287833702..c217a5e655a44f491a6a2e9d0838e966cbad63f2 100644 (file)
@@ -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
index 7dd3e14ec90720565804ebd59882fa56d58421de..65d045ff97668f28e97ff9ac62f5ab16f78cce59 100644 (file)
@@ -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,
        };
 
index 3ca112444ce7791caf82c50dd592b896e428583c..d84801b9a7aed77a0ee538868d429ecc61fc77cf 100644 (file)
@@ -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
index ad2be91e5ee7624e95df63885f70dbbc833afb64..d333b69bc8318b818c4b1b6185fb52a0e8008970 100644 (file)
@@ -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
index dc02083803ce574a769e93d230e87b078e583f87..dea26c5686784953650b6a233358d8b1958c7e55 100644 (file)
@@ -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