Skip to content

Commit 22f66e7

Browse files
mrutland-armThomas Gleixner
authored andcommitted
entry: Remove local_irq_{enable,disable}_exit_to_user()
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: 97d935f ("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
1 parent 1f0d117 commit 22f66e7

3 files changed

Lines changed: 3 additions & 34 deletions

File tree

include/linux/entry-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static __always_inline void syscall_exit_to_user_mode(struct pt_regs *regs)
321321
{
322322
instrumentation_begin();
323323
syscall_exit_to_user_mode_work(regs);
324-
local_irq_disable_exit_to_user();
324+
local_irq_disable();
325325
syscall_exit_to_user_mode_prepare(regs);
326326
instrumentation_end();
327327
exit_to_user_mode();

include/linux/irq-entry-common.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -100,37 +100,6 @@ static __always_inline void enter_from_user_mode(struct pt_regs *regs)
100100
instrumentation_end();
101101
}
102102

103-
/**
104-
* local_irq_enable_exit_to_user - Exit to user variant of local_irq_enable()
105-
* @ti_work: Cached TIF flags gathered with interrupts disabled
106-
*
107-
* Defaults to local_irq_enable(). Can be supplied by architecture specific
108-
* code.
109-
*/
110-
static inline void local_irq_enable_exit_to_user(unsigned long ti_work);
111-
112-
#ifndef local_irq_enable_exit_to_user
113-
static __always_inline void local_irq_enable_exit_to_user(unsigned long ti_work)
114-
{
115-
local_irq_enable();
116-
}
117-
#endif
118-
119-
/**
120-
* local_irq_disable_exit_to_user - Exit to user variant of local_irq_disable()
121-
*
122-
* Defaults to local_irq_disable(). Can be supplied by architecture specific
123-
* code.
124-
*/
125-
static inline void local_irq_disable_exit_to_user(void);
126-
127-
#ifndef local_irq_disable_exit_to_user
128-
static __always_inline void local_irq_disable_exit_to_user(void)
129-
{
130-
local_irq_disable();
131-
}
132-
#endif
133-
134103
/**
135104
* arch_exit_to_user_mode_work - Architecture specific TIF work for exit
136105
* to user mode.

kernel/entry/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static __always_inline unsigned long __exit_to_user_mode_loop(struct pt_regs *re
4747
*/
4848
while (ti_work & EXIT_TO_USER_MODE_WORK_LOOP) {
4949

50-
local_irq_enable_exit_to_user(ti_work);
50+
local_irq_enable();
5151

5252
if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) {
5353
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
7474
* might have changed while interrupts and preemption was
7575
* enabled above.
7676
*/
77-
local_irq_disable_exit_to_user();
77+
local_irq_disable();
7878

7979
/* Check if any of the above work has queued a deferred wakeup */
8080
tick_nohz_user_enter_prepare();

0 commit comments

Comments
 (0)