[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<CY5PR10MB5988DFA5112EF7FA3A2DC2538C242@CY5PR10MB5988.namprd10.prod.outlook.com>
Date: Mon, 11 Mar 2024 13:26:24 +0800
From: Dashi Cao <dscao999@...mail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Print also the BSP number when announcing cpu
On Mon, 2024-03-11 at 12:39 +0800, Dashi Cao wrote:
> When announcing CPU, the BSP is always printed as blanks.
> This patch will print out the BSP number. It has the assumption
> that the BSP is not the last CPU in a CPU node.
>
> Dashi Cao
>
I'm sorry, the bsp should also be declared as static int, not int.
Dashi Cao
Signed-off-by: Dashi Cao <dscao999@...il.com>
---
arch/x86/kernel/smpboot.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 3f57ce68a3f1..ef6e7a4bd020 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -931,7 +931,7 @@ static int wakeup_secondary_cpu_via_init(u32
phys_apicid, unsigned long start_ei
/* 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 width, node_width, bsp, bspn = -1;
static int current_node = NUMA_NO_NODE;
int node = early_cpu_to_node(cpu);
@@ -942,7 +942,7 @@ static void announce_cpu(int cpu, int apicid)
node_width = num_digits(num_possible_nodes()) + 1; /* +
'#' */
if (system_state < SYSTEM_RUNNING) {
- if (first)
+ if (bspn == -1)
pr_info("x86: Booting SMP configuration:\n");
if (node != current_node) {
@@ -954,10 +954,12 @@ static void announce_cpu(int cpu, int apicid)
node_width - num_digits(node), " ",
node);
}
- /* Add padding for the BSP */
- if (first)
- pr_cont("%*s", width + 1, " ");
- first = 0;
+ if (bspn == -1) {
+ bsp = raw_smp_processor_id();
+ bspn = cpumask_next(bsp, cpu_present_mask);
+ }
+ if (cpu == bspn)
+ pr_cont("%*s#%d", width - num_digits(bsp), " ",
bsp);
pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu);
} else
--
2.30.2
Powered by blists - more mailing lists