Index: sys/arch/arm/pic/pic.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/pic/pic.c,v retrieving revision 1.61 diff -u -p -r1.61 pic.c --- sys/arch/arm/pic/pic.c 1 Nov 2020 14:42:05 -0000 1.61 +++ sys/arch/arm/pic/pic.c 11 Jan 2021 19:48:46 -0000 @@ -226,8 +226,9 @@ intr_ipi_send(const kcpuset_t *kcp, u_lo sent_p = true; } } - KASSERTMSG(cold || sent_p || ncpu <= 1, "cold %d sent_p %d ncpu %d", - cold, sent_p, ncpu); + KASSERTMSG(cold || sent_p || ncpu <= 1 || !mp_ready, + "cold %d sent_p %d ncpu %d mp_ready=%s", cold, sent_p, ncpu, + mp_ready ? "true" : "false"); } #endif /* MULTIPROCESSOR */ Index: sys/kern/init_main.c =================================================================== RCS file: /cvsroot/src/sys/kern/init_main.c,v retrieving revision 1.534 diff -u -p -r1.534 init_main.c --- sys/kern/init_main.c 5 Dec 2020 18:17:01 -0000 1.534 +++ sys/kern/init_main.c 11 Jan 2021 19:48:50 -0000 @@ -823,6 +823,7 @@ configure2(void) #if defined(MULTIPROCESSOR) cpu_boot_secondary_processors(); #endif + mp_ready = true; /* * Bus scans can make it appear as if the system has paused, so Index: sys/kern/kern_runq.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_runq.c,v retrieving revision 1.69 diff -u -p -r1.69 kern_runq.c --- sys/kern/kern_runq.c 23 May 2020 21:24:41 -0000 1.69 +++ sys/kern/kern_runq.c 11 Jan 2021 19:48:50 -0000 @@ -331,7 +331,7 @@ sched_resched_cpu(struct cpu_info *ci, p * If the priority level we're evaluating wouldn't cause a new LWP * to be run on the CPU, then we have nothing to do. */ - if (pri <= spc->spc_curpriority || !mp_online) { + if (pri <= spc->spc_curpriority || !mp_ready) { if (__predict_true(unlock)) { spc_unlock(ci); } @@ -575,9 +575,13 @@ sched_takecpu(struct lwp *l) KASSERT(lwp_locked(l, NULL)); - /* If thread is strictly bound, do not estimate other CPUs */ ci = l->l_cpu; - if (l->l_pflag & LP_BOUND) + /* If we're still starting APs then */ + if (__predict_false(!mp_ready)) + return ci; + + /* If thread is strictly bound, do not estimate other CPUs */ + if ((l->l_pflag & LP_BOUND)) return ci; spc = &ci->ci_schedstate; Index: sys/kern/subr_cpu.c =================================================================== RCS file: /cvsroot/src/sys/kern/subr_cpu.c,v retrieving revision 1.16 diff -u -p -r1.16 subr_cpu.c --- sys/kern/subr_cpu.c 23 Sep 2020 12:05:16 -0000 1.16 +++ sys/kern/subr_cpu.c 11 Jan 2021 19:48:50 -0000 @@ -79,6 +79,7 @@ kmutex_t cpu_lock __cacheline_aligned; int ncpu __read_mostly; int ncpuonline __read_mostly; bool mp_online __read_mostly; +bool mp_ready __read_mostly; static bool cpu_topology_present __read_mostly; static bool cpu_topology_haveslow __read_mostly; int64_t cpu_counts[CPU_COUNT_MAX]; Index: sys/sys/systm.h =================================================================== RCS file: /cvsroot/src/sys/sys/systm.h,v retrieving revision 1.298 diff -u -p -r1.298 systm.h --- sys/sys/systm.h 28 Aug 2020 12:43:24 -0000 1.298 +++ sys/sys/systm.h 11 Jan 2021 19:48:50 -0000 @@ -104,6 +104,7 @@ extern int ncpu; /* number of CPUs conf extern int ncpuonline; /* number of CPUs online */ #if defined(_KERNEL) extern bool mp_online; /* secondary processors are started */ +extern bool mp_ready; /* secondary processors are ready */ #endif /* defined(_KERNEL) */ extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf.c */