x86: Improve the printout of the SMP bootup CPU table
[firefly-linux-kernel-4.4.55.git] / arch / x86 / kernel / smpboot.c
index 6cacab671f9b76a35aaf49d41431b12e788e5bbe..d41f3ba26ced27d7f1fa8c67c73fb9bcb50b0bc2 100644 (file)
 #include <asm/setup.h>
 #include <asm/uv/uv.h>
 #include <linux/mc146818rtc.h>
-
 #include <asm/smpboot_hooks.h>
 #include <asm/i8259.h>
-
 #include <asm/realmode.h>
+#include <asm/misc.h>
 
 /* State of each CPU */
 DEFINE_PER_CPU(int, cpu_state) = { 0 };
@@ -653,17 +652,27 @@ static void announce_cpu(int cpu, int apicid)
 {
        static int current_node = -1;
        int node = early_cpu_to_node(cpu);
-       int max_cpu_present = find_last_bit(cpumask_bits(cpu_present_mask), NR_CPUS);
+       static int width;
+
+       if (!width)
+               width = num_digits(num_possible_cpus()) + 1; /* + '#' sign */
 
        if (system_state == SYSTEM_BOOTING) {
                if (node != current_node) {
                        if (current_node > (-1))
                                pr_cont(" OK\n");
                        current_node = node;
-                       pr_info("Booting Node %3d, Processors ", node);
+                       pr_info("Booting Node %3d, Processors:", node);
                }
-               pr_cont(" #%4d%s", cpu, cpu == max_cpu_present ? " OK\n" : "");
-               return;
+
+               /* Add padding for the BSP */
+               if (cpu == 1)
+                       pr_cont("%*s", width + 1, " ");
+
+               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);