RE: [patch V2 38/38] x86/smpboot/64: Implement arch_cpuhp_init_parallel_bringup() and enable it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Sent: Thursday, May 4, 2023 12:03 PM
> 
> Implement the validation function which tells the core code whether
> parallel bringup is possible.
> 
> The only condition for now is that the kernel does not run in an encrypted
> guest as these will trap the RDMSR via #VC, which cannot be handled at that
> point in early startup.
> 
> There was an earlier variant for AMD-SEV which used the GHBC protocol for
> retrieving the APIC ID via CPUID, but there is no guarantee that the
> initial APIC ID in CPUID is the same as the real APIC ID. There is no
> enforcement from the secure firmware and the hypervisor can assign APIC IDs
> as it sees fit as long as the ACPI/MADT table is consistent with that
> assignment.
> 
> Unfortunately there is no RDMSR GHCB protocol at the moment, so enabling
> AMD-SEV guests for parallel startup needs some more thought.
> 
> Intel-TDX provides a secure RDMSR hypercall, but supporting that is outside
> the scope of this change.
> 
> Fixup announce_cpu() as e.g. on Hyper-V CPU1 is the secondary sibling of
> CPU0, which makes the @cpu == 1 logic in announce_cpu() fall apart.
> 
> [ mikelley: Reported the announce_cpu() fallout
> 
> Originally-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> V2: Fixup announce_cpu() - Michael Kelley
> ---
>  arch/x86/Kconfig             |    3 +
>  arch/x86/kernel/cpu/common.c |    6 ---
>  arch/x86/kernel/smpboot.c    |   83 ++++++++++++++++++++++++++++++++++++----
> ---

[snip]

> @@ -934,10 +961,10 @@ static void announce_cpu(int cpu, int ap
>  	if (!node_width)
>  		node_width = num_digits(num_possible_nodes()) + 1; /* + '#' */
> 
> -	if (cpu == 1)
> -		printk(KERN_INFO "x86: Booting SMP configuration:\n");
> -
>  	if (system_state < SYSTEM_RUNNING) {
> +		if (num_online_cpus() == 1)

Unfortunately, this new check doesn't work.  Here's the output I get:

[    0.721384] smp: Bringing up secondary CPUs ...
[    0.725359] smpboot: x86: Booting SMP configuration:
[    0.729249] .... node  #0, CPUs:        #2
[    0.729654] smpboot: x86: Booting SMP configuration:
[    0.737247]       #4
[    0.737511] smpboot: x86: Booting SMP configuration:
[    0.741246]       #6
[    0.741508] smpboot: x86: Booting SMP configuration:
[    0.745248]       #8
[    0.745507] smpboot: x86: Booting SMP configuration:
[    0.749250]      #10
[    0.749514] smpboot: x86: Booting SMP configuration:
[    0.753248]      #12
[    0.753492] smpboot: x86: Booting SMP configuration:
[    0.757249]      #14  #1  #3  #5  #7  #9 #11 #13 #15
[    0.769317] smp: Brought up 1 node, 16 CPUs
[    0.773246] smpboot: Max logical packages: 1
[    0.777257] smpboot: Total of 16 processors activated (78253.79 BogoMIPS)

Evidently num_online_cpus() isn't updated until after all the primary
siblings get started.

When booting with cpuhp.parallel=0, the output is good.

Michael

> +			pr_info("x86: Booting SMP configuration:\n");
> +
>  		if (node != current_node) {
>  			if (current_node > (-1))
>  				pr_cont("\n");
> @@ -948,7 +975,7 @@ static void announce_cpu(int cpu, int ap
>  		}
> 
>  		/* Add padding for the BSP */
> -		if (cpu == 1)
> +		if (num_online_cpus() == 1)
>  			pr_cont("%*s", width + 1, " ");
> 
>  		pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu);




[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux