On Wed, 13 Feb 2019, Atish Patra wrote:nr_cpu_ids can be modified by nr_cpus in boot command line. If nr_cpus is set to a value less than number of cpus described in the DT, kernel may not boot depending on the boot hartid. This happens because we break out of the while loop and BUG_ON(!found_boot_cpu).
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -66,6 +66,11 @@ void __init setup_smp(void)
found_boot_cpu = 1;
continue;
}
+ if (cpuid >= NR_CPUS) {
Use nr_cpu_ids instead? Its initialized to NR_CPUS but can be restricted
if we can determine on boot how many processor we truly have.