Re: [PATCH v5] ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work()
From: Peter Zijlstra
Date: Fri Nov 20 2026 - 10:09:12 EST
On Fri, Nov 20, 2026 at 03:45:53PM +0100, Sebastian Andrzej Siewior wrote:
> Waiman, Luis, Ada reported that HW breakpoints on ARM64 trigger
> "sleeping while atomic" warnings on PREEMPT_RT. The hardware event is
> delivered with disabled interrupts and perf intrastrucure expects
> disabled interrupts while the overflow callback is invoked.
>
> The callback then sends a SIGTRAP signal for which it acquires
> sighand_struct::siglock, a spinlock_t which becomes a sleeping lock and
> must not be acquired in atomic context.
>
> Delay the event callback until the return to userland.
> Add perf_hwbp_notify(), a generic perf callback which delayes the
> actual callback invocation to task_work_add() callback. This callback
> invokes the architecture defined callback perf_arch_hwbp_send_sig().
> This requires struct callback_head and the functions require
> ARCH_NEED_PERF_HW_NOTIFY to be defined.
>
> This was reported against ARM64. ARM, LongARCH and Xtensa follow the
> same pattern are also converted. Xtensa is the only not supporting
> PREEMPT_RT but now we have all architectures using the same pattern.
>
> Fixes: d8fccd9ca5f90 ("arm64: Allow to enable PREEMPT_RT.")
> Reported-by: Luis Claudio R. Goncalves <lgoncalv@xxxxxxxxxx>
> Reported-by: Waiman Long <longman@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/aho0eqjMESuHxECr@xxxxxxxxxx/
> Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@xxxxxxx>
> Tested-by: Ada Couprie Diaz <ada.coupriediaz@xxxxxxx>
> Reviewed-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
Mark; you was going to stare at this :-)
I'm thinking the archs are doing it wrong and should be sending the
signal elsewhere.