diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/machine/boot.c | 3 | ||||
-rw-r--r-- | arch/x86/machine/cpu.c | 15 | ||||
-rw-r--r-- | arch/x86/machine/cpu.h | 17 |
3 files changed, 24 insertions, 11 deletions
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c index 58b675f9..f42f9bbf 100644 --- a/arch/x86/machine/boot.c +++ b/arch/x86/machine/boot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012 Richard Braun. + * Copyright (c) 2010, 2012, 2013 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -284,6 +284,7 @@ boot_main(void) vm_phys_info(); pic_setup(); pit_setup(); + cpu_mp_setup(); kernel_main(); /* Never reached */ diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c index a5a62499..0d1a9f38 100644 --- a/arch/x86/machine/cpu.c +++ b/arch/x86/machine/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012 Richard Braun. + * Copyright (c) 2010, 2011, 2012, 2013 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,6 +79,11 @@ static unsigned int cpu_boot_array_size __initdata; unsigned int cpu_array_size; /* + * Barrier for processor synchronization on kernel entry. + */ +static unsigned int cpu_mp_synced __initdata; + +/* * Interrupt descriptor table. */ static struct cpu_gate_desc cpu_idt[CPU_IDT_SIZE] __aligned(8); @@ -555,6 +560,12 @@ cpu_mp_setup(void) } void __init +cpu_mp_sync(void) +{ + cpu_mp_synced = 1; +} + +void __init cpu_ap_setup(void) { cpu_init(&cpu_array[boot_ap_id]); @@ -565,7 +576,7 @@ cpu_ap_setup(void) void __init cpu_ap_sync(void) { - while (cpu_count() == 1) + while (!cpu_mp_synced) cpu_pause(); } diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h index 9e846e34..24d4ef48 100644 --- a/arch/x86/machine/cpu.h +++ b/arch/x86/machine/cpu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012 Richard Braun. + * Copyright (c) 2010, 2011, 2012, 2013 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -576,22 +576,23 @@ void cpu_mp_register_lapic(unsigned int apic_id, int is_bsp); /* * Probe application processors and start them. + * + * On return, cpu_count() gives the actual number of managed processors. */ void cpu_mp_setup(void); /* + * Synchronize with APs on kernel entry. + */ +void cpu_mp_sync(void); + +/* * CPU initialization on APs. */ void cpu_ap_setup(void); /* - * Synchronize processors on kernel entry. - * - * Wait for all processors to reach a proper state when entering the kernel, - * so that memory allocations can proceed and thread scheduling started. - * - * Once this function returns, cpu_count can be used reliably to know if there - * are more than one processors, and how many. + * Synchronize with BSP on kernel entry. */ void cpu_ap_sync(void); |