Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

entry: Remove syscall_enter_from_user_mode_prepare()

Open code the only user in the x86 syscall code and reduce the zoo of
functions.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20251027084306.652839989@linutronix.de

authored by

Thomas Gleixner and committed by
Ingo Molnar
54a5ab56 5204be16

+7 -30
+2 -1
arch/x86/entry/syscall_32.c
··· 274 274 * fetch EBP before invoking any of the syscall entry work 275 275 * functions. 276 276 */ 277 - syscall_enter_from_user_mode_prepare(regs); 277 + enter_from_user_mode(regs); 278 278 279 279 instrumentation_begin(); 280 + local_irq_enable(); 280 281 /* Fetch EBP from where the vDSO stashed it. */ 281 282 if (IS_ENABLED(CONFIG_X86_64)) { 282 283 /*
+5 -21
include/linux/entry-common.h
··· 45 45 SYSCALL_WORK_SYSCALL_EXIT_TRAP | \ 46 46 ARCH_SYSCALL_WORK_EXIT) 47 47 48 - /** 49 - * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts 50 - * @regs: Pointer to currents pt_regs 51 - * 52 - * Invoked from architecture specific syscall entry code with interrupts 53 - * disabled. The calling code has to be non-instrumentable. When the 54 - * function returns all state is correct, interrupts are enabled and the 55 - * subsequent functions can be instrumented. 56 - * 57 - * This handles lockdep, RCU (context tracking) and tracing state, i.e. 58 - * the functionality provided by enter_from_user_mode(). 59 - * 60 - * This is invoked when there is extra architecture specific functionality 61 - * to be done between establishing state and handling user mode entry work. 62 - */ 63 - void syscall_enter_from_user_mode_prepare(struct pt_regs *regs); 64 - 65 48 long syscall_trace_enter(struct pt_regs *regs, long syscall, unsigned long work); 66 49 67 50 /** ··· 54 71 * @syscall: The syscall number 55 72 * 56 73 * Invoked from architecture specific syscall entry code with interrupts 57 - * enabled after invoking syscall_enter_from_user_mode_prepare() and extra 58 - * architecture specific work. 74 + * enabled after invoking enter_from_user_mode(), enabling interrupts and 75 + * extra architecture specific work. 59 76 * 60 77 * Returns: The original or a modified syscall number 61 78 * ··· 91 108 * function returns all state is correct, interrupts are enabled and the 92 109 * subsequent functions can be instrumented. 93 110 * 94 - * This is combination of syscall_enter_from_user_mode_prepare() and 95 - * syscall_enter_from_user_mode_work(). 111 + * This is the combination of enter_from_user_mode() and 112 + * syscall_enter_from_user_mode_work() to be used when there is no 113 + * architecture specific work to be done between the two. 96 114 * 97 115 * Returns: The original or a modified syscall number. See 98 116 * syscall_enter_from_user_mode_work() for further explanation.
-8
kernel/entry/syscall-common.c
··· 63 63 return ret ? : syscall; 64 64 } 65 65 66 - noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs) 67 - { 68 - enter_from_user_mode(regs); 69 - instrumentation_begin(); 70 - local_irq_enable(); 71 - instrumentation_end(); 72 - } 73 - 74 66 /* 75 67 * If SYSCALL_EMU is set, then the only reason to report is when 76 68 * SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall