mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] arm64: sdei: add sdei_nmi.disabled= to keep the GIC NMI path reachable
@ 2026-11-25  8:08 Jinjie Ruan
  2026-11-28 16:52 ` Prasanna Kumar T S M
  0 siblings, 1 reply; 2+ messages in thread
From: Jinjie Ruan @ 2026-11-25  8:08 UTC (permalink / raw)
  To: corbet, skhan, rdunlap, james.morse, rppt, arnd, kmehltretter,
	dapeng1.mi, elver, enelsonmoore, bp, jlayton, catalin.marinas,
	sean, suzuki.poulose, will, tzungbi, kas, wenst, steven.price,
	tzimmermann, ruanjinjie, linux-doc, linux-kernel,
	linux-arm-kernel, vladimir.murzin

While the SDEI cross-CPU NMI provider is active it claims every
cross-CPU backtrace, so on a platform whose firmware exposes SDEI
event 0 the irqchip NMI path can never be used.  There is no way to
opt out.

Add a boot parameter "sdei_nmi.disabled".

With sdei_nmi.disabled=1, the SDEI NMI will not be registered, so
sdei_nmi_available stays false and the hooks decline on their own, which
lets arch_trigger_cpumask_backtrace() fall through to its IPI path.

Suggested-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
v2:
- Alphabetical order.
- Simplify the code by return before registering event 0.
---
 Documentation/admin-guide/kernel-parameters.txt |  8 ++++++++
 drivers/firmware/Kconfig                        |  4 ++++
 drivers/firmware/arm_sdei_nmi.c                 | 17 +++++++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 176648941aec..4f07c771b46b 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -6934,6 +6934,14 @@ Kernel parameters
 			non-zero "wait" parameter.  See weight_single
 			and weight_many.
 
+	sdei_nmi.disabled= [ARM64,EARLY]
+			Disable SDEI-based cross-CPU NMI and leave the GIC NMI
+			path in place. Requires the kernel to be built with
+			CONFIG_ARM_SDEI_NMI.
+			Format: { "0" | "1" }
+			0 -- enable (default).
+			1 -- disable.
+
 	sdw_mclk_divider=[SDW]
 			Specify the MCLK divider for Intel SoundWire buses in
 			case the BIOS does not provide the clock rate properly.
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 43e2e2a64594..4c8b917867dd 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -58,6 +58,10 @@ config ARM_SDEI_NMI
 	  regardless of the target's PSTATE.DAIF -- forced delivery into a
 	  CPU wedged with interrupts locally masked.
 
+	  This provider takes over every cross-CPU backtrace; set the
+	  kernel parameter "sdei_nmi.disabled" to 1 to use the irqchip
+	  NMI path instead.
+
 	  If unsure, say N.
 
 config EDD
diff --git a/drivers/firmware/arm_sdei_nmi.c b/drivers/firmware/arm_sdei_nmi.c
index 038eb79e28ac..0e146e603354 100644
--- a/drivers/firmware/arm_sdei_nmi.c
+++ b/drivers/firmware/arm_sdei_nmi.c
@@ -62,6 +62,18 @@
 
 static bool sdei_nmi_available;
 
+/*
+ * Mirrors irqchip.gicv3_pseudo_nmi=: the architected NMI path
+ * is preferred when asked for, and SDEI stays out of the way.
+ */
+static bool sdei_nmi_disabled __initdata;
+
+static int __init sdei_nmi_disable_setup(char *str)
+{
+	return kstrtobool(str, &sdei_nmi_disabled);
+}
+early_param("sdei_nmi.disabled", sdei_nmi_disable_setup);
+
 #define SDEI_NMI_EVENT			0
 
 /*
@@ -222,6 +234,11 @@ static int __init sdei_nmi_init(void)
 	if (!sdei_is_present())
 		return 0;
 
+	if (sdei_nmi_disabled) {
+		pr_info("SDEI cross-CPU NMI disabled by sdei_nmi.disabled.\n");
+		return 0;
+	}
+
 	err = sdei_event_register(SDEI_NMI_EVENT, sdei_nmi_handler, NULL);
 	if (err) {
 		pr_err("sdei_event_register(%u) failed: %d\n",
-- 
2.34.1


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

* Re: [PATCH v2] arm64: sdei: add sdei_nmi.disabled= to keep the GIC NMI path reachable
  2026-11-25  8:08 [PATCH v2] arm64: sdei: add sdei_nmi.disabled= to keep the GIC NMI path reachable Jinjie Ruan
@ 2026-11-28 16:52 ` Prasanna Kumar T S M
  0 siblings, 0 replies; 2+ messages in thread
From: Prasanna Kumar T S M @ 2026-11-28 16:52 UTC (permalink / raw)
  To: Jinjie Ruan, corbet, skhan, rdunlap, james.morse, rppt, arnd,
	kmehltretter, dapeng1.mi, elver, enelsonmoore, bp, jlayton,
	catalin.marinas, sean, suzuki.poulose, will, tzungbi, kas, wenst,
	steven.price, tzimmermann, linux-doc, linux-kernel,
	linux-arm-kernel, vladimir.murzin



On 25-11-2026 13:38, Jinjie Ruan wrote:
> While the SDEI cross-CPU NMI provider is active it claims every
> cross-CPU backtrace, so on a platform whose firmware exposes SDEI
> event 0 the irqchip NMI path can never be used.  There is no way to
> opt out.
> 
> Add a boot parameter "sdei_nmi.disabled".
> 
> With sdei_nmi.disabled=1, the SDEI NMI will not be registered, so
> sdei_nmi_available stays false and the hooks decline on their own, which
> lets arch_trigger_cpumask_backtrace() fall through to its IPI path.
> 
> Suggested-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> v2:
> - Alphabetical order.
> - Simplify the code by return before registering event 0.
> ---
>   Documentation/admin-guide/kernel-parameters.txt |  8 ++++++++
>   drivers/firmware/Kconfig                        |  4 ++++
>   drivers/firmware/arm_sdei_nmi.c                 | 17 +++++++++++++++++
>   3 files changed, 29 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 176648941aec..4f07c771b46b 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -6934,6 +6934,14 @@ Kernel parameters
>   			non-zero "wait" parameter.  See weight_single
>   			and weight_many.
>   
> +	sdei_nmi.disabled= [ARM64,EARLY]
> +			Disable SDEI-based cross-CPU NMI and leave the GIC NMI
> +			path in place. Requires the kernel to be built with
> +			CONFIG_ARM_SDEI_NMI.
> +			Format: { "0" | "1" }
> +			0 -- enable (default).
> +			1 -- disable.
> +
>   	sdw_mclk_divider=[SDW]
>   			Specify the MCLK divider for Intel SoundWire buses in
>   			case the BIOS does not provide the clock rate properly.
> diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
> index 43e2e2a64594..4c8b917867dd 100644
> --- a/drivers/firmware/Kconfig
> +++ b/drivers/firmware/Kconfig
> @@ -58,6 +58,10 @@ config ARM_SDEI_NMI
>   	  regardless of the target's PSTATE.DAIF -- forced delivery into a
>   	  CPU wedged with interrupts locally masked.
>   
> +	  This provider takes over every cross-CPU backtrace; set the
> +	  kernel parameter "sdei_nmi.disabled" to 1 to use the irqchip
> +	  NMI path instead.
> +
>   	  If unsure, say N.
>   
>   config EDD
> diff --git a/drivers/firmware/arm_sdei_nmi.c b/drivers/firmware/arm_sdei_nmi.c
> index 038eb79e28ac..0e146e603354 100644
> --- a/drivers/firmware/arm_sdei_nmi.c
> +++ b/drivers/firmware/arm_sdei_nmi.c
> @@ -62,6 +62,18 @@
>   
>   static bool sdei_nmi_available;
>   
> +/*
> + * Mirrors irqchip.gicv3_pseudo_nmi=: the architected NMI path
> + * is preferred when asked for, and SDEI stays out of the way.
> + */
> +static bool sdei_nmi_disabled __initdata;
> +
> +static int __init sdei_nmi_disable_setup(char *str)
> +{
> +	return kstrtobool(str, &sdei_nmi_disabled);
> +}
> +early_param("sdei_nmi.disabled", sdei_nmi_disable_setup);
> +
>   #define SDEI_NMI_EVENT			0
>   
>   /*
> @@ -222,6 +234,11 @@ static int __init sdei_nmi_init(void)
>   	if (!sdei_is_present())
>   		return 0;
>   
> +	if (sdei_nmi_disabled) {
> +		pr_info("SDEI cross-CPU NMI disabled by sdei_nmi.disabled.\n");
> +		return 0;
> +	}
> +
>   	err = sdei_event_register(SDEI_NMI_EVENT, sdei_nmi_handler, NULL);
>   	if (err) {
>   		pr_err("sdei_event_register(%u) failed: %d\n",

Looks good to me.

Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>.

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

end of thread, other threads:[~2026-11-28 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  8:08 [PATCH v2] arm64: sdei: add sdei_nmi.disabled= to keep the GIC NMI path reachable Jinjie Ruan
2026-11-28 16:52 ` Prasanna Kumar T S M

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

all inboxes | Powered by JetHome®