diff options
-rw-r--r-- | arch/x86/machine/cpu.c | 11 | ||||
-rw-r--r-- | arch/x86/machine/pmap.c | 5 |
2 files changed, 13 insertions, 3 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c index 0f395fc3..2b98b58c 100644 --- a/arch/x86/machine/cpu.c +++ b/arch/x86/machine/cpu.c @@ -391,14 +391,21 @@ cpu_mp_start_aps(void) io_write_byte(CPU_MP_CMOS_PORT_REG, CPU_MP_CMOS_REG_RESET); io_write_byte(CPU_MP_CMOS_PORT_DATA, CPU_MP_CMOS_DATA_RESET_WARM); - /* Perform the "Universal Start-up Algorithm" */ + /* + * Preallocate stacks now, as the kernel mappings shouldn't change while + * the APs are bootstrapping. + */ for (i = 1; i < cpu_array_size; i++) { cpu = &cpu_array[i]; - cpu->boot_stack = vm_kmem_alloc(BOOT_STACK_SIZE); if (cpu->boot_stack == 0) panic("cpu: unable to allocate boot stack for cpu%u", i); + } + + /* Perform the "Universal Start-up Algorithm" */ + for (i = 1; i < cpu_array_size; i++) { + cpu = &cpu_array[i]; boot_ap_id = i; boot_ap_stack_addr = cpu->boot_stack; diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c index 786a235c..de29c016 100644 --- a/arch/x86/machine/pmap.c +++ b/arch/x86/machine/pmap.c @@ -146,7 +146,7 @@ static unsigned long pmap_zero_va; /* * True if running on multiple processors (TLB flushes must be propagated). */ -static int pmap_mp_mode; +static volatile int pmap_mp_mode; /* * Shared variables used by the inter-processor update functions. @@ -366,6 +366,9 @@ pmap_ap_bootstrap(void) { if (cpu_has_global_pages()) cpu_enable_global_pages(); + + while (!pmap_mp_mode) + cpu_pause(); } unsigned long __init |