Re: [PATCH 2/2] x86: Cleanup boot CPUs table
On Sat, 2013-09-28 at 10:25 +0200, Ingo Molnar wrote: > > [0.072367] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 <-- > > [0.686329] x86: Booted up 1 node, 8 CPUs ^ > - Added nodes count to the 'Booted up' line. Since we count nodes and > CPUs, we might as well want to demonstrate our superior counting > skills and print out both. What superior counting skills? ;-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
* Borislav Petkov wrote: > On Sat, Sep 28, 2013 at 10:25:42AM +0200, Ingo Molnar wrote: > > Could we, with another add-on patch, further compress the first half > > of the output as well? > > > > Advanced output like this would be really cool: > > Sure. > > > > [0.074509] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 > > > #7 > > > [0.644008] x86: Booting node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 > > > #15 > > > [1.245006] x86: Booting node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 > > > #23 > > > [1.864005] x86: Booting node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 > > > #31 > > > [2.489005] x86: Booting node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 > > > #39 > > > [3.093005] x86: Booting node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 > > > #47 > > > [3.698005] x86: Booting node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 > > > #55 > > > [4.304005] x86: Booting node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 > > > #63 > > > [4.961413] x86: Booted up 8 nodes, 64 CPUs > > Boot(ing|ed) kinda wastes unnecessary space too, how about we go a step > further: > > [0.074509] x86: Booting SMP configuration: > [0.644008] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > [1.245006] node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 > [1.864005] node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 > [2.489005] node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 > [3.093005] node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 > [3.698005] node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 > [4.304005] node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 > [4.961413] node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 > [5.245021] x86: Booted up 8 nodes, 64 CPUs > > > [0.074509] x86: Booting SMP configuration: > [0.072367] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > [0.686329] x86: Booted up 1 node, 8 CPUs Nice! > Btw, the "x86" prefix would mean we want to either change pr_fmt() of > arch/x86/kernel/smpboot.c (which I rather not) or not use pr_info (which > I'd prefer). Not using pr_info() for such specially formatted output is fine I think. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
On Sat, Sep 28, 2013 at 10:25:42AM +0200, Ingo Molnar wrote: > Could we, with another add-on patch, further compress the first half > of the output as well? > > Advanced output like this would be really cool: Sure. > > [0.074509] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > > [0.644008] x86: Booting node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 > > [1.245006] x86: Booting node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 > > [1.864005] x86: Booting node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 > > [2.489005] x86: Booting node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 > > [3.093005] x86: Booting node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 > > [3.698005] x86: Booting node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 > > [4.304005] x86: Booting node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 > > [4.961413] x86: Booted up 8 nodes, 64 CPUs Boot(ing|ed) kinda wastes unnecessary space too, how about we go a step further: [0.074509] x86: Booting SMP configuration: [0.644008] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [1.245006] node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 [1.864005] node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 [2.489005] node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 [3.093005] node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 [3.698005] node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 [4.304005] node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 [4.961413] node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 [5.245021] x86: Booted up 8 nodes, 64 CPUs > > [0.072367] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > > [0.686329] x86: Booted up 1 node, 8 CPUs vs [0.074509] x86: Booting SMP configuration: [0.072367] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.686329] x86: Booted up 1 node, 8 CPUs Btw, the "x86" prefix would mean we want to either change pr_fmt() of arch/x86/kernel/smpboot.c (which I rather not) or not use pr_info (which I'd prefer). > Note the typographical details I added: > > - I added an extra space after 'CPUs:' to make the table stand out > better from far away Ok. > - Removed the 'OK' - it really does not add any more information than > the newline already does Yes. > - Changed the 'Brought up' message to be more consistent with the prior > messages. Ok. > - Added nodes count to the 'Booted up' line. Since we count nodes and > CPUs, we might as well want to demonstrate our superior counting > skills and print out both. Haha, ok. > - The 'node' counting uses the new num_digits() function - this was very > easy to implement in my mockup ;-) Ok. > - Note the singular spelling of 'node' in the 1-node case. Again this > was easy in the mockup! Should be easy to do :) So how about the even shorter mockup above? Thanks. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
* Borislav Petkov wrote: > From: Borislav Petkov > > 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 Awesome! Could we, with another add-on patch, further compress the first half of the output as well? Advanced output like this would be really cool: > [0.074509] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > [0.644008] x86: Booting node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 > [1.245006] x86: Booting node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 > [1.864005] x86: Booting node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 > [2.489005] x86: Booting node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 > [3.093005] x86: Booting node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 > [3.698005] x86: Booting node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 > [4.304005] x86: Booting node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 > [4.961413] x86: Booted up 8 nodes, 64 CPUs and: > [0.072367] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > [0.686329] x86: Booted up 1 node, 8 CPUs Note the typographical details I added: - I added an extra space after 'CPUs:' to make the table stand out better from far away - Removed the 'OK' - it really does not add any more information than the newline already does - Changed the 'Brought up' message to be more consistent with the prior messages. - Added nodes count to the 'Booted up' line. Since we count nodes and CPUs, we might as well want to demonstrate our superior counting skills and print out both. - The 'node' counting uses the new num_digits() function - this was very easy to implement in my mockup ;-) - Note the singular spelling of 'node' in the 1-node case. Again this was easy in the mockup! Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
* Borislav Petkov b...@alien8.de wrote: From: Borislav Petkov b...@suse.de 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 Awesome! Could we, with another add-on patch, further compress the first half of the output as well? Advanced output like this would be really cool: [0.074509] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.644008] x86: Booting node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 [1.245006] x86: Booting node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 [1.864005] x86: Booting node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 [2.489005] x86: Booting node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 [3.093005] x86: Booting node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 [3.698005] x86: Booting node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 [4.304005] x86: Booting node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 [4.961413] x86: Booted up 8 nodes, 64 CPUs and: [0.072367] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.686329] x86: Booted up 1 node, 8 CPUs Note the typographical details I added: - I added an extra space after 'CPUs:' to make the table stand out better from far away - Removed the 'OK' - it really does not add any more information than the newline already does - Changed the 'Brought up' message to be more consistent with the prior messages. - Added nodes count to the 'Booted up' line. Since we count nodes and CPUs, we might as well want to demonstrate our superior counting skills and print out both. - The 'node' counting uses the new num_digits() function - this was very easy to implement in my mockup ;-) - Note the singular spelling of 'node' in the 1-node case. Again this was easy in the mockup! Thanks, Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
On Sat, Sep 28, 2013 at 10:25:42AM +0200, Ingo Molnar wrote: Could we, with another add-on patch, further compress the first half of the output as well? Advanced output like this would be really cool: Sure. [0.074509] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.644008] x86: Booting node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 [1.245006] x86: Booting node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 [1.864005] x86: Booting node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 [2.489005] x86: Booting node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 [3.093005] x86: Booting node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 [3.698005] x86: Booting node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 [4.304005] x86: Booting node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 [4.961413] x86: Booted up 8 nodes, 64 CPUs Boot(ing|ed) kinda wastes unnecessary space too, how about we go a step further: [0.074509] x86: Booting SMP configuration: [0.644008] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [1.245006] node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 [1.864005] node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 [2.489005] node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 [3.093005] node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 [3.698005] node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 [4.304005] node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 [4.961413] node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 [5.245021] x86: Booted up 8 nodes, 64 CPUs [0.072367] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.686329] x86: Booted up 1 node, 8 CPUs vs [0.074509] x86: Booting SMP configuration: [0.072367] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.686329] x86: Booted up 1 node, 8 CPUs Btw, the x86 prefix would mean we want to either change pr_fmt() of arch/x86/kernel/smpboot.c (which I rather not) or not use pr_info (which I'd prefer). Note the typographical details I added: - I added an extra space after 'CPUs:' to make the table stand out better from far away Ok. - Removed the 'OK' - it really does not add any more information than the newline already does Yes. - Changed the 'Brought up' message to be more consistent with the prior messages. Ok. - Added nodes count to the 'Booted up' line. Since we count nodes and CPUs, we might as well want to demonstrate our superior counting skills and print out both. Haha, ok. - The 'node' counting uses the new num_digits() function - this was very easy to implement in my mockup ;-) Ok. - Note the singular spelling of 'node' in the 1-node case. Again this was easy in the mockup! Should be easy to do :) So how about the even shorter mockup above? Thanks. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
* Borislav Petkov b...@alien8.de wrote: On Sat, Sep 28, 2013 at 10:25:42AM +0200, Ingo Molnar wrote: Could we, with another add-on patch, further compress the first half of the output as well? Advanced output like this would be really cool: Sure. [0.074509] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.644008] x86: Booting node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 [1.245006] x86: Booting node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 [1.864005] x86: Booting node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 [2.489005] x86: Booting node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 [3.093005] x86: Booting node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 [3.698005] x86: Booting node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 [4.304005] x86: Booting node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 [4.961413] x86: Booted up 8 nodes, 64 CPUs Boot(ing|ed) kinda wastes unnecessary space too, how about we go a step further: [0.074509] x86: Booting SMP configuration: [0.644008] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [1.245006] node #1, CPUs: #8 #9 #10 #11 #12 #13 #14 #15 [1.864005] node #2, CPUs: #16 #17 #18 #19 #20 #21 #22 #23 [2.489005] node #3, CPUs: #24 #25 #26 #27 #28 #29 #30 #31 [3.093005] node #4, CPUs: #32 #33 #34 #35 #36 #37 #38 #39 [3.698005] node #5, CPUs: #40 #41 #42 #43 #44 #45 #46 #47 [4.304005] node #6, CPUs: #48 #49 #50 #51 #52 #53 #54 #55 [4.961413] node #7, CPUs: #56 #57 #58 #59 #60 #61 #62 #63 [5.245021] x86: Booted up 8 nodes, 64 CPUs [0.074509] x86: Booting SMP configuration: [0.072367] node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 [0.686329] x86: Booted up 1 node, 8 CPUs Nice! Btw, the x86 prefix would mean we want to either change pr_fmt() of arch/x86/kernel/smpboot.c (which I rather not) or not use pr_info (which I'd prefer). Not using pr_info() for such specially formatted output is fine I think. Thanks, Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] x86: Cleanup boot CPUs table
On Sat, 2013-09-28 at 10:25 +0200, Ingo Molnar wrote: [0.072367] x86: Booting node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 -- [0.686329] x86: Booted up 1 node, 8 CPUs ^ - Added nodes count to the 'Booted up' line. Since we count nodes and CPUs, we might as well want to demonstrate our superior counting skills and print out both. What superior counting skills? ;-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] x86: Cleanup boot CPUs table
From: Borislav Petkov 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 Cc: Ingo Molnar Cc: Libin Link: http://lkml.kernel.org/r/20130927065115.ga6...@gmail.com Signed-off-by: Borislav Petkov --- arch/x86/include/asm/misc.h | 6 ++ arch/x86/kernel/smpboot.c | 21 +++-- arch/x86/lib/Makefile | 2 +- arch/x86/lib/misc.c | 11 +++ 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 arch/x86/include/asm/misc.h create mode 100644 arch/x86/lib/misc.c diff --git a/arch/x86/include/asm/misc.h b/arch/x86/include/asm/misc.h new file mode 100644 index ..475f5bbc7f53 --- /dev/null +++ b/arch/x86/include/asm/misc.h @@ -0,0 +1,6 @@ +#ifndef _ASM_X86_MISC_H +#define _ASM_X86_MISC_H + +int num_digits(int val); + +#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 @@ #include #include #include - #include #include - #include +#include /* 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); 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 obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o -lib-y := delay.o +lib-y := delay.o misc.o lib-y += thunk_$(BITS).o lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o lib-y += memcpy_$(BITS).o diff --git a/arch/x86/lib/misc.c b/arch/x86/lib/misc.c new file mode 100644 index ..bc35cde9769f --- /dev/null +++ b/arch/x86/lib/misc.c @@ -0,0 +1,11 @@ +int num_digits(int val) +{ + int digits = 0; + + while (val) { + val /= 10; + digits++; + } + + return digits; +} -- 1.8.4 -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] x86: Cleanup boot CPUs table
From: Borislav Petkov b...@suse.de 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 Cc: Ingo Molnar mi...@kernel.org Cc: Libin huawei.li...@huawei.com Link: http://lkml.kernel.org/r/20130927065115.ga6...@gmail.com Signed-off-by: Borislav Petkov b...@suse.de --- arch/x86/include/asm/misc.h | 6 ++ arch/x86/kernel/smpboot.c | 21 +++-- arch/x86/lib/Makefile | 2 +- arch/x86/lib/misc.c | 11 +++ 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 arch/x86/include/asm/misc.h create mode 100644 arch/x86/lib/misc.c diff --git a/arch/x86/include/asm/misc.h b/arch/x86/include/asm/misc.h new file mode 100644 index ..475f5bbc7f53 --- /dev/null +++ b/arch/x86/include/asm/misc.h @@ -0,0 +1,6 @@ +#ifndef _ASM_X86_MISC_H +#define _ASM_X86_MISC_H + +int num_digits(int val); + +#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 @@ #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); 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 obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o -lib-y := delay.o +lib-y := delay.o misc.o lib-y += thunk_$(BITS).o lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o lib-y += memcpy_$(BITS).o diff --git a/arch/x86/lib/misc.c b/arch/x86/lib/misc.c new file mode 100644 index ..bc35cde9769f --- /dev/null +++ b/arch/x86/lib/misc.c @@ -0,0 +1,11 @@ +int num_digits(int val) +{ + int digits = 0; + + while (val) { + val /= 10; + digits++; + } + + return digits; +} -- 1.8.4 -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/