Page MenuHomeFreeBSD

D35435.id106765.diff
No OneTemporary

D35435.id106765.diff

Index: sys/arm64/arm64/mp_machdep.c
===================================================================
--- sys/arm64/arm64/mp_machdep.c
+++ sys/arm64/arm64/mp_machdep.c
@@ -183,7 +183,7 @@
started = 0;
for (i = 0; i < 2000; i++) {
- if (smp_started) {
+ if (atomic_load_acq_int(&smp_started) != 0) {
printf("done\n");
return;
}
@@ -290,11 +290,6 @@
kcsan_cpu_init(cpu);
- /*
- * Assert that smp_after_idle_runnable condition is reasonable.
- */
- MPASS(PCPU_GET(curpcb) == NULL);
-
/* Enter the scheduler */
sched_ap_entry();
@@ -305,16 +300,24 @@
static void
smp_after_idle_runnable(void *arg __unused)
{
- struct pcpu *pc;
int cpu;
+ if (mp_ncpus == 1)
+ return;
+
+ KASSERT(smp_started != 0, ("%s: SMP not started yet", __func__));
+
+ /*
+ * Wait for all APs to handle an interrupt. After that, we know that
+ * the APs have entered the scheduler at least once, so the boot stacks
+ * are safe to free.
+ */
+ smp_rendezvous(smp_no_rendezvous_barrier, NULL,
+ smp_no_rendezvous_barrier, NULL);
+
for (cpu = 1; cpu < mp_ncpus; cpu++) {
- if (bootstacks[cpu] != NULL) {
- pc = pcpu_find(cpu);
- while (atomic_load_ptr(&pc->pc_curpcb) == NULL)
- cpu_spinwait();
+ if (bootstacks[cpu] != NULL)
kmem_free((vm_offset_t)bootstacks[cpu], PAGE_SIZE);
- }
}
}
SYSINIT(smp_after_idle_runnable, SI_SUB_SMP, SI_ORDER_ANY,

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 29, 5:06 PM (19 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26347390
Default Alt Text
D35435.id106765.diff (1 KB)

Event Timeline