firmware: arm_sdei: Fix NMI backtrace lockups on idle CPUs
Subsystems (3)
cover firmware: arm_sdei: Fix NMI backtrace lockups on idle CPUs
The SDEI NMI backtrace signals event 0 to every other CPU, including the ones in a power-down idle state, where the kernel has SDEI masked. TF-A acknowledges the SGI behind event 0 on a masked PE and never ends it, and the PE takes no Non-secure interrupt again. Jinjie hit it on a 384-CPU HIP12, where one sysrq-l locked up the machine.
Patch 1 keeps event 0 away from masked PEs. Patch 2 sends the regular backtrace IPI to the CPUs that SDEI refused, which wakes them.
TF-A v2.13 and later refuse to signal a masked PE, but a PE that masks right after the check still takes the SGI. The TF-A fix is under review:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55414
Tested under QEMU TCG with TF-A built without that check, 4 CPUs. One CPU masks and unmasks SDEI in a loop, through cpu_pm, the mask calls and CPU hotplug, while another signals it; sysrq-l afterwards. Signalling with plain SMCs, as the kernel does now, wedges the target. With the series every run passed, lockdep included, and a panic in the middle of it completes.
Jinjie ran an earlier version on HIP12 with the power-down state
enabled: sysrq-l got 384/384 answers every run. The handshake has changed since; Jinjie, could you give this one a run as well?
Kiryl Shutsemau (Meta) (2):
firmware: arm_sdei: Do not signal event 0 to a masked PE
firmware: arm_sdei_nmi: Send the backtrace IPI to CPUs with SDEI
masked
arch/arm64/include/asm/nmi.h | 7 ++ arch/arm64/kernel/smp.c | 2 +- drivers/firmware/arm_sdei.c | 130 ++++++++++++++++++++++++++++++-- drivers/firmware/arm_sdei_nmi.c | 30 ++++++-- include/linux/arm_sdei.h | 4 +- 5 files changed, 157 insertions(+), 16 deletions(-)
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
Signature · 1 line
2.54.0
PATCH 1/2 firmware: arm_sdei: Do not signal event 0 to a masked PE
The SDEI NMI backtrace signals event 0 to every other CPU, idle ones included. The kernel masks SDEI on a PE around power-down idle states, on its way offline and when it stops.
TF-A raises event 0 with an SGI. On a masked PE it acknowledges the SGI and never ends it; the event should stay pending until SDEI_PE_UNMASK. TF-A v2.13 and later refuse to signal a masked PE, but a target that masks just after the check still takes the SGI. A fix is under review [1].
The PE keeps running at the SDEI priority and takes no Non-secure interrupt again, even after SDEI_PE_UNMASK. Other CPUs hang in csd_lock_wait() on their next cross-call to it. One sysrq-l locked up a 384-CPU machine.
Keep event 0 away from masked PEs. Each PE gets a lock, an unmasked flag and a count of signals raised at it. sdei_event_signal() signals a PE only under its lock with the flag set, and returns -EAGAIN otherwise. Before it masks, a PE clears the flag under the lock and waits for the signals already raised to arrive, which SDEI delivers whatever the PE's interrupt masks. The wait is limited to a millisecond: a signal raised while another is pending merges into it, and the count never drains.
Senders can run from an SDEI event or a pseudo-NMI, so they only try the lock. A panicking CPU skips it, as a panic from such a context may have left it held by that CPU.
The cpu_pm notifier also runs on a PE that is masked already: before sdei_cpuhp_up(), and between sdei_cpuhp_down() and CPU_OFF. Make it unmask only what it masked itself, or the PE comes back from CPU_OFF masked while the kernel takes it as unmasked.
sdei_event_signal() now takes a logical CPU number.
[1] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55414
--- drivers/firmware/arm_sdei.c | 130 ++++++++++++++++++++++++++++++-- drivers/firmware/arm_sdei_nmi.c | 9 ++- include/linux/arm_sdei.h | 4 +- 3 files changed, 131 insertions(+), 12 deletions(-)
drivers/firmware/arm_sdei.c +124 -6
@@ -12,6 +12,7 @@#include <linux/cpuhotplug.h> #include <linux/cpu.h> #include <linux/cpu_pm.h> +#include <linux/delay.h> #include <linux/errno.h> #include <linux/hardirq.h> #include <linux/kernel.h>
@@ -32,6 +33,8 @@#include <linux/smp.h> #include <linux/spinlock.h> +#include <asm/smp_plat.h> +/* * The call to use to reach the firmware. */
@@ -299,10 +302,78 @@ static int sdei_api_get_version(u64 *version)return invoke_sdei_fn (SDEI_1_0_FN_SDEI_VERSION ,0 ,0 ,0 ,0 ,0 , version); } +/* +* Event 0 must not reach a PE that has SDEI masked. Firmware may +* acknowledge the SGI behind it and never end it, and the PE then takes +* no Non-secure interrupt at all. +* +* A sender signals a PE only with the PE's lock held, and only if the PE +* is unmasked. The PE takes its lock to mark itself masked: no sender gets +* through after that, and a sender that got through before has counted +* its signal in @raised and raised it. The PE lets its signals arrive +* before it masks: each event 0 takes one off @raised. @pm_masked records +* what the cpu_pm notifier masked. +*/ +struct sdei_pe { +raw_spinlock_t lock; +atomic_t raised; +bool unmasked; +bool pm_masked; +}; + +static DEFINE_PER_CPU(struct sdei_pe, sdei_pe) = { + .lock =__RAW_SPIN_LOCK_UNLOCKED (sdei_pe.lock), +}; + +/* Wait for event 0 signals in flight to this PE to arrive */ +static void sdei_wait_in_flight (struct sdei_pe *pe) +{ +int i; + +/* Bounded: a signal that never arrives must not hold up masking */ +for (i =0 ; i <USEC_PER_MSEC &&atomic_read (&pe->raised) >0 ; i++) +udelay (1 ); + +if (atomic_read (&pe->raised) >0 ) { +pr_warn_once ("event 0 to CPU[%u] did not arrive within 1ms\n" , +smp_processor_id ()); + } + +/* +* A signal raised while an earlier one is still pending merges into +* it, and the count stays high with nothing on its way: drop it. A +* signal that arrives after this finds the count at zero and leaves it. +*/ +atomic_set (&pe->raised,0 ); +} + +/* Stop event 0 signals to this PE, waiting for the senders under the lock */ +static void sdei_block_signal (void ) +{ +struct sdei_pe *pe =this_cpu_ptr (&sdei_pe); +unsigned long flags; + +/* +* A panic from an SDEI event or a pseudo-NMI may have left the lock +* held by this CPU. The CPUs that could signal it are stopped by now. +*/ +if (panic_on_this_cpu ()) { +WRITE_ONCE (pe->unmasked, false); + }else { +raw_spin_lock_irqsave (&pe->lock, flags); +WRITE_ONCE (pe->unmasked, false); +raw_spin_unlock_irqrestore (&pe->lock, flags); + } + +sdei_wait_in_flight (pe); +} +int sdei_mask_local_cpu (void ) {int err; +sdei_block_signal (); + err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PE_MASK ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO ) { pr_warn_once("failed to mask CPU[%u]: %d\n",
@@ -330,6 +401,8 @@ int sdei_unmask_local_cpu(void)return err; } +/* No lock: a sender that misses this only refuses an unmasked PE */ +WRITE_ONCE (this_cpu_ptr (&sdei_pe)->unmasked, true);return 0 ; }
@@ -340,14 +413,34 @@ static void _ipi_unmask_cpu(void *ignored) }/* -* Signal the software-signalled event (event 0) to @mpidr. Does nothing -* but the SMC -- no locks, no event lookup -- so it is safe from NMI / -* crash context (e.g. the cross-CPU NMI service). +* Signal the software-signalled event (event 0) to @cpu. It waits for no +* lock and looks up no event, so it is safe from NMI / crash context (e.g. +* the cross-CPU NMI service). +* +* Returns -EAGAIN without signalling if @cpu has SDEI masked or is masking. */ -int sdei_event_signal (u32 event_num,u64 mpidr) +int sdei_event_signal (u32 event_num,unsigned int cpu) { -return invoke_sdei_fn (SDEI_1_0_FN_SDEI_EVENT_SIGNAL , event_num, - mpidr,0 ,0 ,0 ,NULL ); +struct sdei_pe *pe =per_cpu_ptr (&sdei_pe, cpu); +u64 mpidr =cpu_logical_map (cpu); +unsigned long flags; +int err = -EAGAIN ; + +/* IRQs off: the PE may be waiting for the lock to mask */ +if (!raw_spin_trylock_irqsave (&pe->lock, flags)) +return -EAGAIN ; + +if (READ_ONCE (pe->unmasked)) { +atomic_inc (&pe->raised); + err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_EVENT_SIGNAL , event_num, + mpidr,0 ,0 ,0 ,NULL ); +/* A late signal may have taken this count already */ +if (err) +atomic_dec_if_positive (&pe->raised); + } + +raw_spin_unlock_irqrestore (&pe->lock, flags); +return err; }NOKPROBE_SYMBOL (sdei_event_signal);
@@ -680,6 +773,9 @@ static int sdei_cpuhp_down(unsigned int cpu)struct sdei_event *event;int err; +/* A signal must arrive while event 0 is still registered here */ +sdei_block_signal (); +/* un-register private events */ spin_lock (&sdei_list_lock);list_for_each_entry (event, &sdei_list, list) {
@@ -733,16 +829,30 @@ static int sdei_cpuhp_up(unsigned int cpu)static int sdei_pm_notifier (struct notifier_block *nb,unsigned long action,void *data) { +struct sdei_pe *pe =this_cpu_ptr (&sdei_pe);int rv;WARN_ON_ONCE (preemptible ());switch (action) {case CPU_PM_ENTER : +/* +* Leave alone a PE that is masked already: before +* sdei_cpuhp_up(), or after sdei_cpuhp_down(), as cpuidle runs +* until CPU_OFF. CPU_PM_EXIT must not unmask it. +*/ +if (!pe->unmasked) +return NOTIFY_DONE ; rv =sdei_mask_local_cpu (); +if (!rv) + pe->pm_masked = true;break ;case CPU_PM_EXIT :case CPU_PM_ENTER_FAILED : +/* Unmask only what CPU_PM_ENTER masked */ +if (!pe->pm_masked) +return NOTIFY_DONE ; + pe->pm_masked = false; rv =sdei_unmask_local_cpu ();break ;default :
@@ -1114,6 +1224,14 @@ int sdei_event_handler(struct pt_regs *regs,int err;u32 event_num = arg->event_num; +/* +* One signal raised at this PE has arrived. If the PE gave up waiting +* for it and dropped the count, leave the count at zero: below zero, +* the PE would not wait for the next signal raised here. +*/ +if (!event_num) +atomic_dec_if_positive (&this_cpu_ptr (&sdei_pe)->raised); + err = arg->callback (event_num, regs, arg->callback_arg);if (err) pr_err_ratelimited("event %u on CPU %u failed with error: %d\n",
drivers/firmware/arm_sdei_nmi.c +5 -4
@@ -36,7 +36,7 @@* * Delivery uses the standard SDEI software-signalled event (event 0) and * SDEI_EVENT_SIGNAL. We register a handler for event 0, enable it, and -* poke a target CPU with sdei_event_signal(0, mpidr): firmware makes +* poke a target CPU with sdei_event_signal(0, cpu): firmware makes * event 0 pending on that PE and dispatches the handler NMI-like, * regardless of the target's DAIF. * Availability is simply whether event 0 registers and enables -- if SDEI
@@ -58,7 +58,6 @@#include <linux/types.h> #include <asm/nmi.h> -#include <asm/smp_plat.h> static bool sdei_nmi_available;
@@ -127,11 +126,13 @@ NOKPROBE_SYMBOL(sdei_nmi_handler);static void sdei_nmi_fire (unsigned int target_cpu) { -int err =sdei_event_signal (SDEI_NMI_EVENT ,cpu_logical_map (target_cpu)); +int err =sdei_event_signal (SDEI_NMI_EVENT , target_cpu); -if (err) +/* -EAGAIN: the CPU has SDEI masked and is not signalled */ +if (err && err != -EAGAIN ) {pr_warn ("SDEI_EVENT_SIGNAL to CPU %u failed: %d\n" , target_cpu, err); + } }/*
include/linux/arm_sdei.h +2 -2
@@ -39,9 +39,9 @@ int sdei_event_disable(u32 event_num);/* * Signal the software-signalled event (event 0) to another PE, NMI-like. -* @mpidr is the target's MPIDR affinity. +* Returns -EAGAIN if @cpu has SDEI masked. */ -int sdei_event_signal (u32 event_num,u64 mpidr); +int sdei_event_signal (u32 event_num,unsigned int cpu);/* Was SDEI firmware probed and usable? */ bool sdei_is_present (void );
Signature · 1 line
2.54.0
PATCH 2/2 firmware: arm_sdei_nmi: Send the backtrace IPI to CPUs with SDEI masked
In reply to Kiryl Shutsemau (Meta)sdei_event_signal() refuses a CPU that has SDEI masked. An NMI backtrace then gets nothing from such a CPU and, after 10 seconds, reports it as not responding.
The CPU is in a power-down idle state or going offline, and the regular backtrace IPI wakes it. Send that IPI to the CPUs SDEI refused; every other CPU still gets event 0.
A stop needs nothing extra: smp_send_stop() has sent its IPIs before it signals SDEI, and a CPU still online after that is reported as not stopped.
--- arch/arm64/include/asm/nmi.h | 7 +++++++ arch/arm64/kernel/smp.c | 2 +- drivers/firmware/arm_sdei_nmi.c | 21 ++++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-)
arch/arm64/include/asm/nmi.h +7 -0
@@ -45,4 +45,11 @@ static inline void sdei_nmi_stop_cpus(const cpumask_t *mask) { }*/ void __noreturn arm64_nmi_cpu_stop (struct pt_regs *regs,bool die_on_crash); +/* +* Send the regular backtrace IPI (an NMI with pseudo-NMI) to @mask. The +* SDEI provider uses it for the CPUs it cannot signal. Defined in +* arch/arm64/kernel/smp.c. +*/ +void arm64_backtrace_ipi (cpumask_t *mask); +#endif /* __ASM_NMI_H */
arch/arm64/kernel/smp.c +1 -1
@@ -946,7 +946,7 @@ static void arm64_send_ipi(const cpumask_t *mask, unsigned int nr)__ipi_send_single (get_ipi_desc (cpu, nr), cpu); } -static void arm64_backtrace_ipi (cpumask_t *mask) +void arm64_backtrace_ipi (cpumask_t *mask) {arm64_send_ipi (mask,IPI_CPU_BACKTRACE ); }
drivers/firmware/arm_sdei_nmi.c +18 -3
@@ -124,7 +124,7 @@ static int sdei_nmi_handler(u32 event, struct pt_regs *regs, void *arg) }NOKPROBE_SYMBOL (sdei_nmi_handler); -static void sdei_nmi_fire (unsigned int target_cpu) +static int sdei_nmi_fire (unsigned int target_cpu) {int err =sdei_event_signal (SDEI_NMI_EVENT , target_cpu);
@@ -133,8 +133,13 @@ static void sdei_nmi_fire(unsigned int target_cpu)pr_warn ("SDEI_EVENT_SIGNAL to CPU %u failed: %d\n" , target_cpu, err); } + +return err; } +/* CPUs to IPI instead; nmi_trigger_cpumask_backtrace() serialises its users */ +static cpumask_t sdei_nmi_ipi_mask; +/* * Raise callback for nmi_trigger_cpumask_backtrace(): signal event 0 * at every CPU still pending in @mask. The framework excludes the local
@@ -151,8 +156,18 @@ static void sdei_nmi_raise_backtrace(cpumask_t *mask)*/ dsb (ishst); -for_each_cpu (cpu, mask) -sdei_nmi_fire (cpu); +cpumask_clear (&sdei_nmi_ipi_mask); +for_each_cpu (cpu, mask) { +if (sdei_nmi_fire (cpu) == -EAGAIN ) +cpumask_set_cpu (cpu, &sdei_nmi_ipi_mask); + } + +/* +* A CPU with SDEI masked is in a power-down idle state or going +* offline. The IPI wakes it and it reports like any other. +*/ +if (!cpumask_empty (&sdei_nmi_ipi_mask)) +arm64_backtrace_ipi (&sdei_nmi_ipi_mask); }/*
Signature · 1 line
2.54.0
Quoted 21 lines · Kiryl Shutsemau (Meta)
The SDEI NMI backtrace signals event 0 to every other CPU, including the ones in a power-down idle state, where the kernel has SDEI masked. TF-A acknowledges the SGI behind event 0 on a masked PE and never ends it, and the PE takes no Non-secure interrupt again. Jinjie hit it on a 384-CPU HIP12, where one sysrq-l locked up the machine.
Patch 1 keeps event 0 away from masked PEs. Patch 2 sends the regular backtrace IPI to the CPUs that SDEI refused, which wakes them.
TF-A v2.13 and later refuse to signal a masked PE, but a PE that masks right after the check still takes the SGI. The TF-A fix is under review:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55414
Tested under QEMU TCG with TF-A built without that check, 4 CPUs. One CPU masks and unmasks SDEI in a loop, through
cpu_pm, the mask calls and CPU hotplug, while another signals it; sysrq-l afterwards. Signalling with plain SMCs, as the kernel does now, wedges the target. With the series every run passed, lockdep included, and a panic in the middle of it completes.
Quoted 3 lines
Jinjie ran an earlier version on HIP12 with the power-down state
enabled: sysrq-l got 384/384 answers every run. The handshake has changed since; Jinjie, could you give this one a run as well?
On HIP12 (SDEI v1.0 firmware), v7.4-rc3 plus the two patches, SDEI active, acpi_idle with state1 = CorePowerdown enabled: sysrq-l answered on all 384 CPUs on every run, nine runs total, three of them under load.
No "still haven't responded", no SDEI_EVENT_SIGNAL failures, no "did
not arrive within 1ms" warnings, no lockups.
State1/usage shows the CPUs really did go through CorePowerdown, so the handshake and the IPI fallback were exercised.
Thanks,
Jinjie
Quoted 15 lines
Kiryl Shutsemau (Meta) (2):
firmware:arm_sdei: Do not signal event 0 to a masked PE
firmware:arm_sdei_nmi: Send the backtrace IPI to CPUs with SDEI
maskedarch/arm64/include/asm/nmi.h | 7 ++ arch/arm64/kernel/smp.c | 2 +- drivers/firmware/arm_sdei.c | 130 ++++++++++++++++++++++++++++++-- drivers/firmware/arm_sdei_nmi.c | 30 ++++++-- include/linux/arm_sdei.h | 4 +- 5 files changed, 157 insertions(+), 16 deletions(-)base-commit:
b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
Re: [PATCH 1/2] firmware: arm_sdei: Do not signal event 0 to a masked PE
In reply to Kiryl Shutsemau (Meta)Hi Kirill,
Quoted 1 line · Kiryl Shutsemau (Meta)
The SDEI NMI backtrace signals event 0 to every other CPU, idle ones
<snip>
drivers/firmware/arm_sdei.c static int sdei_api_get_version(u64 *version) · line 361
Quoted 11 lines
drivers/firmware/arm_sdei.c +11
-0+static void sdei_block_signal (void ) +{ +struct sdei_pe *pe =this_cpu_ptr (&sdei_pe); +unsigned long flags; + +/* +* A panic from an SDEI event or a pseudo-NMI may have left the lock +* held by this CPU. The CPUs that could signal it are stopped by now. +*/ +if (panic_on_this_cpu ()) { +WRITE_ONCE (pe->unmasked, false);
If the panic didn't take the lock, should lock be taken just like "else" path?
Quoted 15 lines
drivers/firmware/arm_sdei.c +10
-0+ }else { +raw_spin_lock_irqsave (&pe->lock, flags); +WRITE_ONCE (pe->unmasked, false); +raw_spin_unlock_irqrestore (&pe->lock, flags); + } + +sdei_wait_in_flight (pe); +} +static int sdei_pm_notifier (struct notifier_block *nb,unsigned long action,void *data) { +struct sdei_pe *pe =this_cpu_ptr (&sdei_pe);int rv;
drivers/firmware/arm_sdei.c static int sdei_cpuhp_up(unsigned int cpu) · line 844
Quoted 10 lines
drivers/firmware/arm_sdei.c +6
-0WARN_ON_ONCE (preemptible ());switch (action) {case CPU_PM_ENTER : +/* +* Leave alone a PE that is masked already: before +* sdei_cpuhp_up(), or after sdei_cpuhp_down(), as cpuidle runs +* until CPU_OFF. CPU_PM_EXIT must not unmask it. +*/ +if (!pe->unmasked)
I am wondering whether READ_ONCE() should be used here?
Regards
Yin, Fengwei
Re: [PATCH 2/2] firmware: arm_sdei_nmi: Send the backtrace IPI to CPUs with SDEI masked
In reply to Kiryl Shutsemau (Meta)Quoted 8 lines · Kiryl Shutsemau (Meta)
sdei_event_signal()refuses a CPU that has SDEI masked. An NMI backtrace then gets nothing from such a CPU and, after 10 seconds, reports it as not responding.The CPU is in a power-down idle state or going offline, and the regular backtrace IPI wakes it. Send that IPI to the CPUs SDEI refused; every other CPU still gets event 0.
Quoted 7 lines
A stop needs nothing extra:
smp_send_stop()has sent its IPIs before it signals SDEI, and a CPU still online after that is reported as not stopped.Fixes 0c2c56598cc1 ("drivers/firmware: add SDEI cross-CPU NMI service for arm64")Signed-off-by Kiryl Shutsemau (Meta) <[email protected]>
Regards
Yin, Fengwei
Re: [PATCH 1/2] firmware: arm_sdei: Do not signal event 0 to a masked PE
In reply to YinFengweiQuoted 5 lines · YinFengwei
Hi Kirill,
Quoted 1 line · Kiryl Shutsemau (Meta)
The SDEI NMI backtrace signals event 0 to every other CPU, idle ones
<snip>
Quoted 13 lines
drivers/firmware/arm_sdei.c static int sdei_api_get_version(u64 *version) · line 361
Quoted 11 lines
drivers/firmware/arm_sdei.c +11
-0+static void sdei_block_signal (void ) +{ +struct sdei_pe *pe =this_cpu_ptr (&sdei_pe); +unsigned long flags; + +/* +* A panic from an SDEI event or a pseudo-NMI may have left the lock +* held by this CPU. The CPUs that could signal it are stopped by now. +*/ +if (panic_on_this_cpu ()) { +WRITE_ONCE (pe->unmasked, false);If the panic didn't take the lock, should lock be taken just like "else" path?
If another CPU holds it at this point, that CPU was stopped in the middle of signalling this one, and it will never drop the lock. The panic would hang on it.
If nobody holds it, there is nothing for it to keep out. This runs at the end of smp_send_stop(), after the other CPUs have been stopped. A sender stopped after it took the lock has either counted its signal, which sdei_wait_in_flight() waits for, or never sent one.
Telling the two apart takes a trylock, and on failure we would go ahead without the lock anyway.
Quoted 17 lines
Quoted 17 lines
drivers/firmware/arm_sdei.c +10
-0+ }else { +raw_spin_lock_irqsave (&pe->lock, flags); +WRITE_ONCE (pe->unmasked, false); +raw_spin_unlock_irqrestore (&pe->lock, flags); + } + +sdei_wait_in_flight (pe); +} +static int sdei_pm_notifier (struct notifier_block *nb,unsigned long action,void *data) { +struct sdei_pe *pe =this_cpu_ptr (&sdei_pe);int rv;WARN_ON_ONCE (preemptible ());
Quoted 9 lines
drivers/firmware/arm_sdei.c static int sdei_cpuhp_up(unsigned int cpu) · line 844
Quoted 8 lines
drivers/firmware/arm_sdei.c +6
-0switch (action) {case CPU_PM_ENTER : +/* +* Leave alone a PE that is masked already: before +* sdei_cpuhp_up(), or after sdei_cpuhp_down(), as cpuidle runs +* until CPU_OFF. CPU_PM_EXIT must not unmask it. +*/ +if (!pe->unmasked)I am wondering whether
READ_ONCE()should be used here?
No.
We read the flag of this CPU, and only this CPU writes pe->unmasked. The notifier runs with IRQs off, so no store can race with this load.
What can still interrupt it, a stop or a panic from an SDEI event or a pseudo-NMI, does not return here.
READ_ONCE()/WRITE_ONCE() are for sdei_event_signal(), which reads the flag from another CPU.
Left plain, KCSAN will report it if that ever changes. See item 5 under "Use of Plain C-Language Accesses" in tools/memory-model/Documentation/access-marking.txt.
Signature · 1 line
Kiryl Shutsemau / Kirill A. Shutemov