From: sashiko-bot@kernel.org
To: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2] ARM, ARM64, LONGARCH: Delay HW BP notification to task_work()
Date: Fri, 14 Aug 2026 09:03:03 +0000 [thread overview]
Message-ID: <20260814090304.558901F0155A@smtp.kernel.org> (raw)
In-Reply-To: <20260814085118.OPEA_Ssn@linutronix.de>
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 <bigeasy@linutronix.de>
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.
Closes: https://lore.kernel.org/all/aho0eqjMESuHxECr@redhat.com/
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index ba5bd6a78fe7b..1ca91208e1524 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
[ ... ]
> @@ -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)))
[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?
> + put_event(bp);
> +}
> +#endif
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814085118.OPEA_Ssn@linutronix.de?part=1
next prev parent reply other threads:[~2026-08-14 9:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 8:51 [PATCH v2] ARM, ARM64, LONGARCH: Delay HW BP notification to task_work() Sebastian Andrzej Siewior
2026-08-14 8:51 ` Sebastian Andrzej Siewior
2026-08-14 9:03 ` sashiko-bot [this message]
2026-08-14 9:20 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260814090304.558901F0155A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.