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 | 9af45651f1f7c89942e016a1a00a7ebddfa727f8 (patch) | |
tree | a22617474a2a62bc816b97c9156c5a2fc9a566b3 /arch/x86/kernel | |
parent | c6f5e0acd5d12ee23f701f15889872e67b47caa6 (diff) |
x86-64: Move kernelstack from PDA to per-cpu.
Also clean up PER_CPU_VAR usage in xen-asm_64.S
tj: * remove now unused stack_thread_info()
* s/kernelstack/kernel_stack/
* added FIXME comment in xen-asm_64.S
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/asm-offsets_64.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/entry_64.S | 4 | ||||
-rw-r--r-- | arch/x86/kernel/process_64.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 3 |
5 files changed, 11 insertions, 7 deletions
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index 4f7a210e1e58..cafff5f4a031 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -49,7 +49,6 @@ int main(void) | |||
49 | BLANK(); | 49 | BLANK(); |
50 | #undef ENTRY | 50 | #undef ENTRY |
51 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) | 51 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) |
52 | ENTRY(kernelstack); | ||
53 | ENTRY(oldrsp); | 52 | ENTRY(oldrsp); |
54 | ENTRY(irqcount); | 53 | ENTRY(irqcount); |
55 | DEFINE(pda_size, sizeof(struct x8664_pda)); | 54 | DEFINE(pda_size, sizeof(struct x8664_pda)); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b50e38d16888..06b6290088f4 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -889,6 +889,10 @@ DEFINE_PER_CPU(char *, irq_stack_ptr) = | |||
889 | per_cpu_var(irq_stack) + IRQ_STACK_SIZE - 64; | 889 | per_cpu_var(irq_stack) + IRQ_STACK_SIZE - 64; |
890 | #endif | 890 | #endif |
891 | 891 | ||
892 | DEFINE_PER_CPU(unsigned long, kernel_stack) = | ||
893 | (unsigned long)&init_thread_union - KERNEL_STACK_OFFSET + THREAD_SIZE; | ||
894 | EXPORT_PER_CPU_SYMBOL(kernel_stack); | ||
895 | |||
892 | void __cpuinit pda_init(int cpu) | 896 | void __cpuinit pda_init(int cpu) |
893 | { | 897 | { |
894 | struct x8664_pda *pda = cpu_pda(cpu); | 898 | struct x8664_pda *pda = cpu_pda(cpu); |
@@ -900,8 +904,6 @@ void __cpuinit pda_init(int cpu) | |||
900 | load_pda_offset(cpu); | 904 | load_pda_offset(cpu); |
901 | 905 | ||
902 | pda->irqcount = -1; | 906 | pda->irqcount = -1; |
903 | pda->kernelstack = (unsigned long)stack_thread_info() - | ||
904 | PDA_STACKOFFSET + THREAD_SIZE; | ||
905 | 907 | ||
906 | if (cpu != 0) { | 908 | if (cpu != 0) { |
907 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | 909 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index d22677a66438..0dd45859a7a8 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -468,7 +468,7 @@ END(ret_from_fork) | |||
468 | ENTRY(system_call) | 468 | ENTRY(system_call) |
469 | CFI_STARTPROC simple | 469 | CFI_STARTPROC simple |
470 | CFI_SIGNAL_FRAME | 470 | CFI_SIGNAL_FRAME |
471 | CFI_DEF_CFA rsp,PDA_STACKOFFSET | 471 | CFI_DEF_CFA rsp,KERNEL_STACK_OFFSET |
472 | CFI_REGISTER rip,rcx | 472 | CFI_REGISTER rip,rcx |
473 | /*CFI_REGISTER rflags,r11*/ | 473 | /*CFI_REGISTER rflags,r11*/ |
474 | SWAPGS_UNSAFE_STACK | 474 | SWAPGS_UNSAFE_STACK |
@@ -480,7 +480,7 @@ ENTRY(system_call) | |||
480 | ENTRY(system_call_after_swapgs) | 480 | ENTRY(system_call_after_swapgs) |
481 | 481 | ||
482 | movq %rsp,%gs:pda_oldrsp | 482 | movq %rsp,%gs:pda_oldrsp |
483 | movq %gs:pda_kernelstack,%rsp | 483 | movq PER_CPU_VAR(kernel_stack),%rsp |
484 | /* | 484 | /* |
485 | * No need to follow this irqs off/on section - it's straight | 485 | * No need to follow this irqs off/on section - it's straight |
486 | * and short: | 486 | * and short: |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index e00c31a4b3c0..6c5f57602108 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -620,9 +620,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
620 | write_pda(oldrsp, next->usersp); | 620 | write_pda(oldrsp, next->usersp); |
621 | percpu_write(current_task, next_p); | 621 | percpu_write(current_task, next_p); |
622 | 622 | ||
623 | write_pda(kernelstack, | 623 | percpu_write(kernel_stack, |
624 | (unsigned long)task_stack_page(next_p) + | 624 | (unsigned long)task_stack_page(next_p) + |
625 | THREAD_SIZE - PDA_STACKOFFSET); | 625 | THREAD_SIZE - KERNEL_STACK_OFFSET); |
626 | #ifdef CONFIG_CC_STACKPROTECTOR | 626 | #ifdef CONFIG_CC_STACKPROTECTOR |
627 | write_pda(stack_canary, next_p->stack_canary); | 627 | write_pda(stack_canary, next_p->stack_canary); |
628 | /* | 628 | /* |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 5854be0fb804..869b98840fd0 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -798,6 +798,9 @@ do_rest: | |||
798 | #else | 798 | #else |
799 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); | 799 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); |
800 | initial_gs = per_cpu_offset(cpu); | 800 | initial_gs = per_cpu_offset(cpu); |
801 | per_cpu(kernel_stack, cpu) = | ||
802 | (unsigned long)task_stack_page(c_idle.idle) - | ||
803 | KERNEL_STACK_OFFSET + THREAD_SIZE; | ||
801 | #endif | 804 | #endif |
802 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); | 805 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); |
803 | initial_code = (unsigned long)start_secondary; | 806 | initial_code = (unsigned long)start_secondary; |