diff options
author | Borislav Petkov <bp@suse.de> | 2013-09-27 10:35:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-09-28 04:10:26 -0400 |
commit | 646e29a1789a3a936871008c15199c50367bf291 (patch) | |
tree | 3cbb4e251fd3f065f551ccd1ada27584f2f00d17 | |
parent | 6cac446bd37d9381815fe4c2b0e7b1fd1085000c (diff) |
x86: Improve the printout of the SMP bootup CPU table
As the new x86 CPU bootup printout format code maintainer, I am
taking immediate action to improve and clean (and thus indulge
my OCD) the reporting of the cores when coming up online.
Fix padding to a right-hand alignment, cleanup code and bind
reporting width to the max number of supported CPUs on the
system, like this:
[ 0.074509] smpboot: Booting Node 0, Processors: #1 #2 #3 #4 #5 #6 #7 OK
[ 0.644008] smpboot: Booting Node 1, Processors: #8 #9 #10 #11 #12 #13 #14 #15 OK
[ 1.245006] smpboot: Booting Node 2, Processors: #16 #17 #18 #19 #20 #21 #22 #23 OK
[ 1.864005] smpboot: Booting Node 3, Processors: #24 #25 #26 #27 #28 #29 #30 #31 OK
[ 2.489005] smpboot: Booting Node 4, Processors: #32 #33 #34 #35 #36 #37 #38 #39 OK
[ 3.093005] smpboot: Booting Node 5, Processors: #40 #41 #42 #43 #44 #45 #46 #47 OK
[ 3.698005] smpboot: Booting Node 6, Processors: #48 #49 #50 #51 #52 #53 #54 #55 OK
[ 4.304005] smpboot: Booting Node 7, Processors: #56 #57 #58 #59 #60 #61 #62 #63 OK
[ 4.961413] Brought up 64 CPUs
and this:
[ 0.072367] smpboot: Booting Node 0, Processors: #1 #2 #3 #4 #5 #6 #7 OK
[ 0.686329] Brought up 8 CPUs
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Libin <huawei.libin@huawei.com>
Cc: wangyijing@huawei.com
Cc: fenghua.yu@intel.com
Cc: guohanjun@huawei.com
Cc: paul.gortmaker@windriver.com
Link: http://lkml.kernel.org/r/20130927143554.GF4422@pd.tnic
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/misc.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 21 | ||||
-rw-r--r-- | arch/x86/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/lib/misc.c | 11 |
4 files changed, 33 insertions, 7 deletions
diff --git a/arch/x86/include/asm/misc.h b/arch/x86/include/asm/misc.h new file mode 100644 index 000000000000..475f5bbc7f53 --- /dev/null +++ b/arch/x86/include/asm/misc.h | |||
@@ -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 */ | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 6cacab671f9b..d41f3ba26ced 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -73,11 +73,10 @@ | |||
73 | #include <asm/setup.h> | 73 | #include <asm/setup.h> |
74 | #include <asm/uv/uv.h> | 74 | #include <asm/uv/uv.h> |
75 | #include <linux/mc146818rtc.h> | 75 | #include <linux/mc146818rtc.h> |
76 | |||
77 | #include <asm/smpboot_hooks.h> | 76 | #include <asm/smpboot_hooks.h> |
78 | #include <asm/i8259.h> | 77 | #include <asm/i8259.h> |
79 | |||
80 | #include <asm/realmode.h> | 78 | #include <asm/realmode.h> |
79 | #include <asm/misc.h> | ||
81 | 80 | ||
82 | /* State of each CPU */ | 81 | /* State of each CPU */ |
83 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | 82 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; |
@@ -653,17 +652,27 @@ static void announce_cpu(int cpu, int apicid) | |||
653 | { | 652 | { |
654 | static int current_node = -1; | 653 | static int current_node = -1; |
655 | int node = early_cpu_to_node(cpu); | 654 | int node = early_cpu_to_node(cpu); |
656 | int max_cpu_present = find_last_bit(cpumask_bits(cpu_present_mask), NR_CPUS); | 655 | static int width; |
656 | |||
657 | if (!width) | ||
658 | width = num_digits(num_possible_cpus()) + 1; /* + '#' sign */ | ||
657 | 659 | ||
658 | if (system_state == SYSTEM_BOOTING) { | 660 | if (system_state == SYSTEM_BOOTING) { |
659 | if (node != current_node) { | 661 | if (node != current_node) { |
660 | if (current_node > (-1)) | 662 | if (current_node > (-1)) |
661 | pr_cont(" OK\n"); | 663 | pr_cont(" OK\n"); |
662 | current_node = node; | 664 | current_node = node; |
663 | pr_info("Booting Node %3d, Processors ", node); | 665 | pr_info("Booting Node %3d, Processors:", node); |
664 | } | 666 | } |
665 | pr_cont(" #%4d%s", cpu, cpu == max_cpu_present ? " OK\n" : ""); | 667 | |
666 | return; | 668 | /* Add padding for the BSP */ |
669 | if (cpu == 1) | ||
670 | pr_cont("%*s", width + 1, " "); | ||
671 | |||
672 | pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu); | ||
673 | |||
674 | if (cpu == num_present_cpus() - 1) | ||
675 | pr_cont(" OK\n"); | ||
667 | } else | 676 | } else |
668 | pr_info("Booting Node %d Processor %d APIC 0x%x\n", | 677 | pr_info("Booting Node %d Processor %d APIC 0x%x\n", |
669 | node, cpu, apicid); | 678 | node, cpu, apicid); |
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 96b2c6697c9d..992d63bb154f 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -16,7 +16,7 @@ clean-files := inat-tables.c | |||
16 | 16 | ||
17 | obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o | 17 | obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o |
18 | 18 | ||
19 | lib-y := delay.o | 19 | lib-y := delay.o misc.o |
20 | lib-y += thunk_$(BITS).o | 20 | lib-y += thunk_$(BITS).o |
21 | lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o | 21 | lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o |
22 | lib-y += memcpy_$(BITS).o | 22 | lib-y += memcpy_$(BITS).o |
diff --git a/arch/x86/lib/misc.c b/arch/x86/lib/misc.c new file mode 100644 index 000000000000..bc35cde9769f --- /dev/null +++ b/arch/x86/lib/misc.c | |||
@@ -0,0 +1,11 @@ | |||
1 | int num_digits(int val) | ||
2 | { | ||
3 | int digits = 0; | ||
4 | |||
5 | while (val) { | ||
6 | val /= 10; | ||
7 | digits++; | ||
8 | } | ||
9 | |||
10 | return digits; | ||
11 | } | ||