[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [patch V2 38/38] x86/smpboot/64: Implement arch_cpuhp_init_parallel_bringup() and enable it
- To: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>
- From: "Michael Kelley (LINUX)" <mikelley@xxxxxxxxxxxxx>
- Date: Sat, 6 May 2023 00:53:50 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sK/IQvGZxUgMCa0K1Eigw1rYj2UhiPgrotGAq3MSiR4=; b=kHfC5XSovSYGyS/+5jTV0QwQSwNaV9i7AbzrU842xsrZOvuXe4PaMeRdSjeA0tGIhfwLOiGlmhfbcetXSZJgbfsv6/QAjCuebaxkCKLMzSyLTgwmklbBVw+SzcWaqfT9TmBUOpiQaEjikyVMvNQo1Y1WD1+zeuTVjc9v3Kk+VpHErHFtjBNeUSvZFJ74Ffy4JWr/eHFxyIe+W66n7/aVh0NRoI2HEyScVohriKYD9xtcoLS38mNHCVYW+Ckthx3YPLkvTnmAMt19fpoib/1He0tIdm7eeZwKM0VQuTO6sSBPwO/a2QKcafw0ubfLmUc3gTnlrilHtWMoXmSMRiAW8A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LS1MpF61S0SiLXzXzkxI7LfoQ3vW7euzQ8IObApn5AwVo268iqb2hPiVgffH26wRbnOSvoININAgKdMuHZtzm/XhuFSWDLGcRFjtEEmWto3/vQ8r0hupl8d3Kp3Ca/drU8weVeKiFev/5xlgvAYeXP9SuaXKQxx1EzWiKNU/bSA5eqkbzPF78UkbeFqs4vXGuHjgC0kS6cIvJmNIyzlTIDtYTtn/kh9N9dru1Dz1Lm5bNgmHM3wC/yq0A/DLCX20Nvwr2+ChjmPjIF08Xnpx2eoOpKVKbFaxM2OBaQW3sM5U6mACJPohKTBzIrjRnUjIkpSI71ntOmR+WY95rdOAoQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com;
- Cc: "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, David Woodhouse <dwmw2@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Brian Gerst <brgerst@xxxxxxxxx>, Arjan van de Veen <arjan@xxxxxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Paul McKenney <paulmck@xxxxxxxxxx>, Tom Lendacky <thomas.lendacky@xxxxxxx>, Sean Christopherson <seanjc@xxxxxxxxxx>, Oleksandr Natalenko <oleksandr@xxxxxxxxxxxxxx>, Paul Menzel <pmenzel@xxxxxxxxxxxxx>, "Guilherme G. Piccoli" <gpiccoli@xxxxxxxxxx>, Piotr Gorski <lucjan.lucjanov@xxxxxxxxx>, Usama Arif <usama.arif@xxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, "linux-csky@xxxxxxxxxxxxxxx" <linux-csky@xxxxxxxxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, "linux-mips@xxxxxxxxxxxxxxx" <linux-mips@xxxxxxxxxxxxxxx>, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, "linux-parisc@xxxxxxxxxxxxxxx" <linux-parisc@xxxxxxxxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, "linux-riscv@xxxxxxxxxxxxxxxxxxx" <linux-riscv@xxxxxxxxxxxxxxxxxxx>, Mark Rutland <Mark.Rutland@xxxxxxx>, Sabin Rapan <sabrapan@xxxxxxxxxx>
- Delivery-date: Sat, 06 May 2023 00:54:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=48817eed-6fcb-49bc-9a01-6a43bf5b9b82;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2023-05-06T00:42:24Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;
- Thread-index: AQHZfrsPO9aHmT4GeE2OzCti+2hGJa9Macrg
- Thread-topic: [patch V2 38/38] x86/smpboot/64: Implement arch_cpuhp_init_parallel_bringup() and enable it
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);
|