diff options
author | Richard Braun <rbraun@sceen.net> | 2013-03-14 22:26:24 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-03-14 22:26:24 +0100 |
commit | ed09fa58fb5778d943b2636b13c873fa68d4daac (patch) | |
tree | 48f641ccf52688c23b4d8883bc13af17be7836ac /arch/x86/machine/cpu.c | |
parent | fd051e1e8b2cae9a302c08ff6df76b98ea6fe58e (diff) |
kern/{kernel,thread}: rework initialization
Make cpu_count() available on kernel entry so that modules (and in particular
the thread module) can allocate per-CPU resources from the BSP. This makes
the initial state stable and simplifies code (no need to check for a transient
early initialization state).
Diffstat (limited to 'arch/x86/machine/cpu.c')
-rw-r--r-- | arch/x86/machine/cpu.c | 15 |
1 files changed, 13 insertions, 2 deletions
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(); } |