x86_64: smp: initialise APs in parallel
bring_all_ap_online() now initialises all APs in parallel, and waits for them all to come online (i.e. reach the end of ap_trampoline_exit, making them ready to start scheduling threads) before returning.
This commit is contained in:
@@ -17,6 +17,9 @@ volatile uint8_t __all_ap_ok = 0;
|
||||
|
||||
extern "C" void ap_trampoline_exit(void)
|
||||
{
|
||||
struct vm_page *stack_page = (struct vm_page *)__ap_stack_page;
|
||||
__this_ap_ok = 1;
|
||||
|
||||
ml_cpu_block *this_cpu = (ml_cpu_block *)kmalloc(sizeof *this_cpu, VM_NORMAL);
|
||||
ml_cpu_block_init(this_cpu);
|
||||
ml_cpu_block_use(this_cpu);
|
||||
@@ -31,7 +34,7 @@ extern "C" void ap_trampoline_exit(void)
|
||||
|
||||
struct thread *this_thread = create_idle_thread();
|
||||
this_thread->tr_id = cpu_id;
|
||||
this_thread->tr_kstack = (struct vm_page *)__ap_stack_page;
|
||||
this_thread->tr_kstack = (struct vm_page *)stack_page;
|
||||
self->c_rq.rq_idle = self->c_rq.rq_cur = this_thread;
|
||||
|
||||
put_cpu(self);
|
||||
@@ -39,7 +42,6 @@ extern "C" void ap_trampoline_exit(void)
|
||||
ap_apic_init();
|
||||
|
||||
cpu_set_online(cpu_id);
|
||||
__this_ap_ok = 1;
|
||||
irq_enable();
|
||||
|
||||
idle();
|
||||
@@ -113,7 +115,12 @@ kern_status_t bring_all_ap_online(void)
|
||||
p += rec->r_length;
|
||||
}
|
||||
|
||||
printk("acpi: found %u logical cores", nr_processors);
|
||||
while (cpu_nr_available() != cpu_nr_online()) {
|
||||
ml_cpu_relax();
|
||||
}
|
||||
|
||||
printk("acpi: %u APs online", cpu_nr_online());
|
||||
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user