]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
entry: Remove local_irq_{enable,disable}_exit_to_user()
authorMark Rutland <mark.rutland@arm.com>
Tue, 7 Apr 2026 13:16:42 +0000 (14:16 +0100)
committerThomas Gleixner <tglx@kernel.org>
Wed, 8 Apr 2026 09:43:31 +0000 (11:43 +0200)
local_irq_enable_exit_to_user() and local_irq_disable_exit_to_user() are
never overridden by architecture code, and are always equivalent to
local_irq_enable() and local_irq_disable().

These functions were added on the assumption that arm64 would override
them to manage 'DAIF' exception masking, as described by Thomas Gleixner
in these threads:

  https://lore.kernel.org/all/20190919150809.340471236@linutronix.de/
  https://lore.kernel.org/all/alpine.DEB.2.21.1910240119090.1852@nanos.tec.linutronix.de/

In practice arm64 did not need to override either. Prior to moving to
the generic irqentry code, arm64's management of DAIF was reworked in
commit:

  97d935faacde ("arm64: Unmask Debug + SError in do_notify_resume()")

Since that commit, arm64 only masks interrupts during the 'prepare' step
when returning to user mode, and masks other DAIF exceptions later.
Within arm64_exit_to_user_mode(), the arm64 entry code is as follows:

local_irq_disable();
exit_to_user_mode_prepare_legacy(regs);
local_daif_mask();
mte_check_tfsr_exit();
exit_to_user_mode();

Remove the unnecessary local_irq_enable_exit_to_user() and
local_irq_disable_exit_to_user() functions.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260407131650.3813777-3-mark.rutland@arm.com
include/linux/entry-common.h
include/linux/irq-entry-common.h
kernel/entry/common.c

index f83ca0abf2cdb2ebfedddeb244d0ed2dc3ce6fa6..dbaa153100f44de628faaff4e6cee073362d1ae9 100644 (file)
@@ -321,7 +321,7 @@ static __always_inline void syscall_exit_to_user_mode(struct pt_regs *regs)
 {
        instrumentation_begin();
        syscall_exit_to_user_mode_work(regs);
-       local_irq_disable_exit_to_user();
+       local_irq_disable();
        syscall_exit_to_user_mode_prepare(regs);
        instrumentation_end();
        exit_to_user_mode();
index 3cf4d21168ba119bfb1090c5f598cca7a713357d..93b4b551f7ae420536e2f88adcebd50fa0dd7ec9 100644 (file)
@@ -100,37 +100,6 @@ static __always_inline void enter_from_user_mode(struct pt_regs *regs)
        instrumentation_end();
 }
 
-/**
- * local_irq_enable_exit_to_user - Exit to user variant of local_irq_enable()
- * @ti_work:   Cached TIF flags gathered with interrupts disabled
- *
- * Defaults to local_irq_enable(). Can be supplied by architecture specific
- * code.
- */
-static inline void local_irq_enable_exit_to_user(unsigned long ti_work);
-
-#ifndef local_irq_enable_exit_to_user
-static __always_inline void local_irq_enable_exit_to_user(unsigned long ti_work)
-{
-       local_irq_enable();
-}
-#endif
-
-/**
- * local_irq_disable_exit_to_user - Exit to user variant of local_irq_disable()
- *
- * Defaults to local_irq_disable(). Can be supplied by architecture specific
- * code.
- */
-static inline void local_irq_disable_exit_to_user(void);
-
-#ifndef local_irq_disable_exit_to_user
-static __always_inline void local_irq_disable_exit_to_user(void)
-{
-       local_irq_disable();
-}
-#endif
-
 /**
  * arch_exit_to_user_mode_work - Architecture specific TIF work for exit
  *                              to user mode.
index 9ef63e414791311d0c3d1e402bc5e618f08770bd..b5e05d87ba391d32c5f13531bc557d5e000982ef 100644 (file)
@@ -47,7 +47,7 @@ static __always_inline unsigned long __exit_to_user_mode_loop(struct pt_regs *re
         */
        while (ti_work & EXIT_TO_USER_MODE_WORK_LOOP) {
 
-               local_irq_enable_exit_to_user(ti_work);
+               local_irq_enable();
 
                if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) {
                        if (!rseq_grant_slice_extension(ti_work & TIF_SLICE_EXT_DENY))
@@ -74,7 +74,7 @@ static __always_inline unsigned long __exit_to_user_mode_loop(struct pt_regs *re
                 * might have changed while interrupts and preemption was
                 * enabled above.
                 */
-               local_irq_disable_exit_to_user();
+               local_irq_disable();
 
                /* Check if any of the above work has queued a deferred wakeup */
                tick_nohz_user_enter_prepare();