[PATCH] riscv: smp: Report an unusable boot CPU node
zhaogongyi
zhaogongyi at bytedance.com
Fri Nov 27 00:03:00 PST 2026
If CPU enumeration finds no usable device tree node for the boot hart,
setup_smp() triggers a breakpoint during early boot.
Use panic() to report the device tree failure and include the boot
hart ID so the corresponding CPU node can be checked.
Signed-off-by: zhaogongyi <zhaogongyi at bytedance.com>
---
QEMU/TCG serial excerpts from the BSK test kernel with a DTB that
had no usable CPU node for the boot hart.
Unpatched kernel
kernel BUG at arch/riscv/kernel/smpboot.c:151!
Patched kernel
Kernel panic - not syncing: No usable CPU node for boot hart 1
arch/riscv/kernel/smpboot.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index a9de2dae8..6436cf1fa 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -150,7 +150,9 @@ static void __init of_parse_and_init_cpus(void)
cpuid++;
}
- BUG_ON(!found_boot_cpu);
+ if (!found_boot_cpu)
+ panic("No usable CPU node for boot hart %lu",
+ cpuid_to_hartid_map(0));
if (cpuid > nr_cpu_ids)
pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n",
base-commit: 2359fc3f3501b9de725c1f5699344c3ad11ac607
More information about the linux-riscv
mailing list