]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option
authorGustavo Luiz Duarte <gustavold@gmail.com>
Tue, 17 Mar 2026 21:41:17 +0000 (17:41 -0400)
committerJoel Fernandes <joelagnelf@nvidia.com>
Mon, 30 Mar 2026 19:48:14 +0000 (15:48 -0400)
Add a Kconfig option to set the default value of the
kernel.panic_on_rcu_stall sysctl, allowing the kernel to be built
with panic-on-RCU-stall enabled by default.

This is useful for high-availability systems that require automatic
recovery (via panic_timeout) when a CPU stall is detected, without
needing userspace to configure the sysctl at boot.

This follows the pattern established by BOOTPARAM_SOFTLOCKUP_PANIC
and BOOTPARAM_HUNG_TASK_PANIC.  The runtime sysctl can still override
the Kconfig default.

Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
kernel/rcu/Kconfig.debug
kernel/rcu/tree_stall.h

index e078e988773d6aad20fb17b42875088c1027c0ed..35218ba74eb55f988dcd0ea366d3dc1b06162895 100644 (file)
@@ -175,6 +175,30 @@ config RCU_CPU_STALL_NOTIFIER
          Say Y here if you want RCU CPU stall notifiers (you don't want them)
          Say N if you are unsure.
 
+config BOOTPARAM_RCU_STALL_PANIC
+       bool "Panic (reboot) on RCU CPU stall"
+       depends on RCU_STALL_COMMON
+       default n
+       help
+         Say Y here to enable the kernel to panic when an RCU CPU stall
+         is detected.
+
+         The panic can be used in combination with panic_timeout,
+         to cause the system to reboot automatically after an
+         RCU CPU stall has been detected. This feature is useful for
+         high-availability systems that have uptime guarantees and
+         where a CPU stall must be resolved ASAP.
+
+         The kernel.max_rcu_stall_to_panic sysctl can be used to set
+         a minimum number of stalls before panicking, allowing the
+         system to tolerate a given number of RCU CPU stalls before
+         triggering a panic.
+
+         This setting can be overridden at runtime via the
+         kernel.panic_on_rcu_stall sysctl parameter.
+
+         Say N if unsure.
+
 config RCU_TRACE
        bool "Enable tracing for RCU"
        depends on DEBUG_KERNEL
index b67532cb877050a882f2c1c6c198002d7a3c7916..43ddabf46b5eec4d4ae82f6c70ca776ba6f8a21f 100644 (file)
@@ -17,7 +17,7 @@
 // Controlling CPU stall warnings, including delay calculation.
 
 /* panic() on RCU Stall sysctl. */
-static int sysctl_panic_on_rcu_stall __read_mostly;
+static int sysctl_panic_on_rcu_stall __read_mostly = IS_ENABLED(CONFIG_BOOTPARAM_RCU_STALL_PANIC);
 static int sysctl_max_rcu_stall_to_panic __read_mostly;
 
 static const struct ctl_table rcu_stall_sysctl_table[] = {