diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index d41f3ba26ced27..2a165580fa1620 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -647,22 +647,38 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) return (send_status | accept_status); } +void smp_announce(void) +{ + int num_nodes = num_online_nodes(); + + printk(KERN_INFO "x86: Booted up %d node%s, %d CPUs\n", + num_nodes, (num_nodes > 1 ? "s" : ""), num_online_cpus()); +} + /* reduce the number of lines printed when booting a large cpu count system */ static void announce_cpu(int cpu, int apicid) { static int current_node = -1; int node = early_cpu_to_node(cpu); - static int width; + static int width, node_width; if (!width) width = num_digits(num_possible_cpus()) + 1; /* + '#' sign */ + 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_BOOTING) { if (node != current_node) { if (current_node > (-1)) - pr_cont(" OK\n"); + pr_cont("\n"); current_node = node; - pr_info("Booting Node %3d, Processors:", node); + + printk(KERN_INFO ".... node %*s#%d, CPUs: ", + node_width - num_digits(node), " ", node); } /* Add padding for the BSP */ @@ -671,8 +687,6 @@ static void announce_cpu(int cpu, int apicid) pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu); - if (cpu == num_present_cpus() - 1) - pr_cont(" OK\n"); } else pr_info("Booting Node %d Processor %d APIC 0x%x\n", node, cpu, apicid); diff --git a/arch/x86/lib/misc.c b/arch/x86/lib/misc.c index bc35cde9769f18..76b373af03f091 100644 --- a/arch/x86/lib/misc.c +++ b/arch/x86/lib/misc.c @@ -1,11 +1,21 @@ +/* + * Count the digits of @val including a possible sign. + * + * (Typed on and submitted from hpa's mobile phone.) + */ int num_digits(int val) { - int digits = 0; + int m = 10; + int d = 1; - while (val) { - val /= 10; - digits++; + if (val < 0) { + d++; + val = -val; } - return digits; + while (val >= m) { + m *= 10; + d++; + } + return d; } diff --git a/kernel/smp.c b/kernel/smp.c index 0564571dcdf726..f5768b0c816a6b 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -524,6 +524,11 @@ void __init setup_nr_cpu_ids(void) nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1; } +void __weak smp_announce(void) +{ + printk(KERN_INFO "Brought up %d CPUs\n", num_online_cpus()); +} + /* Called by boot processor to activate the rest. */ void __init smp_init(void) { @@ -540,7 +545,7 @@ void __init smp_init(void) } /* Any cleanup work */ - printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus()); + smp_announce(); smp_cpus_done(setup_max_cpus); }