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
This commit is contained in:
Thomas Gleixner 2025-10-27 09:44:38 +01:00 committed by Ingo Molnar
parent 5204be1679
commit 54a5ab5624
3 changed files with 7 additions and 30 deletions

View File

@ -274,9 +274,10 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
* fetch EBP before invoking any of the syscall entry work * fetch EBP before invoking any of the syscall entry work
* functions. * functions.
*/ */
syscall_enter_from_user_mode_prepare(regs); enter_from_user_mode(regs);
instrumentation_begin(); instrumentation_begin();
local_irq_enable();
/* Fetch EBP from where the vDSO stashed it. */ /* Fetch EBP from where the vDSO stashed it. */
if (IS_ENABLED(CONFIG_X86_64)) { if (IS_ENABLED(CONFIG_X86_64)) {
/* /*

View File

@ -45,23 +45,6 @@
SYSCALL_WORK_SYSCALL_EXIT_TRAP | \ SYSCALL_WORK_SYSCALL_EXIT_TRAP | \
ARCH_SYSCALL_WORK_EXIT) ARCH_SYSCALL_WORK_EXIT)
/**
* syscall_enter_from_user_mode_prepare - Establish state and enable interrupts
* @regs: Pointer to currents pt_regs
*
* Invoked from architecture specific syscall entry code with interrupts
* disabled. The calling code has to be non-instrumentable. When the
* function returns all state is correct, interrupts are enabled and the
* subsequent functions can be instrumented.
*
* This handles lockdep, RCU (context tracking) and tracing state, i.e.
* the functionality provided by enter_from_user_mode().
*
* This is invoked when there is extra architecture specific functionality
* to be done between establishing state and handling user mode entry work.
*/
void syscall_enter_from_user_mode_prepare(struct pt_regs *regs);
long syscall_trace_enter(struct pt_regs *regs, long syscall, unsigned long work); long syscall_trace_enter(struct pt_regs *regs, long syscall, unsigned long work);
/** /**
@ -71,8 +54,8 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall, unsigned long work)
* @syscall: The syscall number * @syscall: The syscall number
* *
* Invoked from architecture specific syscall entry code with interrupts * Invoked from architecture specific syscall entry code with interrupts
* enabled after invoking syscall_enter_from_user_mode_prepare() and extra * enabled after invoking enter_from_user_mode(), enabling interrupts and
* architecture specific work. * extra architecture specific work.
* *
* Returns: The original or a modified syscall number * Returns: The original or a modified syscall number
* *
@ -108,8 +91,9 @@ static __always_inline long syscall_enter_from_user_mode_work(struct pt_regs *re
* function returns all state is correct, interrupts are enabled and the * function returns all state is correct, interrupts are enabled and the
* subsequent functions can be instrumented. * subsequent functions can be instrumented.
* *
* This is combination of syscall_enter_from_user_mode_prepare() and * This is the combination of enter_from_user_mode() and
* syscall_enter_from_user_mode_work(). * syscall_enter_from_user_mode_work() to be used when there is no
* architecture specific work to be done between the two.
* *
* Returns: The original or a modified syscall number. See * Returns: The original or a modified syscall number. See
* syscall_enter_from_user_mode_work() for further explanation. * syscall_enter_from_user_mode_work() for further explanation.

View File

@ -63,14 +63,6 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall,
return ret ? : syscall; return ret ? : syscall;
} }
noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs)
{
enter_from_user_mode(regs);
instrumentation_begin();
local_irq_enable();
instrumentation_end();
}
/* /*
* If SYSCALL_EMU is set, then the only reason to report is when * If SYSCALL_EMU is set, then the only reason to report is when
* SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall * SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall