lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Mar 2024 12:39:07 +0800
From: Dashi Cao <dscao999@...mail.com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH] Print also the BSP number when announcing cpu

When announcing CPU, the BSP is always printed as blanks.
This patch will print out the BSP number. It has the assumption
that the BSP is not the last CPU in a CPU node.

Dashi Cao

Signed-off-by: Dashi Cao <dscao999@...mail.com>
---
 arch/x86/kernel/smpboot.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 3f57ce68a3f1..073472742be4 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -931,9 +931,9 @@ static int wakeup_secondary_cpu_via_init(u32
phys_apicid, unsigned long start_ei
 /* reduce the number of lines printed when booting a large cpu count
system */
 static void announce_cpu(int cpu, int apicid)
 {
-       static int width, node_width, first = 1;
+       static int width, node_width, bspn = -1;
        static int current_node = NUMA_NO_NODE;
-       int node = early_cpu_to_node(cpu);
+       int bsp, node = early_cpu_to_node(cpu);

        if (!width)
                width = num_digits(num_possible_cpus()) + 1; /* + '#'
sign */
@@ -942,7 +942,7 @@ static void announce_cpu(int cpu, int apicid)
                node_width = num_digits(num_possible_nodes()) + 1; /* +
'#' */

        if (system_state < SYSTEM_RUNNING) {
-               if (first)
+               if (bspn == -1)
                        pr_info("x86: Booting SMP configuration:\n");

                if (node != current_node) {
@@ -954,10 +954,12 @@ static void announce_cpu(int cpu, int apicid)
                               node_width - num_digits(node), " ",
node);
                }

-               /* Add padding for the BSP */
-               if (first)
-                       pr_cont("%*s", width + 1, " ");
-               first = 0;
+               if (bspn == -1) {
+                       bsp = raw_smp_processor_id();
+                       bspn = cpumask_next(bsp, cpu_present_mask);
+               }
+               if (cpu == bspn)
+                       pr_cont("%*s#%d", width - num_digits(bsp), " ",
bsp);

                pr_cont("%*s#%d", width - num_digits(cpu), " ", cpu);
        } else
-- 
2.30.2



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ