From nobody Fri Oct 3 23:09:47 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 803932E8DE4 for ; Sat, 23 Aug 2025 16:39:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755967180; cv=none; b=mIm6GJwNzDk/KocQ3Jz7tN297rTT5X2FQ85F7SYBU+BMn1FnNve0L/Hg+BppNuCLqD2WqNRqWId7sRHmssJ8iLXxjiTS38lKrtcY5Ed1EKrd2A7Ac6aqeZ2IP63GMRf6YpR2WqmzOzpDuKe/2TbcGHM1oTKLHpDBgh82ZMxIMYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755967180; c=relaxed/simple; bh=DwYUJV9Z7jBJZ35qXry4rB5S7y91N9AmUhAbDgAUROo=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=HuZuMC2YRfCMZlg+/J8f0gjWYA18i3GtIUx5uPRj/Sx5pM1LruC0IZDOkn4lJJg3cv4uWNDK6HtHOwWljDuu8LuFpEY0POWlnT8IPxgHV1CTT3mnczQ8ekhnqU/G4V+CrhhI7PHFmm5ytDLzCUic1A19DQMxQvpHHVdi0UKLWdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Fj8JzU0/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Zl37Z7a0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Fj8JzU0/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Zl37Z7a0" Message-ID: <20250823161653.973036415@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1755967173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=8Y1AM2Y3D83aMn+Y9L7edRuZB75zoQbrIxlXcOQk5JU=; b=Fj8JzU0/domlVWNOtwO1Z1kyWHOPG3yXJVuUrus7INpcbeMA3AE0NO7IREmx1u4xgEnlnw n/bZdy6buZ5omWSI6LpUrzF4ALZqerEDiDUReefTkUB4SoVvPW/xnxmQ95GRMXBxO4RAx3 Mx/0MPdjrZHvFZC7eH9T36axDy7FkBy2leFNG3ZixHtigzhGR+XcK4D1IR76kUG9O9jEei gam7o7lR/dy7/o22Ns9tTdIkvaYKMQJnmvtMOwW32aRbL017Sfiq0L2rl6idepS+wKkRRh XHYVMJkNoNiVtWJ1jyCHjPe7wqoyybaFq1tirVNClQI3HTBuMm86uBOUCvemhg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1755967173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=8Y1AM2Y3D83aMn+Y9L7edRuZB75zoQbrIxlXcOQk5JU=; b=Zl37Z7a0Gyb5Xsc0+5WdtvMRgj2VZh1wlZTI7SksNpKrqov6q4MUmEAKVl+SVduggno/Pc c/Gx16+0NYqsiNDg== From: Thomas Gleixner To: LKML Cc: Jens Axboe , x86@kernel.org, Mathieu Desnoyers , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Paolo Bonzini , Sean Christopherson , Wei Liu , Dexuan Cui , Arnd Bergmann , Heiko Carstens , Christian Borntraeger , Sven Schnelle , Huacai Chen , Paul Walmsley , Palmer Dabbelt Subject: [patch V2 11/37] entry: Remove syscall_enter_from_user_mode_prepare() References: <20250823161326.635281786@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Sat, 23 Aug 2025 18:39:32 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Open code the only user in the x86 syscall code and reduce the zoo of functions. Signed-off-by: Thomas Gleixner Cc: x86@kernel.org --- arch/x86/entry/syscall_32.c | 3 ++- include/linux/entry-common.h | 26 +++++--------------------- kernel/entry/syscall-common.c | 8 -------- 3 files changed, 7 insertions(+), 30 deletions(-) --- a/arch/x86/entry/syscall_32.c +++ b/arch/x86/entry/syscall_32.c @@ -274,9 +274,10 @@ static noinstr bool __do_fast_syscall_32 * fetch EBP before invoking any of the syscall entry work * functions. */ - syscall_enter_from_user_mode_prepare(regs); + enter_from_user_mode(regs); =20 instrumentation_begin(); + local_irq_enable(); /* Fetch EBP from where the vDSO stashed it. */ if (IS_ENABLED(CONFIG_X86_64)) { /* --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -45,23 +45,6 @@ SYSCALL_WORK_SYSCALL_EXIT_TRAP | \ ARCH_SYSCALL_WORK_EXIT) =20 -/** - * syscall_enter_from_user_mode_prepare - Establish state and enable inter= rupts - * @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); =20 /** @@ -71,8 +54,8 @@ long syscall_trace_enter(struct pt_regs * @syscall: The syscall number * * Invoked from architecture specific syscall entry code with interrupts - * enabled after invoking syscall_enter_from_user_mode_prepare() and extra - * architecture specific work. + * enabled after invoking enter_from_user_mode(), enabling interrupts and + * extra architecture specific work. * * Returns: The original or a modified syscall number * @@ -108,8 +91,9 @@ static __always_inline long syscall_ente * function returns all state is correct, interrupts are enabled and the * subsequent functions can be instrumented. * - * This is combination of syscall_enter_from_user_mode_prepare() and - * syscall_enter_from_user_mode_work(). + * This is the combination of enter_from_user_mode() and + * 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 * syscall_enter_from_user_mode_work() for further explanation. --- a/kernel/entry/syscall-common.c +++ b/kernel/entry/syscall-common.c @@ -63,14 +63,6 @@ long syscall_trace_enter(struct pt_regs return ret ? : syscall; } =20 -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 * SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall