Commit 92d65b23 authored by Brian Gerst's avatar Brian Gerst Committed by Tejun Heo

x86-64: Convert exception stacks to per-cpu

Move the exception stacks to per-cpu, removing specific allocation code.
Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 26f80bd6
...@@ -913,8 +913,9 @@ void __cpuinit pda_init(int cpu) ...@@ -913,8 +913,9 @@ void __cpuinit pda_init(int cpu)
} }
} }
static char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
DEBUG_STKSZ] __page_aligned_bss; [(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ])
__aligned(PAGE_SIZE);
extern asmlinkage void ignore_sysret(void); extern asmlinkage void ignore_sysret(void);
...@@ -972,15 +973,12 @@ void __cpuinit cpu_init(void) ...@@ -972,15 +973,12 @@ void __cpuinit cpu_init(void)
struct tss_struct *t = &per_cpu(init_tss, cpu); struct tss_struct *t = &per_cpu(init_tss, cpu);
struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu);
unsigned long v; unsigned long v;
char *estacks = NULL;
struct task_struct *me; struct task_struct *me;
int i; int i;
/* CPU 0 is initialised in head64.c */ /* CPU 0 is initialised in head64.c */
if (cpu != 0) if (cpu != 0)
pda_init(cpu); pda_init(cpu);
else
estacks = boot_exception_stacks;
me = current; me = current;
...@@ -1014,18 +1012,13 @@ void __cpuinit cpu_init(void) ...@@ -1014,18 +1012,13 @@ void __cpuinit cpu_init(void)
* set up and load the per-CPU TSS * set up and load the per-CPU TSS
*/ */
if (!orig_ist->ist[0]) { if (!orig_ist->ist[0]) {
static const unsigned int order[N_EXCEPTION_STACKS] = { static const unsigned int sizes[N_EXCEPTION_STACKS] = {
[0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STKSZ,
[DEBUG_STACK - 1] = DEBUG_STACK_ORDER [DEBUG_STACK - 1] = DEBUG_STKSZ
}; };
char *estacks = per_cpu(exception_stacks, cpu);
for (v = 0; v < N_EXCEPTION_STACKS; v++) { for (v = 0; v < N_EXCEPTION_STACKS; v++) {
if (cpu) { estacks += sizes[v];
estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
if (!estacks)
panic("Cannot allocate exception "
"stack %ld %d\n", v, cpu);
}
estacks += PAGE_SIZE << order[v];
orig_ist->ist[v] = t->x86_tss.ist[v] = orig_ist->ist[v] = t->x86_tss.ist[v] =
(unsigned long)estacks; (unsigned long)estacks;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment