Skip to content

Commit a331337

Browse files
cuiyunhuiAlexandre Ghiti
authored andcommitted
riscv: print hartid on bringup
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>
1 parent 74f4bf9 commit a331337

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

arch/riscv/kernel/smp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ EXPORT_SYMBOL_GPL(__cpuid_to_hartid_map);
4848
void __init smp_setup_processor_id(void)
4949
{
5050
cpuid_to_hartid_map(0) = boot_cpu_hartid;
51+
52+
pr_info("Booting Linux on hartid %lu\n", boot_cpu_hartid);
5153
}
5254

5355
static DEFINE_PER_CPU_READ_MOSTLY(int, ipi_dummy_dev);

arch/riscv/kernel/smpboot.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ asmlinkage __visible void smp_callin(void)
231231
riscv_ipi_enable();
232232

233233
numa_add_cpu(curr_cpuid);
234+
235+
pr_debug("CPU%u: Booted secondary hartid %lu\n", curr_cpuid,
236+
cpuid_to_hartid_map(curr_cpuid));
237+
234238
set_cpu_online(curr_cpuid, true);
235239

236240
/*

0 commit comments

Comments
 (0)