diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-01-18 10:38:58 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-01-18 10:38:58 -0500 |
commit | 26f80bd6a9ab17bc8a60b6092e7c0d05c5927ce5 (patch) | |
tree | 7456ba479397c986337b2bb9574a74710fddbdee /arch/x86/kernel/cpu/common.c | |
parent | 9eb912d1aa6b8106e06a73ea6702ec3dab0d6a1a (diff) |
x86-64: Convert irqstacks to per-cpu
Move the irqstackptr variable from the PDA to per-cpu. Make the
stacks themselves per-cpu, removing some specific allocation code.
Add a seperate flag (is_boot_cpu) to simplify the per-cpu boot
adjustments.
tj: * sprinkle some underbars around.
* irq_stack_ptr is not used till traps_init(), no reason to
initialize it early. On SMP, just leaving it NULL till proper
initialization in setup_per_cpu_areas() works. Dropped
is_boot_cpu and early irq_stack_ptr initialization.
* do DECLARE/DEFINE_PER_CPU(char[IRQ_STACK_SIZE], irq_stack)
instead of (char, irq_stack[IRQ_STACK_SIZE]).
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 3d0cc6f17116..496f0a01919b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -881,7 +881,13 @@ __setup("clearcpuid=", setup_disablecpuid); | |||
881 | #ifdef CONFIG_X86_64 | 881 | #ifdef CONFIG_X86_64 |
882 | struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; | 882 | struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; |
883 | 883 | ||
884 | static char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; | 884 | DEFINE_PER_CPU_PAGE_ALIGNED(char[IRQ_STACK_SIZE], irq_stack); |
885 | #ifdef CONFIG_SMP | ||
886 | DEFINE_PER_CPU(char *, irq_stack_ptr); /* will be set during per cpu init */ | ||
887 | #else | ||
888 | DEFINE_PER_CPU(char *, irq_stack_ptr) = | ||
889 | per_cpu_var(irq_stack) + IRQ_STACK_SIZE - 64; | ||
890 | #endif | ||
885 | 891 | ||
886 | void __cpuinit pda_init(int cpu) | 892 | void __cpuinit pda_init(int cpu) |
887 | { | 893 | { |
@@ -901,18 +907,7 @@ void __cpuinit pda_init(int cpu) | |||
901 | if (cpu == 0) { | 907 | if (cpu == 0) { |
902 | /* others are initialized in smpboot.c */ | 908 | /* others are initialized in smpboot.c */ |
903 | pda->pcurrent = &init_task; | 909 | pda->pcurrent = &init_task; |
904 | pda->irqstackptr = boot_cpu_stack; | ||
905 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
906 | } else { | 910 | } else { |
907 | if (!pda->irqstackptr) { | ||
908 | pda->irqstackptr = (char *) | ||
909 | __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); | ||
910 | if (!pda->irqstackptr) | ||
911 | panic("cannot allocate irqstack for cpu %d", | ||
912 | cpu); | ||
913 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
914 | } | ||
915 | |||
916 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | 911 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) |
917 | pda->nodenumber = cpu_to_node(cpu); | 912 | pda->nodenumber = cpu_to_node(cpu); |
918 | } | 913 | } |