From: Russell King <linux@armlinux.org.uk>
To: Xie Yuanbin <xieyuanbin1@huawei.com>
Cc: bigeasy@linutronix.de, clrkwllms@kernel.org, rostedt@goodmis.org,
linusw@kernel.org, arnd@arndb.de,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev,
liaohua4@huawei.com, lilinjie8@huawei.com
Subject: Re: [PATCH] ARM: enable interrupts when arm_notify_die() is handling user mode errors
Date: Thu, 25 Jun 2026 11:23:34 +0100 [thread overview]
Message-ID: <aj0BpqlaCh3cVw8Q@shell.armlinux.org.uk> (raw)
In-Reply-To: <20260625100031.25088-1-xieyuanbin1@huawei.com>
On Thu, Jun 25, 2026 at 06:00:31PM +0800, Xie Yuanbin wrote:
> On 2026-06-25 10:05:52 [+0100], Russell King wrote:
> > > for this but actual breakpoint handling might be broken or is it
> > > just me? But then your stack trace looks like mine so :/
> >
> > ARM Linux doesn't use BKPT. BKPT was an instruction introduced by Arm
> > Ltd in ARMv5TE. Prior to this, we use a UDF instruction instead (we
> > had to pick something!) and gdb and other tools use that as a
> > breapoint.
> >
> > Moreover, BKPT isn't guaranteed to trap to the kernel, especially when
> > there is a hardware debugger connected. In that case, DDI0100E states
> > that use of BKPT must be according to the instructions provided with
> > the hardware debugger. This makes BKPT unsuitable for use.
>
> When do_DataAbort()/do_PrefetchAbort() run into `inf->fn()`, and the
> hook function return != 0 with interrupts disabled, the WARN may be
> triggered. From the code perspective, there are countless possible
> places, and "bkpt #0" is just one of these.
>
> For example:
> bcm5301x_init_early()->hook_fault_code(bcm5301x_abort_handler).
> if CONFIG_ARCH_BCM_5301X=y, then bcm5301x_abort_handler() may return 1
> without enabling the interrupts.
> if CONFIG_ARCH_BCM_5301X=n, then in the same scenario it will run into
> do_bad(), also return 1 without enabling the interrupts.
>
> So I think maybe:
> 1. enable interrupts in all hook functions, maybe
> multiple points for modification.
> 2. enable interrupts in do_DataAbort()/do_PrefetchAbort() before
> `inf->fn()`, but harden_branch_predictor() may be difficult.
Unfortunately, this breaks the Spectre/Meltdown mitigations. The
page fault handlers must be entered with interrupts disabled.
> 3. enable interrupts in do_DataAbort()/do_PrefetchAbort() after
> `inf->fn()`, this may be ok.
>
> From this perspective, arm_notify_die() also seems to be a good place?
If one is happy with higher latency for preempt cases, then it may
be, but if we want lower latency, then it ought to be earlier.
My preference is (3).
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2026-06-25 10:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 7:35 [PATCH] ARM: enable interrupts when arm_notify_die() is handling user mode errors Xie Yuanbin
2026-06-25 8:50 ` Sebastian Andrzej Siewior
2026-06-25 9:05 ` Russell King
2026-06-25 9:30 ` Sebastian Andrzej Siewior
2026-06-25 10:20 ` Russell King
2026-06-25 12:08 ` Sebastian Andrzej Siewior
2026-06-25 10:00 ` Xie Yuanbin
2026-06-25 10:23 ` Russell King [this message]
2026-06-25 12:26 ` Xie Yuanbin
2026-06-25 15:21 ` 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=aj0BpqlaCh3cVw8Q@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=liaohua4@huawei.com \
--cc=lilinjie8@huawei.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=xieyuanbin1@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox