Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/x86/mp_x86.c
Show First 20 Lines • Show All 1,078 Lines • ▼ Show 20 Lines | |||||
#ifndef EARLY_AP_STARTUP | #ifndef EARLY_AP_STARTUP | ||||
/* Start per-CPU event timers. */ | /* Start per-CPU event timers. */ | ||||
cpu_initclocks_ap(); | cpu_initclocks_ap(); | ||||
#endif | #endif | ||||
kcsan_cpu_init(cpuid); | kcsan_cpu_init(cpuid); | ||||
/* | |||||
* Assert that smp_after_idle_runnable condition is reasonable. | |||||
*/ | |||||
MPASS(PCPU_GET(curpcb) == NULL); | |||||
sched_throw(NULL); | sched_throw(NULL); | ||||
panic("scheduler returned us to %s", __func__); | panic("scheduler returned us to %s", __func__); | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
static void | static void | ||||
smp_after_idle_runnable(void *arg __unused) | smp_after_idle_runnable(void *arg __unused) | ||||
{ | { | ||||
struct pcpu *pc; | struct pcpu *pc; | ||||
int cpu; | int cpu; | ||||
for (cpu = 1; cpu < mp_ncpus; cpu++) { | for (cpu = 1; cpu < mp_ncpus; cpu++) { | ||||
pc = pcpu_find(cpu); | pc = pcpu_find(cpu); | ||||
while (atomic_load_ptr(&pc->pc_curthread) == (uintptr_t)NULL) | while (atomic_load_ptr(&pc->pc_curpcb) == (uintptr_t)NULL) | ||||
cpu_spinwait(); | cpu_spinwait(); | ||||
kmem_free((vm_offset_t)bootstacks[cpu], kstack_pages * | kmem_free((vm_offset_t)bootstacks[cpu], kstack_pages * | ||||
PAGE_SIZE); | PAGE_SIZE); | ||||
} | } | ||||
} | } | ||||
SYSINIT(smp_after_idle_runnable, SI_SUB_SMP, SI_ORDER_ANY, | SYSINIT(smp_after_idle_runnable, SI_SUB_SMP, SI_ORDER_ANY, | ||||
smp_after_idle_runnable, NULL); | smp_after_idle_runnable, NULL); | ||||
▲ Show 20 Lines • Show All 736 Lines • Show Last 20 Lines |