diff options
author | Tejun Heo <tj@kernel.org> | 2009-01-13 06:41:35 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-16 08:19:46 -0500 |
commit | 1a51e3a0aed18767cf2762e95456ecfeb0bca5e6 (patch) | |
tree | 2d930218ef1072a59f7dac0f97bb03aa02796c8c /arch/x86/kernel/head64.c | |
parent | c8f3329a0ddd751241e96b4100df7eda14b2cbc6 (diff) |
x86: fold pda into percpu area on SMP
[ Based on original patch from Christoph Lameter and Mike Travis. ]
Currently pdas and percpu areas are allocated separately. %gs points
to local pda and percpu area can be reached using pda->data_offset.
This patch folds pda into percpu area.
Due to strange gcc requirement, pda needs to be at the beginning of
the percpu area so that pda->stack_canary is at %gs:40. To achieve
this, a new percpu output section macro - PERCPU_VADDR_PREALLOC() - is
added and used to reserve pda sized chunk at the start of the percpu
area.
After this change, for boot cpu, %gs first points to pda in the
data.init area and later during setup_per_cpu_areas() gets updated to
point to the actual pda. This means that setup_per_cpu_areas() need
to reload %gs for CPU0 while clearing pda area for other cpus as cpu0
already has modified it when control reaches setup_per_cpu_areas().
This patch also removes now unnecessary get_local_pda() and its call
sites.
A lot of this patch is taken from Mike Travis' "x86_64: Fold pda into
per cpu area" patch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/head64.c')
-rw-r--r-- | arch/x86/kernel/head64.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 462d0beccb6b..1a311293f733 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -26,12 +26,18 @@ | |||
26 | #include <asm/bios_ebda.h> | 26 | #include <asm/bios_ebda.h> |
27 | #include <asm/trampoline.h> | 27 | #include <asm/trampoline.h> |
28 | 28 | ||
29 | /* boot cpu pda, referenced by head_64.S to initialize %gs for boot CPU */ | 29 | #ifndef CONFIG_SMP |
30 | /* boot cpu pda, referenced by head_64.S to initialize %gs on UP */ | ||
30 | struct x8664_pda _boot_cpu_pda; | 31 | struct x8664_pda _boot_cpu_pda; |
32 | #endif | ||
31 | 33 | ||
32 | void __init x86_64_init_pda(void) | 34 | void __init x86_64_init_pda(void) |
33 | { | 35 | { |
36 | #ifdef CONFIG_SMP | ||
37 | cpu_pda(0) = (void *)__per_cpu_load; | ||
38 | #else | ||
34 | cpu_pda(0) = &_boot_cpu_pda; | 39 | cpu_pda(0) = &_boot_cpu_pda; |
40 | #endif | ||
35 | cpu_pda(0)->data_offset = | 41 | cpu_pda(0)->data_offset = |
36 | (unsigned long)(__per_cpu_load - __per_cpu_start); | 42 | (unsigned long)(__per_cpu_load - __per_cpu_start); |
37 | pda_init(0); | 43 | pda_init(0); |