ARM, ARM64, LONGARCH: Delay HW BP notification to task_work()
Subsystems (7)
Sebastian Andrzej Siewior
maintainerPATCH v2 1/1 ARM, ARM64, LONGARCH: Delay HW BP notification to task_work()
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_arch_hwbp_notify(), a generic perf callback which delayes the actual callback invocation to task_work_add() callback. This callback invokes the architecture defines callback arch_hwbp_send_sig(). This requires struct callback_head and the functions require ARCH_NEED_PERF_HW_NOTIF to be defined.
This was reported against ARM64. ARM and LongARCH follow the same pattern are also converted.
---
v1…v2: https://lore.kernel.org/all/[email protected]/
- sashiko complained that a memory breakpoint might trigger several times before a signal is sent if the syscall touches the memory (via get_user()) more than once before returning back. This would lead to list corruption in task_work_add(). To handle this, there is now a variable which is set via xchg before task_work_add() and cleared after the signal has been sent.
arch/arm/include/asm/hw_breakpoint.h | 1 + arch/arm/kernel/ptrace.c | 6 ++--- arch/arm64/include/asm/hw_breakpoint.h | 1 + arch/arm64/kernel/ptrace.c | 6 ++--- arch/loongarch/include/asm/hw_breakpoint.h | 1 + arch/loongarch/kernel/ptrace.c | 6 ++--- include/linux/hw_breakpoint.h | 3 +++ include/linux/perf_event.h | 4 ++++ kernel/events/core.c | 26 ++++++++++++++++++++++ 9 files changed, 42 insertions(+), 12 deletions(-)
arch/arm/include/asm/hw_breakpoint.h +1 -0
@@ -7,6 +7,7 @@struct task_struct ; #ifdef CONFIG_HAVE_HW_BREAKPOINT +#define ARCH_NEED_PERF_HW_NOTIF struct arch_hw_breakpoint_ctrl { u32 __reserved : 9,
arch/arm/kernel/ptrace.c +2 -4
@@ -347,9 +347,7 @@ static long ptrace_hbp_idx_to_num(int idx)/* * Handle hitting a HW-breakpoint. */ -static void ptrace_hbptriggered (struct perf_event *bp, -struct perf_sample_data *data, -struct pt_regs *regs) +void arch_hwbp_send_sig (struct perf_event *bp) {struct arch_hw_breakpoint *bkpt =counter_arch_bp (bp);long num;
@@ -424,7 +422,7 @@ static struct perf_event *ptrace_hbp_create(struct task_struct *tsk, int type) attr.bp_type = type; attr.disabled =1 ; -return register_user_hw_breakpoint (&attr, ptrace_hbptriggered,NULL , +return register_user_hw_breakpoint (&attr, perf_arch_hwbp_notify,NULL , tsk); }
arch/arm64/include/asm/hw_breakpoint.h +1 -0
@@ -124,6 +124,7 @@ extern void hw_breakpoint_pmu_read(struct perf_event *bp);extern int hw_breakpoint_slots (int type);#ifdef CONFIG_HAVE_HW_BREAKPOINT +#define ARCH_NEED_PERF_HW_NOTIF extern void hw_breakpoint_thread_switch (struct task_struct *next);extern void ptrace_hw_copy_thread (struct task_struct *task);#else
arch/arm64/kernel/ptrace.c +2 -4
@@ -168,9 +168,7 @@ void ptrace_disable(struct task_struct *child)/* * Handle hitting a HW-breakpoint. */ -static void ptrace_hbptriggered (struct perf_event *bp, -struct perf_sample_data *data, -struct pt_regs *regs) +void arch_hwbp_send_sig (struct perf_event *bp) {struct arch_hw_breakpoint *bkpt =counter_arch_bp (bp);const char *desc ="Hardware breakpoint trap (ptrace)" ;
@@ -312,7 +310,7 @@ static struct perf_event *ptrace_hbp_create(unsigned int note_type, attr.bp_type = type; attr.disabled =1 ; - bp =register_user_hw_breakpoint (&attr, ptrace_hbptriggered,NULL , tsk); + bp =register_user_hw_breakpoint (&attr, perf_arch_hwbp_notify,NULL , tsk);if (IS_ERR (bp))return bp;
arch/loongarch/include/asm/hw_breakpoint.h +1 -0
@@ -120,6 +120,7 @@ void breakpoint_handler(struct pt_regs *regs);void watchpoint_handler (struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT +#define ARCH_NEED_PERF_HW_NOTIF extern void ptrace_hw_copy_thread (struct task_struct *task);extern void hw_breakpoint_thread_switch (struct task_struct *next);#else
arch/loongarch/kernel/ptrace.c +2 -4
@@ -384,9 +384,7 @@ static int lbt_set(struct task_struct *target,/* * Handle hitting a HW-breakpoint. */ -static void ptrace_hbptriggered (struct perf_event *bp, -struct perf_sample_data *data, -struct pt_regs *regs) +void arch_hwbp_send_sig (struct perf_event *bp) {int i;struct arch_hw_breakpoint *bkpt =counter_arch_bp (bp);
@@ -479,7 +477,7 @@ static struct perf_event *ptrace_hbp_create(unsigned int note_type, attr.bp_type = type; attr.disabled =1 ; - bp =register_user_hw_breakpoint (&attr, ptrace_hbptriggered,NULL , tsk); + bp =register_user_hw_breakpoint (&attr, perf_arch_hwbp_notify,NULL , tsk);if (IS_ERR (bp))return bp;
include/linux/hw_breakpoint.h +3 -0
@@ -85,6 +85,9 @@ extern int register_perf_hw_breakpoint(struct perf_event *bp);extern void unregister_hw_breakpoint (struct perf_event *bp);extern void unregister_wide_hw_breakpoint (struct perf_event *__percpu *cpu_events);extern bool hw_breakpoint_is_used (void ); +extern void arch_hwbp_send_sig (struct perf_event *bp); +extern void perf_arch_hwbp_notify (struct perf_event *bp,struct perf_sample_data *data, +struct pt_regs *regs);extern int dbg_reserve_bp_slot (struct perf_event *bp);extern int dbg_release_bp_slot (struct perf_event *bp);
include/linux/perf_event.h +4 -0
@@ -215,6 +215,10 @@ struct hw_perf_event {/* Last sync'ed generation of filters */ unsigned long addr_filters_gen; +#ifdef ARCH_NEED_PERF_HW_NOTIF +struct callback_head arch_hw_notif; +int arch_hw_notif_busy; +#endif /* * hw_perf_event::state flags; used to track the PERF_EF_* state.
kernel/events/core.c +26 -0
@@ -13338,6 +13338,28 @@ static void account_event(struct perf_event *event)account_pmu_sb_event (event); } +#ifdef ARCH_NEED_PERF_HW_NOTIF +static void perf_arch_hwbp_send_sig (struct callback_head *head) +{ +struct perf_event *bp; + + bp = container_of(head, struct perf_event, hw.arch_hw_notif); +arch_hwbp_send_sig (bp); +xchg_relaxed (&bp->hw.arch_hw_notif_busy,0 ); +put_event (bp); +} + +void perf_arch_hwbp_notify (struct perf_event *bp,struct perf_sample_data *data, +struct pt_regs *regs) +{ +if (WARN_ON_ONCE (!atomic_long_inc_not_zero (&bp->refcount))) +return ; +if (xchg_relaxed (&bp->hw.arch_hw_notif_busy,1 ) || +WARN_ON_ONCE (task_work_add (current, &bp->hw.arch_hw_notif,TWA_RESUME ))) +put_event (bp); +} +#endif +/* * Allocate and initialize an event structure */
@@ -13443,6 +13465,10 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, }if (overflow_handler) { +#ifdef ARCH_NEED_PERF_HW_NOTIF +if (overflow_handler == perf_arch_hwbp_notify) +init_task_work (&event->hw.arch_hw_notif, perf_arch_hwbp_send_sig); +#endif event->overflow_handler = overflow_handler; event->overflow_handler_context = context; }else if (is_write_backward (event)){
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Deadlock/hang in blocking syscalls due to missing TWA_SIGNAL when delaying hardware breakpoint…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Deadlock/hang in blocking syscalls due to missing TWA_SIGNAL when delaying hardware breakpoint notification --
--- Patch [1]: [PATCH v2] ARM, ARM64, LONGARCH: Delay HW BP notification to task_work() --- commit 5153bc880ca6886ee1fe14a21ba3ae8477562c21
Author: Sebastian Andrzej Siewior <[email protected]>
ARM, ARM64, LONGARCH: Delay HW BP notification to task_work()
This commit delays hardware breakpoint event callbacks to task_work to prevent "sleeping while atomic" warnings on PREEMPT_RT. The architecture- specific callbacks now use perf_arch_hwbp_notify() to queue the SIGTRAP delivery until the return to userland.
Quoted 4 lines
kernel/events/core.c +0
-0
[ ... ]
Quoted 12 lines
kernel/events/core.c +8
-0@@ -13338,6 +13338,28 @@ static void account_event(struct perf_event *event)account_pmu_sb_event (event); } +#ifdef ARCH_NEED_PERF_HW_NOTIF +static void perf_arch_hwbp_send_sig (struct callback_head *head) +{ +struct perf_event *bp; + + bp = container_of(head, struct perf_event, hw.arch_hw_notif); +arch_hwbp_send_sig (bp); +xchg_relaxed (&bp->hw.arch_hw_notif_busy,0 );
kernel/events/core.c static void account_event(struct perf_event *event) · line 13358
Quoted 10 lines
kernel/events/core.c +10
-0+put_event (bp); +} + +void perf_arch_hwbp_notify (struct perf_event *bp,struct perf_sample_data *data, +struct pt_regs *regs) +{ +if (WARN_ON_ONCE (!atomic_long_inc_not_zero (&bp->refcount))) +return ; +if (xchg_relaxed (&bp->hw.arch_hw_notif_busy,1 ) || +WARN_ON_ONCE (task_work_add (current, &bp->hw.arch_hw_notif,TWA_RESUME )))
[Severity: High]
Will using TWA_RESUME here cause a hang if a hardware watchpoint is triggered during a blocking syscall like futex() or read()?
When a blocking syscall accesses watched memory (e.g., via get_user()), the watchpoint synchronously triggers and queues the SIGTRAP task work via task_work_add(). Since TWA_RESUME only sets TIF_NOTIFY_RESUME, and signal_pending() ignores TIF_NOTIFY_RESUME, the syscall wait loop will not abort.
Does this need to use TWA_SIGNAL instead so that TIF_NOTIFY_SIGNAL is set and the interruptible sleep correctly aborts to deliver the pending task work?
Quoted 3 lines
kernel/events/core.c +3
-0+ put_event(bp); +} +#endif
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sebastian Andrzej Siewior
maintainerQuoted 6 lines · On 2026-08-14 09:03:03 [+0000], [email protected] wrote:
kernel/events/core.c static void account_event(struct perf_event *event) · line 13358
Quoted 2 lines
kernel/events/core.c +2
-0+if (xchg_relaxed (&bp->hw.arch_hw_notif_busy,1 ) || +WARN_ON_ONCE (task_work_add (current, &bp->hw.arch_hw_notif,TWA_RESUME )))[Severity: High]
Will usingTWA_RESUMEhere cause a hang if a hardware watchpoint is triggered during a blocking syscall likefutex()orread()?
Quoted 8 lines
When a blocking syscall accesses watched memory (e.g., via
get_user()), the watchpoint synchronously triggers and queues the SIGTRAP task work viatask_work_add(). SinceTWA_RESUMEonly setsTIF_NOTIFY_RESUME, andsignal_pending()ignoresTIF_NOTIFY_RESUME, the syscall wait loop will not abort.Does this need to use
TWA_SIGNALinstead so thatTIF_NOTIFY_SIGNALis set and the interruptible sleep correctly aborts to deliver the pending task work?
Well, this only means that the signal will be delivered once the syscall handling is complete. I don't see a reason why the syscall should be interrupted just to deliver the signal right away. The logic should not be affected by delivering the signal immediately.
Quoted 3 lines
kernel/events/core.c static void account_event(struct perf_event *event) · line 13361
Quoted 3 lines
kernel/events/core.c +3
-0+ put_event(bp); +} +#endif
Sebastian
Quoted 16 lines · Sebastian Andrzej Siewior
Quoted 6 lines · On 2026-08-14 09:03:03 [+0000], [email protected] wrote:
kernel/events/core.c static void account_event(struct perf_event *event) · line 13358
Quoted 2 lines
kernel/events/core.c +2
-0+if (xchg_relaxed (&bp->hw.arch_hw_notif_busy,1 ) || +WARN_ON_ONCE (task_work_add (current, &bp->hw.arch_hw_notif,TWA_RESUME )))[Severity: High]
Will usingTWA_RESUMEhere cause a hang if a hardware watchpoint is triggered during a blocking syscall likefutex()orread()?Quoted 8 lines
When a blocking syscall accesses watched memory (e.g., via
get_user()), the watchpoint synchronously triggers and queues the SIGTRAP task work viatask_work_add(). SinceTWA_RESUMEonly setsTIF_NOTIFY_RESUME, andsignal_pending()ignoresTIF_NOTIFY_RESUME, the syscall wait loop will not abort.Does this need to use
TWA_SIGNALinstead so thatTIF_NOTIFY_SIGNALis set and the interruptible sleep correctly aborts to deliver the pending task work?
Quoted 8 lines
Well, this only means that the signal will be delivered once the syscall handling is complete. I don't see a reason why the syscall should be interrupted just to deliver the signal right away. The logic should not be affected by delivering the signal immediately.
Quoted 3 lines
kernel/events/core.c static void account_event(struct perf_event *event) · line 13361
Quoted 3 lines
kernel/events/core.c +3
-0+ put_event(bp); +} +#endif
Sebastian, do you intend to perform any extra work on this patch or is it ready for consumption? I have been using this change in test kernels for a while now and haven't had a single problem so far.
Best,
Luis
Quoted 2 lines
Sebastian
---end quoted text---
Sebastian Andrzej Siewior
maintainerQuoted 3 lines · Luis Claudio R. Goncalves
Sebastian, do you intend to perform any extra work on this patch or is it ready for consumption? I have been using this change in test kernels for a while now and haven't had a single problem so far.
I think it is okay. I just poked on the original patch checking if this is okay.
Quoted 2 lines
Best,
Luis
Sebastian
Sebastian Andrzej Siewior
maintainerQuoted 16 lines · On 2026-08-14 10:51:18 [+0200], To [email protected] 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, aspinlock_twhich becomes a sleeping lock and must not be acquired in atomic context.Delay the event callback until the return to userland.
Addperf_arch_hwbp_notify(), a generic perf callback which delayes the actual callback invocation totask_work_add()callback. This callback invokes the architecture defines callbackarch_hwbp_send_sig(). This requires structcallback_headand the functions requireARCH_NEED_PERF_HW_NOTIFto be defined.
Quoted 7 lines
This was reported against ARM64. ARM and LongARCH follow the same pattern are also converted.
Reported-by Luis Claudio R. Goncalves <[email protected]>Reported-by Waiman Long <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Did this get lost, should I repost it or is there something obviously wrong with it and nobody wanted to hurt my feelings by telling me?
Sebastian
Russell King
maintainerQuoted 20 lines · Sebastian Andrzej Siewior
Quoted 19 lines · On 2026-08-14 10:51:18 [+0200], To [email protected] 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, aspinlock_twhich becomes a sleeping lock and must not be acquired in atomic context.Delay the event callback until the return to userland.
Addperf_arch_hwbp_notify(), a generic perf callback which delayes the actual callback invocation totask_work_add()callback. This callback invokes the architecture defines callbackarch_hwbp_send_sig(). This requires structcallback_headand the functions requireARCH_NEED_PERF_HW_NOTIFto be defined.This was reported against ARM64. ARM and LongARCH follow the same pattern are also converted.
Quoted 7 lines
Quoted 4 lines
Reported-by Luis Claudio R. Goncalves <[email protected]>Reported-by Waiman Long <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>Did this get lost, should I repost it or is there something obviously wrong with it and nobody wanted to hurt my feelings by telling me?
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Steven Rostedt
maintainerQuoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Looks like the patch should be broken up into a 4 part series.
One to add the ARCH_NEED_PERF_HW_NOTIF code to the generic code.
Then one for each architecture to add the code needed to set that.
Then the architecture maintainers could ack their patch and the perf maintainer can pull it all in.
-- Steve
Sebastian Andrzej Siewior
maintainerQuoted 6 lines · Steven Rostedt
Quoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Well, if you as the ARM person are fine with ARM part, an ACK would be appreciated. If you have something to object, it would be nice to let me know so I can adjust accordingly.
Quoted 8 lines
Looks like the patch should be broken up into a 4 part series.
One to add the
ARCH_NEED_PERF_HW_NOTIFcode to the generic code.Then one for each architecture to add the code needed to set that.
Then the architecture maintainers could ack their patch and the perf maintainer can pull it all in.
We could first agree if this is the right way of fixing it (from both, perf side and ARCH side).
Then we could either route this via perf with ARCH's acks or split it and route via individual trees if needed. Having it routed separately needs to be coordinated since the ARCH bits can't be applied without having the perf bits first.
Then there is also the question if this should get fixes tag on commit d8fccd9ca5f90 ("arm64: Allow to enable PREEMPT_RT.") (which would also cover loongarch and arm).
As of today I have just Luis responding that it works for him.
Quoted 1 line
-- Steve
Sebastian
Russell King
maintainerQuoted 11 lines · Sebastian Andrzej Siewior
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Well, if you as the ARM person are fine with ARM part, an ACK would be appreciated. If you have something to object, it would be nice to let me know so I can adjust accordingly.
First, I only just looked at the email - you may have noticed I'm not very active with the kernel anymore, as I'm a full-time carer at the moment.
Second, I'm not fine with the patch as-is, because it's not clear how it could be merged in its current form. It would be inappropriate to give an Ack, because an Ack means I'm fine with it. I'm not.
Third, I haven't actually reviewed the patch itself (see first point).
Looking deeper now, I see nothing in the linked report, nor in your write-up that identifies what is responsible for the context being inappropriate to deliver the SIGTRAP. See the first point - I'm not able to read lots of code to work that out, and presumably you've already done that ground work to come up with a fix. This is *vital* information when someone looks back at why this change was made as it helps to understand how the problem occurs. This is, after all, the whole point of commit messages - to help people look back and understand why a change was made. The "what the changes are" part is already covered by the patch showing what the changes were. It's the stuff that *isn't* in the patch that needs to be in the commit message.
So... don't describe the code changes in a commit message.
So no, an Ack is not appropriate.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Sebastian Andrzej Siewior
maintainerQuoted 21 lines · Russell King
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Well, if you as the ARM person are fine with ARM part, an ACK would be appreciated. If you have something to object, it would be nice to let me know so I can adjust accordingly.
First, I only just looked at the email - you may have noticed I'm not very active with the kernel anymore, as I'm a full-time carer at the moment.
Second, I'm not fine with the patch as-is, because it's not clear how it could be merged in its current form. It would be inappropriate to give an Ack, because an Ack means I'm fine with it. I'm not.
Quoted 5 lines
Third, I haven't actually reviewed the patch itself (see first point).
Looking deeper now, I see nothing in the linked report, nor in your write-up that identifies what is responsible for the context being inappropriate to deliver the SIGTRAP. See the first point - I'm not
The linked report shows a backtrace by "BUG: sleeping function" originating from el0_breakpt() -> perf_bp_event() following by sending a signal force_sig_fault() followed by rt_spin_lock() and __might_resched(). It also contains a reproducer.
The first sentence has the part
| The hardware event is | delivered with disabled interrupts and perf intrastrucure expects | disabled interrupts while the overflow callback is invoked.
This is what happens, followed by
| 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.
This is not really specific to PREEMPT_RT as we enforce to not allow raw_spinlock_t -> spinlock_t on !PREEMPT_RT via lockdep, too.
Quoted 11 lines
able to read lots of code to work that out, and presumably you've already done that ground work to come up with a fix. This is *vital* information when someone looks back at why this change was made as it helps to understand how the problem occurs. This is, after all, the whole point of commit messages - to help people look back and understand why a change was made. The "what the changes are" part is already covered by the patch showing what the changes were. It's the stuff that *isn't* in the patch that needs to be in the commit message.
So... don't describe the code changes in a commit message.
I think both parts (describing the issue and the change) are part of the commit message.
Quoted 1 line
So no, an Ack is not appropriate.
Sebastian
Russell King
maintainerQuoted 33 lines · Sebastian Andrzej Siewior
Quoted 21 lines · Russell King
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Well, if you as the ARM person are fine with ARM part, an ACK would be appreciated. If you have something to object, it would be nice to let me know so I can adjust accordingly.
First, I only just looked at the email - you may have noticed I'm not very active with the kernel anymore, as I'm a full-time carer at the moment.
Second, I'm not fine with the patch as-is, because it's not clear how it could be merged in its current form. It would be inappropriate to give an Ack, because an Ack means I'm fine with it. I'm not.
Quoted 5 lines
Third, I haven't actually reviewed the patch itself (see first point).
Looking deeper now, I see nothing in the linked report, nor in your write-up that identifies what is responsible for the context being inappropriate to deliver the SIGTRAP. See the first point - I'm not
The linked report shows a backtrace by "BUG: sleeping function" originating from
el0_breakpt()->perf_bp_event()following by sending a signalforce_sig_fault()followed byrt_spin_lock()and__might_resched(). It also contains a reproducer.
Quoted 4 lines
The first sentence has the part
| The hardware event is | delivered with disabled interrupts and perf intrastrucure expects | disabled interrupts while the overflow callback is invoked.
*Where* are interrupts disabled?
Quoted 29 lines
This is what happens, followed by
| 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.This is not really specific to
PREEMPT_RTas we enforce to not allowraw_spinlock_t->spinlock_ton !PREEMPT_RT via lockdep, too.Quoted 11 lines
able to read lots of code to work that out, and presumably you've already done that ground work to come up with a fix. This is *vital* information when someone looks back at why this change was made as it helps to understand how the problem occurs. This is, after all, the whole point of commit messages - to help people look back and understand why a change was made. The "what the changes are" part is already covered by the patch showing what the changes were. It's the stuff that *isn't* in the patch that needs to be in the commit message.
So... don't describe the code changes in a commit message.
I think both parts (describing the issue and the change) are part of the commit message.
Quoted 1 line
So no, an Ack is not appropriate.
Sebastian
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Sebastian Andrzej Siewior
maintainerQuoted 34 lines · Russell King
Quoted 33 lines · Sebastian Andrzej Siewior
Quoted 21 lines · Russell King
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Well, if you as the ARM person are fine with ARM part, an ACK would be appreciated. If you have something to object, it would be nice to let me know so I can adjust accordingly.
First, I only just looked at the email - you may have noticed I'm not very active with the kernel anymore, as I'm a full-time carer at the moment.
Second, I'm not fine with the patch as-is, because it's not clear how it could be merged in its current form. It would be inappropriate to give an Ack, because an Ack means I'm fine with it. I'm not.
Quoted 5 lines
Third, I haven't actually reviewed the patch itself (see first point).
Looking deeper now, I see nothing in the linked report, nor in your write-up that identifies what is responsible for the context being inappropriate to deliver the SIGTRAP. See the first point - I'm not
The linked report shows a backtrace by "BUG: sleeping function" originating from
el0_breakpt()->perf_bp_event()following by sending a signalforce_sig_fault()followed byrt_spin_lock()and__might_resched(). It also contains a reproducer.
Quoted 6 lines
Quoted 4 lines
The first sentence has the part
| The hardware event is | delivered with disabled interrupts and perf intrastrucure expects | disabled interrupts while the overflow callback is invoked.*Where* are interrupts disabled?
On exception entry point, that would el0t_64_sync() for arm64 as in the report.
Sebastian
Russell King
maintainerQuoted 40 lines · Sebastian Andrzej Siewior
Quoted 39 lines · Russell King
Quoted 37 lines · Sebastian Andrzej Siewior
Quoted 21 lines · Russell King
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Thu, 3 Sep 2026 17:47:24 +0100 Russell King <[email protected]> wrote:
What do you expect to happen with this? Which arch maintainer should apply this patch that affects three different independently maintained architectures?
Well, if you as the ARM person are fine with ARM part, an ACK would be appreciated. If you have something to object, it would be nice to let me know so I can adjust accordingly.
First, I only just looked at the email - you may have noticed I'm not very active with the kernel anymore, as I'm a full-time carer at the moment.
Second, I'm not fine with the patch as-is, because it's not clear how it could be merged in its current form. It would be inappropriate to give an Ack, because an Ack means I'm fine with it. I'm not.
Quoted 5 lines
Third, I haven't actually reviewed the patch itself (see first point).
Looking deeper now, I see nothing in the linked report, nor in your write-up that identifies what is responsible for the context being inappropriate to deliver the SIGTRAP. See the first point - I'm not
The linked report shows a backtrace by "BUG: sleeping function" originating from
el0_breakpt()->perf_bp_event()following by sending a signalforce_sig_fault()followed byrt_spin_lock()and__might_resched(). It also contains a reproducer.The first sentence has the part
| The hardware event is | delivered with disabled interrupts and perf intrastrucure expects | disabled interrupts while the overflow callback is invoked.
Quoted 4 lines
Quoted 1 line
*Where* are interrupts disabled?
On exception entry point, that would
el0t_64_sync()for arm64 as in the report.
Oh FFS. So why does this need to be done on ARM? Explain it. This is what I'm trying to get out of you, but you're being very resistant to providing the technical details. I can only think you haven't actually done the analysis.
So, NAK.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Sebastian Andrzej Siewior
maintainerQuoted 12 lines · Russell King
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
The linked report shows a backtrace by "BUG: sleeping function" originating from
el0_breakpt()->perf_bp_event()following by sending a signalforce_sig_fault()followed byrt_spin_lock()and__might_resched(). It also contains a reproducer.The first sentence has the part
| The hardware event is | delivered with disabled interrupts and perf intrastrucure expects | disabled interrupts while the overflow callback is invoked.*Where* are interrupts disabled?
Quoted 7 lines
Quoted 2 lines
On exception entry point, that would
el0t_64_sync()for arm64 as in the report.Oh FFS. So why does this need to be done on ARM? Explain it. This is what I'm trying to get out of you, but you're being very resistant to providing the technical details. I can only think you haven't actually done the analysis.
I had the feeling that this is not what you were expecting but I wasn't sure what you were expecting either.
The hardware breakpoint is delivered to the OS via an exception and on exception entry point the interrupts are disabled. This isn't unique to ARM but the same on other architectures, too.
It is not limited to ARM but also Loongarch which is sending a signal in its handler (the one registered via register_user_hw_breakpoint()). It is not an issue on X86 because they don't send signal but just toggle the DR6 register.
powerpc and sh have different logic where the perf event is disabled without sending a signal.
xtensa is the only one untouched which does send a signal from the hw-breakpoint handler but xtensa does not support PREEMPT_RT and therefore doesn't enforce proper lock nesting (so this is likely not the only issue).
Quoted 1 line
So, NAK.
Would you reconsider, please? It does not seem justified.
Sebastian
Russell King
maintainerQuoted 21 lines · Sebastian Andrzej Siewior
Quoted 12 lines · Russell King
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
The linked report shows a backtrace by "BUG: sleeping function" originating from
el0_breakpt()->perf_bp_event()following by sending a signalforce_sig_fault()followed byrt_spin_lock()and__might_resched(). It also contains a reproducer.The first sentence has the part
| The hardware event is | delivered with disabled interrupts and perf intrastrucure expects | disabled interrupts while the overflow callback is invoked.*Where* are interrupts disabled?
Quoted 7 lines
Quoted 2 lines
On exception entry point, that would
el0t_64_sync()for arm64 as in the report.Oh FFS. So why does this need to be done on ARM? Explain it. This is what I'm trying to get out of you, but you're being very resistant to providing the technical details. I can only think you haven't actually done the analysis.
Quoted 6 lines
I had the feeling that this is not what you were expecting but I wasn't sure what you were expecting either.
The hardware breakpoint is delivered to the OS via an exception and on exception entry point the interrupts are disabled. This isn't unique to ARM but the same on other architectures, too.
Yes, architecturally, when the CPU enters an exception handler, interrupts are disabled by the CPU. However, that doesn't translate to "the kernel runs with interrupts disabled". In most cases, we re-enable interrupts if the exception comes from userspace.
However, I have no idea where in the call path is between the exception being entered and the code you have a problem with - and I've now forgotten where to find the call path, and I don't have time to find it again. You are making this incredibly difficult, and I don't have time for this. Sorry, this is my last reply for a while, because this is just too much stress at this time for me.
What was a simple request has turned into a major source of frustration.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!