RE: [PATCH v11 09/12] x86/smpboot: Remove initial_stack on 64-bit

From: Michael Kelley (LINUX)
Date: Fri Feb 24 2023 - 13:24:41 EST


From: Usama Arif <usama.arif@xxxxxxxxxxxxx> Sent: Thursday, February 23, 2023 11:12 AM
>
> From: Brian Gerst <brgerst@xxxxxxxxx>
>
> Load RSP from current_task->thread.sp instead.
>
> Signed-off-by: Brian Gerst <brgerst@xxxxxxxxx>
> Reviewed-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Tested-by: Usama Arif <usama.arif@xxxxxxxxxxxxx>
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/processor.h | 6 +++++-
> arch/x86/kernel/acpi/sleep.c | 2 +-
> arch/x86/kernel/head_64.S | 35 ++++++++++++++++++--------------
> arch/x86/xen/xen-head.S | 2 +-
> 4 files changed, 27 insertions(+), 18 deletions(-)
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 4e35c66edeb7..9c4a5c4d46c1 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -648,7 +648,11 @@ static inline void spin_lock_prefetch(const void *x)
> #define KSTK_ESP(task) (task_pt_regs(task)->sp)
>
> #else
> -#define INIT_THREAD { }
> +extern unsigned long __end_init_task[];
> +
> +#define INIT_THREAD { \
> + .sp = (unsigned long)&__end_init_task - PTREGS_SIZE, \
> +}

I'm getting a compile error on the new reference to PTREGS_SIZE:

In file included from ./arch/x86/include/asm/cpufeature.h:5:0,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:9,
from ./include/linux/preempt.h:78,
from ./include/linux/rcupdate.h:27,
from ./include/linux/init_task.h:5,
from init/init_task.c:2:
./arch/x86/include/asm/processor.h:654:42: error: 'PTREGS_SIZE' undeclared here (not in a function); did you mean 'TLS_SIZE'?
.sp = (unsigned long)&__end_init_task - PTREGS_SIZE, \
^
init/init_task.c:115:13: note: in expansion of macro 'INIT_THREAD'
.thread = INIT_THREAD,
^~~~~~~~~~~
scripts/Makefile.build:252: recipe for target 'init/init_task.o' failed

Michael