From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABB92C7EE24 for ; Sat, 6 May 2023 16:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbjEFQWn (ORCPT ); Sat, 6 May 2023 12:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjEFQWm (ORCPT ); Sat, 6 May 2023 12:22:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D00F4680; Sat, 6 May 2023 09:22:41 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683390158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NXHfBgcGHt/ZfPwa+T595dnepfFJKJnpLjR3JhBl6Q0=; b=1czMZh1cRjeqiQ2TZA6GbMVHHXEF93eQIVvQioB8FE/pRwMNCJ9iNbT002o3Vf8Q1PmjjT pMzD7AC5NROe0zWPr/xkstx8tP21FQigIYhXnCedHf48++FNK52empvCyZE4IMSf7ryah7 wwDm68n14K3LZeFvyQ99Fwubq6JJjmTxOyIllycil0ZJfXjm8tULzw2/ivE/eeRZ3vZ2Ce eFzoWJEYtyiUQ3YTBmQpXzsA8QFgMuJS8CeTY8f2OfEh+NvACDq69zDAubztHsM41nl1p1 k+Q1vY7kiaQqTaWRFrb4KJC+127qTmzlxib6lozIfkeM3gQq7L3F5SIRCIw/xg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683390158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NXHfBgcGHt/ZfPwa+T595dnepfFJKJnpLjR3JhBl6Q0=; b=qtQ0xS4FhuHdv2/qWAJNtp26GqvWQxksH6Mo/Q1MgLXE9WE0n6Pih7C913p3eWGR7QXk2c rCYD41DUjLVIXsBw== To: "Michael Kelley (LINUX)" , LKML Cc: "x86@kernel.org" , David Woodhouse , Andrew Cooper , Brian Gerst , Arjan van de Veen , Paolo Bonzini , Paul McKenney , Tom Lendacky , Sean Christopherson , Oleksandr Natalenko , Paul Menzel , "Guilherme G. Piccoli" , Piotr Gorski , Usama Arif , Juergen Gross , Boris Ostrovsky , "xen-devel@lists.xenproject.org" , Russell King , Arnd Bergmann , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , Will Deacon , Guo Ren , "linux-csky@vger.kernel.org" , Thomas Bogendoerfer , "linux-mips@vger.kernel.org" , "James E.J. Bottomley" , Helge Deller , "linux-parisc@vger.kernel.org" , Paul Walmsley , Palmer Dabbelt , "linux-riscv@lists.infradead.org" , Mark Rutland , Sabin Rapan Subject: RE: [patch V2 38/38] x86/smpboot/64: Implement arch_cpuhp_init_parallel_bringup() and enable it In-Reply-To: References: <20230504185733.126511787@linutronix.de> <20230504185938.393373946@linutronix.de> Date: Sat, 06 May 2023 18:22:37 +0200 Message-ID: <87sfc92zw2.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-csky@vger.kernel.org On Sat, May 06 2023 at 00:53, Michael Kelley wrote: > From: Thomas Gleixner 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);