Re: [PATCH 3/6] x86/smpboot: Remove initial_stack on 64-bit

From: David Woodhouse
Date: Thu Feb 23 2023 - 03:06:37 EST


On Wed, 2023-02-22 at 17:12 -0500, Brian Gerst wrote:
> @@ -245,11 +245,11 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
>  #ifdef CONFIG_SMP
>         /*
>          * Is this the boot CPU coming up? If so everything is available
> -        * in initial_gs, initial_stack and early_gdt_descr.
> +        * in initial_gs and early_gdt_descr.
>          */
>         movl    smpboot_control(%rip), %edx
>         testl   $STARTUP_SECONDARY, %edx
> -       jz      .Lsetup_cpu
> +       jz      .Linit_cpu0_data
>  
>         /*
>          * For parallel boot, the APIC ID is retrieved from CPUID, and then
> @@ -302,6 +302,10 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
>         hlt
>         jmp     1b
>  
> +.Linit_cpu0_data:
> +       movq    __per_cpu_offset(%rip), %rdx
> +       jmp     .Lsetup_cpu
> +

Aren't all CPUs taking this .Linit_cpu0_data path for non-parallel
startup, not just cpu0? I think you want something more like

.Linit_cpuN_data:
orl $0x0fffffff, %edx
leaq __per_cpu_offset(%rip), %rbx
movq (%rbx,%rdx,8), %rdx
jmp .Lsetup_cpu

Attachment: smime.p7s
Description: S/MIME cryptographic signature