Skip to content

Commit ab875b3

Browse files
gustavoldJoel Fernandes
authored andcommitted
rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option
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>
1 parent a183962 commit ab875b3

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

kernel/rcu/Kconfig.debug

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,30 @@ config RCU_CPU_STALL_NOTIFIER
175175
Say Y here if you want RCU CPU stall notifiers (you don't want them)
176176
Say N if you are unsure.
177177

178+
config BOOTPARAM_RCU_STALL_PANIC
179+
bool "Panic (reboot) on RCU CPU stall"
180+
depends on RCU_STALL_COMMON
181+
default n
182+
help
183+
Say Y here to enable the kernel to panic when an RCU CPU stall
184+
is detected.
185+
186+
The panic can be used in combination with panic_timeout,
187+
to cause the system to reboot automatically after an
188+
RCU CPU stall has been detected. This feature is useful for
189+
high-availability systems that have uptime guarantees and
190+
where a CPU stall must be resolved ASAP.
191+
192+
The kernel.max_rcu_stall_to_panic sysctl can be used to set
193+
a minimum number of stalls before panicking, allowing the
194+
system to tolerate a given number of RCU CPU stalls before
195+
triggering a panic.
196+
197+
This setting can be overridden at runtime via the
198+
kernel.panic_on_rcu_stall sysctl parameter.
199+
200+
Say N if unsure.
201+
178202
config RCU_TRACE
179203
bool "Enable tracing for RCU"
180204
depends on DEBUG_KERNEL

kernel/rcu/tree_stall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// Controlling CPU stall warnings, including delay calculation.
1818

1919
/* panic() on RCU Stall sysctl. */
20-
static int sysctl_panic_on_rcu_stall __read_mostly;
20+
static int sysctl_panic_on_rcu_stall __read_mostly = IS_ENABLED(CONFIG_BOOTPARAM_RCU_STALL_PANIC);
2121
static int sysctl_max_rcu_stall_to_panic __read_mostly;
2222

2323
static const struct ctl_table rcu_stall_sysctl_table[] = {

0 commit comments

Comments
 (0)