[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BYAPR21MB1688A75D614165C5E4E0302AD7709@BYAPR21MB1688.namprd21.prod.outlook.com>
Date: Sun, 7 May 2023 04:14:08 +0000
From: "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
To: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>
CC: "x86@...nel.org" <x86@...nel.org>,
David Woodhouse <dwmw2@...radead.org>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Brian Gerst <brgerst@...il.com>,
Arjan van de Veen <arjan@...ux.intel.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Paul McKenney <paulmck@...nel.org>,
Tom Lendacky <thomas.lendacky@....com>,
Sean Christopherson <seanjc@...gle.com>,
Oleksandr Natalenko <oleksandr@...alenko.name>,
Paul Menzel <pmenzel@...gen.mpg.de>,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>,
Piotr Gorski <lucjan.lucjanov@...il.com>,
Usama Arif <usama.arif@...edance.com>,
Juergen Gross <jgross@...e.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
"xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
Russell King <linux@...linux.org.uk>,
Arnd Bergmann <arnd@...db.de>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Guo Ren <guoren@...nel.org>,
"linux-csky@...r.kernel.org" <linux-csky@...r.kernel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
"linux-mips@...r.kernel.org" <linux-mips@...r.kernel.org>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
Helge Deller <deller@....de>,
"linux-parisc@...r.kernel.org" <linux-parisc@...r.kernel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
Mark Rutland <Mark.Rutland@....com>,
Sabin Rapan <sabrapan@...zon.com>
Subject: RE: [patch V2 38/38] x86/smpboot/64: Implement
arch_cpuhp_init_parallel_bringup() and enable it
From: Thomas Gleixner <tglx@...utronix.de> Sent: Saturday, May 6, 2023 9:23 AM
>
> On Sat, May 06 2023 at 00:53, Michael Kelley wrote:
> > From: Thomas Gleixner <tglx@...utronix.de> Sent: Thursday, May 4, 2023 12:03 PM
> > [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
> >
> > Evidently num_online_cpus() isn't updated until after all the primary
> > siblings get started.
>
> Duh. Where is that brown paperbag?
>
> > When booting with cpuhp.parallel=0, the output is good.
>
> Exactly that was on the command line when I quickly booted that change :(
>
> The below should fix it for real.
>
> Thanks,
>
> tglx
> ---
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -951,9 +951,9 @@ static int wakeup_secondary_cpu_via_init
> /* reduce the number of lines printed when booting a large cpu count system */
> static void announce_cpu(int cpu, int apicid)
> {
> + static int width, node_width, first = 1;
> static int current_node = NUMA_NO_NODE;
> int node = early_cpu_to_node(cpu);
> - static int width, node_width;
>
> if (!width)
> width = num_digits(num_possible_cpus()) + 1; /* + '#' sign */
> @@ -962,7 +962,7 @@ static void announce_cpu(int cpu, int ap
> node_width = num_digits(num_possible_nodes()) + 1; /* + '#' */
>
> if (system_state < SYSTEM_RUNNING) {
> - if (num_online_cpus() == 1)
> + if (first)
> pr_info("x86: Booting SMP configuration:\n");
>
> if (node != current_node) {
> @@ -975,11 +975,11 @@ static void announce_cpu(int cpu, int ap
> }
>
> /* Add padding for the BSP */
> - if (num_online_cpus() == 1)
> + if (first)
> pr_cont("%*s", width + 1, " ");
> + first = 0;
>
> pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu);
> -
> } else
> pr_info("Booting Node %d Processor %d APIC 0x%x\n",
> node, cpu, apicid);
This works. dmesg output is clean for these guest VM combinations
on Hyper-V that I tested:
* Normal VM: 16 vCPUs in 1 NUMA node and 32 vCPUs in 2 NUMA nodes
* Same configs for a SEV-SNP Confidential VM with paravisor
Tested with and without cpuhp.parallel=0
For the entire series:
Tested-by: Michael Kelley <mikelley@...rosoft.com>
Powered by blists - more mailing lists