[PATCH v3 06/44] arm64: smp: Prefer hardware NMI over SDEI NMI

Jinjie Ruan ruanjinjie at huawei.com
Tue Dec 1 22:11:51 PST 2026



在 2026/11/30 23:54, Vladimir Murzin 写道:
> SDEI NMI is expected to be used when hardware-based NMI is either
> unavailable or disabled. However, when both are available,
> arch_trigger_cpumask_backtrace() still prefers SDEI NMI.
> 
> Historically, we could not guarantee that an IPI was backed by a
> hardware NMI, as the interrupt controller could lack NMI support or
> refuse to configure the IPI as an NMI.
> 
> Now that we can check whether an IPI is backed by a hardware NMI,
> prefer it over SDEI NMI in arch_trigger_cpumask_backtrace().
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin at arm.com>
> ---
>  arch/arm64/kernel/smp.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index 7d4a31ee9a4c..9e5b4bcc6316 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -955,14 +955,29 @@ static void arm64_backtrace_ipi(cpumask_t *mask)
>  	arm64_send_ipi(mask, IPI_CPU_BACKTRACE);
>  }
>  
> +static bool arm64_nmi_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu)
> +{
> +	if (!ipi_is_nmi(raw_smp_processor_id(), IPI_CPU_BACKTRACE))
> +		return false;

If ipi_is_nmi is true, it can be either a FEAT_NMI or a pseudo NMI,
does what you call hardware NMI include pseudo-NMI?

> +
> +	nmi_trigger_cpumask_backtrace(mask, exclude_cpu, arm64_backtrace_ipi);
> +
> +	return true;
> +}
> +
>  void arch_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu)
>  {
> +	/*
> +	 * Backtrace IPI is NMI, use that.
> +	 */
> +	if (arm64_nmi_trigger_cpumask_backtrace(mask, exclude_cpu))
> +		return;
> +
>  	/*
>  	 * Prefer the SDEI cross-CPU NMI provider when active: firmware
>  	 * dispatches the event out of EL3 and reaches CPUs that have
>  	 * interrupts locally masked, without the per-IRQ-mask cost that
> -	 * pseudo-NMI pays for the same reach. The plain IPI path below
> -	 * can't reach such a CPU unless pseudo-NMI is enabled.
> +	 * pseudo-NMI pays for the same reach.
>  	 */
>  	if (sdei_nmi_trigger_cpumask_backtrace(mask, exclude_cpu))
>  		return;




More information about the linux-arm-kernel mailing list