Re: [PATCH 3/4] alpha: use user_stack_pointer() in KSTK_ESP() and dump_elf_thread()
From: Magnus Lindholm
Date: Mon Oct 12 2026 - 14:42:37 EST
Hi Matt,
On Sun, Oct 11, 2026 at 10:16 PM Matt Turner <mattst88@xxxxxxxxx> wrote:
>
> Both open-code the same PCB lookup.
>
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Matt Turner <mattst88@xxxxxxxxx>
> ---
> arch/alpha/include/asm/processor.h | 3 +--
> arch/alpha/kernel/process.c | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h
> index c461a26d47b3..73251cd671e0 100644
> --- a/arch/alpha/include/asm/processor.h
> +++ b/arch/alpha/include/asm/processor.h
> @@ -43,8 +43,7 @@ unsigned long __get_wchan(struct task_struct *p);
>
> #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
>
> -#define KSTK_ESP(tsk) \
> - ((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp)
> +#define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
>
> #define cpu_relax() barrier()
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index 06522451f018..7861c9e767b7 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -318,7 +318,7 @@ dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt, struct thread_info *ti)
> dest[27] = pt->r27;
> dest[28] = pt->r28;
> dest[29] = pt->gp;
> - dest[30] = ti == current_thread_info() ? rdusp() : ti->pcb.usp;
> + dest[30] = user_stack_pointer(pt);
> dest[31] = pt->pc;
>
> /* Once upon a time this was the PS value. Which is stupid
>
> --
> 2.55.0
>
Looks good to me.
Tested-by: Magnus Lindholm <linmag7@xxxxxxxxx>
Reviewed-by: Magnus Lindholm <linmag7@xxxxxxxxx>