From 501bcb5953cc4d56537a321c00f9193e9fd68718 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sun, 18 Oct 2026 10:22:02 -0400 Subject: [PATCH] alpha: stop storing the user stack pointer in pt_regs Nothing reads pt_regs->usp now that user_stack_pointer() uses the PCB. Drop the stores, which saves a PAL_rdusp call on every syscall, and give the field back its old name. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Magnus Lindholm Tested-by: Magnus Lindholm Acked-by: Ian Rogers Signed-off-by: Matt Turner Link: https://lore.kernel.org/r/20261018-alpha-perf-regs-v3-v3-2-52be85332c57@gmail.com Signed-off-by: Magnus Lindholm --- arch/alpha/include/uapi/asm/ptrace.h | 2 +- arch/alpha/kernel/asm-offsets.c | 1 - arch/alpha/kernel/entry.S | 5 ----- arch/alpha/kernel/traps.c | 8 -------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/arch/alpha/include/uapi/asm/ptrace.h b/arch/alpha/include/uapi/asm/ptrace.h index 9d86b2a1526e..72ed913a910f 100644 --- a/arch/alpha/include/uapi/asm/ptrace.h +++ b/arch/alpha/include/uapi/asm/ptrace.h @@ -43,7 +43,7 @@ struct pt_regs { unsigned long trap_a1; unsigned long trap_a2; /* This makes the stack 16-byte aligned as GCC expects */ - unsigned long usp; + unsigned long __pad0; /* These are saved by PAL-code: */ unsigned long ps; unsigned long pc; diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c index c89792c86044..22ed3c975b1c 100644 --- a/arch/alpha/kernel/asm-offsets.c +++ b/arch/alpha/kernel/asm-offsets.c @@ -30,7 +30,6 @@ static void __used foo(void) DEFINE(HAE_CACHE, offsetof(struct alpha_machine_vector, hae_cache)); DEFINE(HAE_REG, offsetof(struct alpha_machine_vector, hae_register)); - DEFINE(PT_REGS_USP, offsetof(struct pt_regs, usp)); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); DEFINE(TI_SYSCALL_WORK, offsetof(struct thread_info, syscall_work)); diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index bfa116d455fb..790389a15c3c 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S @@ -476,11 +476,6 @@ entSys: ldq $1, 0($sp) /* syscall nr from saved r0 */ stq $1, 8($sp) /* regs->r1 = shadow syscall nr */ - mov $0, $8 - call_pal PAL_rdusp - stq $0, PT_REGS_USP($sp) - mov $8, $0 - lda $8, 0x3fff bic $sp, $8, $8 diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index cfaef96c4ce8..5882c65b7ef1 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -30,12 +30,6 @@ #include "proto.h" -static __always_inline void alpha_snapshot_usp(struct pt_regs *regs) -{ - if (user_mode(regs)) - regs->usp = rdusp(); -} - void dik_show_regs(struct pt_regs *regs, unsigned long *r9_15) { @@ -186,7 +180,6 @@ do_entArith(unsigned long summary, unsigned long write_mask, { long si_code = FPE_FLTINV; - alpha_snapshot_usp(regs); if (summary & 1) { /* Software-completion summary bit is set, so try to emulate the instruction. If the processor supports @@ -208,7 +201,6 @@ do_entIF(unsigned long type, struct pt_regs *regs) { int signo, code; - alpha_snapshot_usp(regs); if (type == 3) { /* FEN fault */ /* Irritating users can call PAL_clrfen to disable the FPU for the process. The kernel will then trap in