[PATCH v2 00/39] arm64: Add support for FEAT_NMI

Jinjie Ruan ruanjinjie at huawei.com
Wed Nov 18 18:33:21 PST 2026



在 2026/11/18 21:22, Vladimir Murzin 写道:
> Hi Jinjie,

Hi Vladimir,

> 
> On 11/16/26 11:01, Jinjie Ruan wrote:
>>
>> 在 2026/11/16 18:02, Vladimir Murzin 写道:
>>> Hi Jinjie,
>>>
>>> On 11/16/26 06:58, Jinjie Ruan wrote:
>>>> Hi, Vladimir,
>>>>
>>>> While testing this patch set, I discovered IPI as NMI now defaults to
>>>> using SDEI, and the FEAT_NMI cannot cover this path..
>>>>
>>> Can you please expand on that? Sashiko has several comments related to
>>> interaction with SDEI which I'm planing to dig into. However, glancing
>> I mean the following code now prefer sdei nmi now, we can not use FEAT_NMI:
>>
>>  954 void arch_trigger_cpumask_backtrace(const cpumask_t *mask, int
>> exclude_cpu)
>>  955 {
>>  956         /*
>>  957          * Prefer the SDEI cross-CPU NMI provider when active: firmware
>>  958          * dispatches the event out of EL3 and reaches CPUs that have
>>  959          * interrupts locally masked, without the per-IRQ-mask cost
>> that
>>  960          * pseudo-NMI pays for the same reach. The plain IPI path below
>>  961          * can't reach such a CPU unless pseudo-NMI is enabled.
>>  962          */
>>  963         if (sdei_nmi_trigger_cpumask_backtrace(mask, exclude_cpu))
>>  964                 return;
>>  965
>>  966         /*
>>  967          * NOTE: though nmi_trigger_cpumask_backtrace() has "nmi_"
>> in the name,
>>  968          * nothing about it truly needs to be implemented using an
>> NMI, it's
>>  969          * just that it's _allowed_ to work with NMIs. If
>> ipi_should_be_nmi()
>>  970          * returned false our backtrace attempt will just use a
>> regular IPI.
>>  971          */
>>  972         nmi_trigger_cpumask_backtrace(mask, exclude_cpu,
>> arm64_backtrace_ipi);
>>  973 }
>>
>>
> 
> Ahh, I did not notice that. Perhaps we can do something like bellow
> 
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index c4d1aff31258..17da29f4a7ec 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -955,8 +955,24 @@ 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(smp_processor_id(), IPI_CPU_BACKTRACE))
> +               return false;

This false case should be Pseudo-NMI and IRQ.

> +
> +       nmi_trigger_cpumask_backtrace(mask, exclude_cpu, arm64_backtrace_ipi);
> +
> +       return true;

This is FEAT_NMI

> +}
> +
>  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
> 
> 
> So, preference order would be NMI -> SDEI NMI -> IRQ. My understanding that

Based on the motivation of the cross CPU SDEI patch, I guess the order
should be as follows:

FEAT_NMI > SDEI NMI > Pseudo-NMI > IRQ

> users of SDEI NMI do not opt-in for pseudo-NMI so they get what they want, and

My understanding is the same.

> if they do not want FEAT_NMI they can opt-out via id_aa64pfr1.nmi=0.

I believe this situation is relatively rare and does not seem to align
with the original intent of SDEI NMI. In its cover letter, there is the
following statement, and I understand that if hardware supports FEAT_NMI
should be used as the default first priority.

"FEAT_NMI (Armv8.8) -- the architectural fix, but absent from deployed
    silicon and from most of the fleet for years to come."

Link: https://lore.kernel.org/all/cover.1782744912.git.kas@kernel.org/

> 
> If it makes sense to you I'll include it in the series as separate patch.
> 
> Cheers
> Vladimir
> 
>>> over smp_send_stop() IPI as NMI is kind of try and see approach:
>>>
>>>   try normal IPI
>>>   if CPU is still online
>>>     try NMI IPI
>>>   if CPU is still online
>>>    try SDEI NMI
>>>   if CPU is still online
>>>    give up
>>>
>>> So, if NMI IPI did not trigger in your test, I'm really keen on details.
>>>
>>> Thanks
>>> Vladimir
>>
> 




More information about the linux-arm-kernel mailing list