From: Mark Rutland <mark.rutland@arm.com>
To: linux-arm-kernel@lists.infradead.org,
Andy Lutomirski <luto@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@kernel.org>, Will Deacon <will@kernel.org>
Cc: mark.rutland@arm.com, ruanjinjie@huawei.com,
vladimir.murzin@arm.com, linux-kernel@vger.kernel.org
Subject: [PATCH 00/10] arm64/entry:
Date: Tue, 7 Apr 2026 14:16:40 +0100 [thread overview]
Message-ID: <20260407131650.3813777-1-mark.rutland@arm.com> (raw)
Since the move to generic IRQ entry, arm64's involuntary kernel
preemption logic has been subtly broken, and preemption can lead to
tasks running with some exceptions masked unexpectedly.
The gory details were discussed in the thread for my earlier attempt to
fix this:
https://lore.kernel.org/linux-arm-kernel/20260320113026.3219620-1-mark.rutland@arm.com/
https://lore.kernel.org/linux-arm-kernel/ab1prenkP-tFgUzK@J2N7QTR9R3.cambridge.arm.com/
https://lore.kernel.org/linux-arm-kernel/ab2EZAXvL6bYcuKt@J2N7QTR9R3.cambridge.arm.com/
https://lore.kernel.org/linux-arm-kernel/acPAzdtjK5w-rNqC@J2N7QTR9R3/
In summary, due to the way arm64's exceptions work architecturally, and
due to some constraints on sequencing during entry/exit, fixing this
properly requires tha arm64 handles more of the sequencing and
(architectural) state management itself.
This series attempts to make that possible by refactoring the generic
irqentry kernel mode entry/exit paths to look more like the user mode
entry/exit paths, with a separate 'prepare' step prior to return. The
refactoring also allows more of the generic irqentry code to be inlined
into architectural entry code, which can result in slightly better code
generation.
I've split the series into a prefix of changes for generic irqentry,
followed by changes to the arm64 code. I'm hoping that we can queue the
generic irqentry patches onto a stable branch, or take those via arm64.
The patches are as follows:
* Patches 1 and 2 are cleanup to the generic irqentry code. These have no
functional impact, and I think these can be taken regardless of the
rest of the series.
* Patches 3 to 5 refactor the generic irqentry code as described above,
providing separate irqentry_{enter,exit}() functions and providing a
split form of irqentry_exit_to_kernel_mode() similar to what exists
for irqentry_exit_to_user_mode(). These patches alone should have no
functional impact.
* Patch 6 is a minimal fix for the arm64 exception masking issues. This
DOES NOT depend on the generic irqentry patches, and can be backported
to stable.
* Patches 7 to 9 refactor the arm64 entry code and provide a more
optimal fix (which permits preemption in more cases). These are split
into separate patches to aid bisection.
* Patch 10 is a test which can detect exceptions being masked
unexpectedly. I don't know whether we want to take this as-is, but
I've included it here to aid testing and so that it gets archived for
future reference.
The series is based on v7.0-rc3.
Thanks,
Mark.
Mark Rutland (10):
entry: Fix stale comment for irqentry_enter()
entry: Remove local_irq_{enable,disable}_exit_to_user()
entry: Move irqentry_enter() prototype later
entry: Split kernel mode logic from irqentry_{enter,exit}()
entry: Split preemption from irqentry_exit_to_kernel_mode()
arm64: entry: Don't preempt with SError or Debug masked
arm64: entry: Consistently prefix arm64-specific wrappers
arm64: entry: Use irqentry_{enter_from,exit_to}_kernel_mode()
arm64: entry: Use split preemption logic
arm64: Check DAIF (and PMR) at task-switch time
arch/arm64/kernel/entry-common.c | 52 ++++----
arch/arm64/kernel/process.c | 25 ++++
include/linux/entry-common.h | 2 +-
include/linux/irq-entry-common.h | 196 ++++++++++++++++++++++---------
kernel/entry/common.c | 107 ++---------------
5 files changed, 202 insertions(+), 180 deletions(-)
--
2.30.2
next reply other threads:[~2026-04-07 13:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 13:16 Mark Rutland [this message]
2026-04-07 13:16 ` [PATCH 01/10] entry: Fix stale comment for irqentry_enter() Mark Rutland
2026-04-08 1:14 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 02/10] entry: Remove local_irq_{enable,disable}_exit_to_user() Mark Rutland
2026-04-08 1:18 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 03/10] entry: Move irqentry_enter() prototype later Mark Rutland
2026-04-08 1:21 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 04/10] entry: Split kernel mode logic from irqentry_{enter,exit}() Mark Rutland
2026-04-08 1:32 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 05/10] entry: Split preemption from irqentry_exit_to_kernel_mode() Mark Rutland
2026-04-08 1:40 ` Jinjie Ruan
2026-04-08 9:17 ` Jinjie Ruan
2026-04-08 10:19 ` Mark Rutland
2026-04-07 13:16 ` [PATCH 06/10] arm64: entry: Don't preempt with SError or Debug masked Mark Rutland
2026-04-08 1:47 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 07/10] arm64: entry: Consistently prefix arm64-specific wrappers Mark Rutland
2026-04-08 1:49 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 08/10] arm64: entry: Use irqentry_{enter_from,exit_to}_kernel_mode() Mark Rutland
2026-04-08 1:50 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 09/10] arm64: entry: Use split preemption logic Mark Rutland
2026-04-08 1:52 ` Jinjie Ruan
2026-04-07 13:16 ` [PATCH 10/10] arm64: Check DAIF (and PMR) at task-switch time Mark Rutland
2026-04-08 2:17 ` Jinjie Ruan
2026-04-08 9:08 ` Mark Rutland
2026-04-07 21:08 ` [PATCH 00/10] arm64/entry: Thomas Gleixner
2026-04-08 9:02 ` Mark Rutland
2026-04-08 9:06 ` Catalin Marinas
2026-04-08 10:14 ` Thomas Gleixner
2026-04-08 9:19 ` Peter Zijlstra
2026-04-08 17:25 ` (subset) " Catalin Marinas
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=20260407131650.3813777-1-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=ruanjinjie@huawei.com \
--cc=tglx@kernel.org \
--cc=vladimir.murzin@arm.com \
--cc=will@kernel.org \
/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