]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: print hartid on bringup
authorYunhui Cui <cuiyunhui@bytedance.com>
Mon, 3 Mar 2025 08:34:24 +0000 (16:34 +0800)
committerAlexandre Ghiti <alexghiti@rivosinc.com>
Tue, 1 Apr 2025 07:03:03 +0000 (07:03 +0000)
Firmware randomly releases cores, so CPU numbers don't linearly map
to hartids. When the system has an exception, we care more about hartids.
Adding "dyndbg="file smpboot.c +p" loglevel=8" to the cmdline can output
the hartid.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20250303083424.14309-1-cuiyunhui@bytedance.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
arch/riscv/kernel/smp.c
arch/riscv/kernel/smpboot.c

index d58b5e75128618e31aa22aaa4079a36092676341..e650dec448176ba00f43cb250431c32ec4a174e3 100644 (file)
@@ -48,6 +48,8 @@ EXPORT_SYMBOL_GPL(__cpuid_to_hartid_map);
 void __init smp_setup_processor_id(void)
 {
        cpuid_to_hartid_map(0) = boot_cpu_hartid;
+
+       pr_info("Booting Linux on hartid %lu\n", boot_cpu_hartid);
 }
 
 static DEFINE_PER_CPU_READ_MOSTLY(int, ipi_dummy_dev);
index e36d20205bd7d3de2dd64db5069b73508bd83eb6..601a321e0f176465835248a76232876db42f48bc 100644 (file)
@@ -231,6 +231,10 @@ asmlinkage __visible void smp_callin(void)
        riscv_ipi_enable();
 
        numa_add_cpu(curr_cpuid);
+
+       pr_debug("CPU%u: Booted secondary hartid %lu\n", curr_cpuid,
+               cpuid_to_hartid_map(curr_cpuid));
+
        set_cpu_online(curr_cpuid, true);
 
        /*