public inbox for rcu@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option
@ 2026-03-13 16:56 Gustavo Luiz Duarte
  2026-03-13 17:07 ` Paul E. McKenney
  2026-03-13 17:43 ` Breno Leitao
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo Luiz Duarte @ 2026-03-13 16:56 UTC (permalink / raw)
  To: Paul E. McKenney, Breno Leitao, Frederic Weisbecker,
	Neeraj Upadhyay, Joel Fernandes, Josh Triplett, Boqun Feng,
	Uladzislau Rezki, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang
  Cc: rcu, linux-kernel, Gustavo Luiz Duarte

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.

Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
---
 kernel/rcu/Kconfig.debug | 24 ++++++++++++++++++++++++
 kernel/rcu/tree_stall.h  |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index 625d75392647..fc2c775eeefc 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -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
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index b67532cb8770..43ddabf46b5e 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -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[] = {

---
base-commit: 1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
change-id: 20260313-panic_on_rcustall-95709d1abf2f

Best regards,
-- 
Gustavo Luiz Duarte <gustavold@gmail.com>


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

* Re: [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option
  2026-03-13 16:56 [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option Gustavo Luiz Duarte
@ 2026-03-13 17:07 ` Paul E. McKenney
  2026-03-17 21:39   ` Joel Fernandes
  2026-03-13 17:43 ` Breno Leitao
  1 sibling, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2026-03-13 17:07 UTC (permalink / raw)
  To: Gustavo Luiz Duarte
  Cc: Breno Leitao, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu,
	linux-kernel

On Fri, Mar 13, 2026 at 09:56:49AM -0700, Gustavo Luiz Duarte wrote:
> 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.
> 
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>

Reviewed-by: Paul E. McKenney <paulmck@kernel.org>

> ---
>  kernel/rcu/Kconfig.debug | 24 ++++++++++++++++++++++++
>  kernel/rcu/tree_stall.h  |  2 +-
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
> index 625d75392647..fc2c775eeefc 100644
> --- a/kernel/rcu/Kconfig.debug
> +++ b/kernel/rcu/Kconfig.debug
> @@ -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
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index b67532cb8770..43ddabf46b5e 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -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[] = {
> 
> ---
> base-commit: 1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
> change-id: 20260313-panic_on_rcustall-95709d1abf2f
> 
> Best regards,
> -- 
> Gustavo Luiz Duarte <gustavold@gmail.com>
> 

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

* Re: [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option
  2026-03-13 16:56 [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option Gustavo Luiz Duarte
  2026-03-13 17:07 ` Paul E. McKenney
@ 2026-03-13 17:43 ` Breno Leitao
  1 sibling, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-03-13 17:43 UTC (permalink / raw)
  To: Gustavo Luiz Duarte
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu,
	linux-kernel

On Fri, Mar 13, 2026 at 09:56:49AM -0700, Gustavo Luiz Duarte wrote:
> 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.
> 
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>

Tested-by: Breno Leitao <leitao@debian.org>

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

* Re: [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option
  2026-03-13 17:07 ` Paul E. McKenney
@ 2026-03-17 21:39   ` Joel Fernandes
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Fernandes @ 2026-03-17 21:39 UTC (permalink / raw)
  To: paulmck, Gustavo Luiz Duarte
  Cc: Breno Leitao, Frederic Weisbecker, Neeraj Upadhyay, Josh Triplett,
	Boqun Feng, Uladzislau Rezki, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel



On 3/13/2026 1:07 PM, Paul E. McKenney wrote:
> On Fri, Mar 13, 2026 at 09:56:49AM -0700, Gustavo Luiz Duarte wrote:
>> 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.
>>
>> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
> 
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>

Applied for 7.1, thanks!
-- 
Joel Fernandes


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

end of thread, other threads:[~2026-03-17 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13 16:56 [PATCH] rcu: Add BOOTPARAM_RCU_STALL_PANIC Kconfig option Gustavo Luiz Duarte
2026-03-13 17:07 ` Paul E. McKenney
2026-03-17 21:39   ` Joel Fernandes
2026-03-13 17:43 ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox