Skip to content

Commit 014d595

Browse files
committed
Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot changes from Ingo Molnar: "Two changes that prettify and compactify the SMP bootup output from: smpboot: Booting Node 0, Processors #1 #2 #3 OK smpboot: Booting Node 1, Processors #4 #5 #6 #7 OK smpboot: Booting Node 2, Processors #8 #9 #10 #11 OK smpboot: Booting Node 3, Processors #12 #13 #14 #15 OK Brought up 16 CPUs to something like: x86: Booting SMP configuration: .... node #0, CPUs: #1 #2 #3 .... node #1, CPUs: #4 #5 #6 #7 .... node #2, CPUs: #8 #9 #10 #11 .... node #3, CPUs: #12 #13 #14 #15 x86: Booted up 4 nodes, 16 CPUs" * 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot: Further compress CPUs bootup message x86: Improve the printout of the SMP bootup CPU table
2 parents ae795fe + a17bce4 commit 014d595

File tree

5 files changed

+64
-9
lines changed

5 files changed

+64
-9
lines changed

arch/x86/include/asm/misc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _ASM_X86_MISC_H
2+
#define _ASM_X86_MISC_H
3+
4+
int num_digits(int val);
5+
6+
#endif /* _ASM_X86_MISC_H */

arch/x86/kernel/smpboot.c

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@
7373
#include <asm/setup.h>
7474
#include <asm/uv/uv.h>
7575
#include <linux/mc146818rtc.h>
76-
7776
#include <asm/smpboot_hooks.h>
7877
#include <asm/i8259.h>
79-
8078
#include <asm/realmode.h>
79+
#include <asm/misc.h>
8180

8281
/* State of each CPU */
8382
DEFINE_PER_CPU(int, cpu_state) = { 0 };
@@ -648,22 +647,46 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
648647
return (send_status | accept_status);
649648
}
650649

650+
void smp_announce(void)
651+
{
652+
int num_nodes = num_online_nodes();
653+
654+
printk(KERN_INFO "x86: Booted up %d node%s, %d CPUs\n",
655+
num_nodes, (num_nodes > 1 ? "s" : ""), num_online_cpus());
656+
}
657+
651658
/* reduce the number of lines printed when booting a large cpu count system */
652659
static void announce_cpu(int cpu, int apicid)
653660
{
654661
static int current_node = -1;
655662
int node = early_cpu_to_node(cpu);
656-
int max_cpu_present = find_last_bit(cpumask_bits(cpu_present_mask), NR_CPUS);
663+
static int width, node_width;
664+
665+
if (!width)
666+
width = num_digits(num_possible_cpus()) + 1; /* + '#' sign */
667+
668+
if (!node_width)
669+
node_width = num_digits(num_possible_nodes()) + 1; /* + '#' */
670+
671+
if (cpu == 1)
672+
printk(KERN_INFO "x86: Booting SMP configuration:\n");
657673

658674
if (system_state == SYSTEM_BOOTING) {
659675
if (node != current_node) {
660676
if (current_node > (-1))
661-
pr_cont(" OK\n");
677+
pr_cont("\n");
662678
current_node = node;
663-
pr_info("Booting Node %3d, Processors ", node);
679+
680+
printk(KERN_INFO ".... node %*s#%d, CPUs: ",
681+
node_width - num_digits(node), " ", node);
664682
}
665-
pr_cont(" #%4d%s", cpu, cpu == max_cpu_present ? " OK\n" : "");
666-
return;
683+
684+
/* Add padding for the BSP */
685+
if (cpu == 1)
686+
pr_cont("%*s", width + 1, " ");
687+
688+
pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu);
689+
667690
} else
668691
pr_info("Booting Node %d Processor %d APIC 0x%x\n",
669692
node, cpu, apicid);

arch/x86/lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ clean-files := inat-tables.c
1616

1717
obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
1818

19-
lib-y := delay.o
19+
lib-y := delay.o misc.o
2020
lib-y += thunk_$(BITS).o
2121
lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o
2222
lib-y += memcpy_$(BITS).o

arch/x86/lib/misc.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Count the digits of @val including a possible sign.
3+
*
4+
* (Typed on and submitted from hpa's mobile phone.)
5+
*/
6+
int num_digits(int val)
7+
{
8+
int m = 10;
9+
int d = 1;
10+
11+
if (val < 0) {
12+
d++;
13+
val = -val;
14+
}
15+
16+
while (val >= m) {
17+
m *= 10;
18+
d++;
19+
}
20+
return d;
21+
}

kernel/smp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@ void __init setup_nr_cpu_ids(void)
524524
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
525525
}
526526

527+
void __weak smp_announce(void)
528+
{
529+
printk(KERN_INFO "Brought up %d CPUs\n", num_online_cpus());
530+
}
531+
527532
/* Called by boot processor to activate the rest. */
528533
void __init smp_init(void)
529534
{
@@ -540,7 +545,7 @@ void __init smp_init(void)
540545
}
541546

542547
/* Any cleanup work */
543-
printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
548+
smp_announce();
544549
smp_cpus_done(setup_max_cpus);
545550
}
546551

0 commit comments

Comments
 (0)