aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2009-01-18 10:38:58 -0500
committerTejun Heo <tj@kernel.org>2009-01-18 10:38:58 -0500
commit92d65b2371d86d40807e1dbfdccadc4d501edcde (patch)
tree9e99e891fc3ecd6f24073a221cd3b7683e0fb022 /arch/x86/kernel/cpu
parent26f80bd6a9ab17bc8a60b6092e7c0d05c5927ce5 (diff)
x86-64: Convert exception stacks to per-cpu
Move the exception stacks to per-cpu, removing specific allocation code. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/common.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 496f0a01919..b6d7eec0be7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -913,8 +913,9 @@ void __cpuinit pda_init(int cpu)
913 } 913 }
914} 914}
915 915
916static char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + 916static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
917 DEBUG_STKSZ] __page_aligned_bss; 917 [(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ])
918 __aligned(PAGE_SIZE);
918 919
919extern asmlinkage void ignore_sysret(void); 920extern asmlinkage void ignore_sysret(void);
920 921
@@ -972,15 +973,12 @@ void __cpuinit cpu_init(void)
972 struct tss_struct *t = &per_cpu(init_tss, cpu); 973 struct tss_struct *t = &per_cpu(init_tss, cpu);
973 struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); 974 struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu);
974 unsigned long v; 975 unsigned long v;
975 char *estacks = NULL;
976 struct task_struct *me; 976 struct task_struct *me;
977 int i; 977 int i;
978 978
979 /* CPU 0 is initialised in head64.c */ 979 /* CPU 0 is initialised in head64.c */
980 if (cpu != 0) 980 if (cpu != 0)
981 pda_init(cpu); 981 pda_init(cpu);
982 else
983 estacks = boot_exception_stacks;
984 982
985 me = current; 983 me = current;
986 984
@@ -1014,18 +1012,13 @@ void __cpuinit cpu_init(void)
1014 * set up and load the per-CPU TSS 1012 * set up and load the per-CPU TSS
1015 */ 1013 */
1016 if (!orig_ist->ist[0]) { 1014 if (!orig_ist->ist[0]) {
1017 static const unsigned int order[N_EXCEPTION_STACKS] = { 1015 static const unsigned int sizes[N_EXCEPTION_STACKS] = {
1018 [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, 1016 [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STKSZ,
1019 [DEBUG_STACK - 1] = DEBUG_STACK_ORDER 1017 [DEBUG_STACK - 1] = DEBUG_STKSZ
1020 }; 1018 };
1019 char *estacks = per_cpu(exception_stacks, cpu);
1021 for (v = 0; v < N_EXCEPTION_STACKS; v++) { 1020 for (v = 0; v < N_EXCEPTION_STACKS; v++) {
1022 if (cpu) { 1021 estacks += sizes[v];
1023 estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
1024 if (!estacks)
1025 panic("Cannot allocate exception "
1026 "stack %ld %d\n", v, cpu);
1027 }
1028 estacks += PAGE_SIZE << order[v];
1029 orig_ist->ist[v] = t->x86_tss.ist[v] = 1022 orig_ist->ist[v] = t->x86_tss.ist[v] =
1030 (unsigned long)estacks; 1023 (unsigned long)estacks;
1031 } 1024 }