Skip to content

Commit 5223948

Browse files
libin2015Ingo Molnar
authored and
Ingo Molnar
committed
x86/smpboot: Fix announce_cpu() to printk() the last "OK" properly
When booting secondary CPUs, announce_cpu() is called to show which cpu has been brought up. For example: [ 0.402751] smpboot: Booting Node 0, Processors #1 #2 #3 #4 #5 OK [ 0.525667] smpboot: Booting Node 1, Processors torvalds#6 torvalds#7 torvalds#8 torvalds#9 torvalds#10 torvalds#11 OK [ 0.755592] smpboot: Booting Node 0, Processors torvalds#12 torvalds#13 torvalds#14 torvalds#15 torvalds#16 torvalds#17 OK [ 0.890495] smpboot: Booting Node 1, Processors torvalds#18 torvalds#19 torvalds#20 torvalds#21 torvalds#22 torvalds#23 But the last "OK" is lost, because 'nr_cpu_ids-1' represents the maximum possible cpu id. It should use the maximum present cpu id in case not all CPUs booted up. Signed-off-by: Libin <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [ tweaked the changelog, removed unnecessary line break, tweaked the format to align the fields vertically. ] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4488e09 commit 5223948

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/smpboot.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ static void announce_cpu(int cpu, int apicid)
653653
{
654654
static int current_node = -1;
655655
int node = early_cpu_to_node(cpu);
656+
int max_cpu_present = find_last_bit(cpumask_bits(cpu_present_mask), NR_CPUS);
656657

657658
if (system_state == SYSTEM_BOOTING) {
658659
if (node != current_node) {
@@ -661,7 +662,7 @@ static void announce_cpu(int cpu, int apicid)
661662
current_node = node;
662663
pr_info("Booting Node %3d, Processors ", node);
663664
}
664-
pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " OK\n" : "");
665+
pr_cont(" #%4d%s", cpu, cpu == max_cpu_present ? " OK\n" : "");
665666
return;
666667
} else
667668
pr_info("Booting Node %d Processor %d APIC 0x%x\n",

0 commit comments

Comments
 (0)