diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2015-04-24 11:31:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-05-08 07:43:52 -0400 |
commit | 63332a8455d8310b77d38779c6c21a660a8d9feb (patch) | |
tree | 81919d8f8aac70e8ccc7ced0d8f042a472e6969a | |
parent | e22438f8e997ac1c8911d8808b6a4c492cd8bc6e (diff) |
x86/entry: Stop using PER_CPU_VAR(kernel_stack)
PER_CPU_VAR(kernel_stack) is redundant:
- On the 64-bit build, we can use PER_CPU_VAR(cpu_tss + TSS_sp0).
- On the 32-bit build, we can use PER_CPU_VAR(cpu_current_top_of_stack).
PER_CPU_VAR(kernel_stack) will be deleted by a separate change.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1429889495-27850-1-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/thread_info.h | 8 | ||||
-rw-r--r-- | arch/x86/kernel/entry_64.S | 2 | ||||
-rw-r--r-- | arch/x86/xen/xen-asm_64.S | 5 |
4 files changed, 12 insertions, 5 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 2ab0f7182df3..1b1330c07971 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -346,7 +346,7 @@ ENTRY(ia32_cstar_target) | |||
346 | SWAPGS_UNSAFE_STACK | 346 | SWAPGS_UNSAFE_STACK |
347 | movl %esp,%r8d | 347 | movl %esp,%r8d |
348 | CFI_REGISTER rsp,r8 | 348 | CFI_REGISTER rsp,r8 |
349 | movq PER_CPU_VAR(kernel_stack),%rsp | 349 | movq PER_CPU_VAR(cpu_tss + TSS_sp0),%rsp |
350 | ENABLE_INTERRUPTS(CLBR_NONE) | 350 | ENABLE_INTERRUPTS(CLBR_NONE) |
351 | 351 | ||
352 | /* Zero-extending 32-bit regs, do not remove */ | 352 | /* Zero-extending 32-bit regs, do not remove */ |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index b4bdec3e9523..d656a363e1eb 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -198,9 +198,15 @@ static inline unsigned long current_stack_pointer(void) | |||
198 | #else /* !__ASSEMBLY__ */ | 198 | #else /* !__ASSEMBLY__ */ |
199 | 199 | ||
200 | /* Load thread_info address into "reg" */ | 200 | /* Load thread_info address into "reg" */ |
201 | #ifdef CONFIG_X86_32 | ||
201 | #define GET_THREAD_INFO(reg) \ | 202 | #define GET_THREAD_INFO(reg) \ |
202 | _ASM_MOV PER_CPU_VAR(kernel_stack),reg ; \ | 203 | _ASM_MOV PER_CPU_VAR(cpu_current_top_of_stack),reg ; \ |
203 | _ASM_SUB $(THREAD_SIZE),reg ; | 204 | _ASM_SUB $(THREAD_SIZE),reg ; |
205 | #else | ||
206 | #define GET_THREAD_INFO(reg) \ | ||
207 | _ASM_MOV PER_CPU_VAR(cpu_tss + TSS_sp0),reg ; \ | ||
208 | _ASM_SUB $(THREAD_SIZE),reg ; | ||
209 | #endif | ||
204 | 210 | ||
205 | /* | 211 | /* |
206 | * ASM operand which evaluates to a 'thread_info' address of | 212 | * ASM operand which evaluates to a 'thread_info' address of |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 7423e3e2f5c5..c13b86b40176 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -216,7 +216,7 @@ ENTRY(system_call) | |||
216 | GLOBAL(system_call_after_swapgs) | 216 | GLOBAL(system_call_after_swapgs) |
217 | 217 | ||
218 | movq %rsp,PER_CPU_VAR(rsp_scratch) | 218 | movq %rsp,PER_CPU_VAR(rsp_scratch) |
219 | movq PER_CPU_VAR(kernel_stack),%rsp | 219 | movq PER_CPU_VAR(cpu_tss + TSS_sp0),%rsp |
220 | 220 | ||
221 | /* Construct struct pt_regs on stack */ | 221 | /* Construct struct pt_regs on stack */ |
222 | pushq_cfi $__USER_DS /* pt_regs->ss */ | 222 | pushq_cfi $__USER_DS /* pt_regs->ss */ |
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S index a2cabb8bd6bf..5aa7ec607b9e 100644 --- a/arch/x86/xen/xen-asm_64.S +++ b/arch/x86/xen/xen-asm_64.S | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/percpu.h> | 15 | #include <asm/percpu.h> |
16 | #include <asm/processor-flags.h> | 16 | #include <asm/processor-flags.h> |
17 | #include <asm/segment.h> | 17 | #include <asm/segment.h> |
18 | #include <asm/asm-offsets.h> | ||
18 | 19 | ||
19 | #include <xen/interface/xen.h> | 20 | #include <xen/interface/xen.h> |
20 | 21 | ||
@@ -53,7 +54,7 @@ ENTRY(xen_sysret64) | |||
53 | * still with the kernel gs, so we can easily switch back | 54 | * still with the kernel gs, so we can easily switch back |
54 | */ | 55 | */ |
55 | movq %rsp, PER_CPU_VAR(rsp_scratch) | 56 | movq %rsp, PER_CPU_VAR(rsp_scratch) |
56 | movq PER_CPU_VAR(kernel_stack), %rsp | 57 | movq PER_CPU_VAR(cpu_tss + TSS_sp0), %rsp |
57 | 58 | ||
58 | pushq $__USER_DS | 59 | pushq $__USER_DS |
59 | pushq PER_CPU_VAR(rsp_scratch) | 60 | pushq PER_CPU_VAR(rsp_scratch) |
@@ -72,7 +73,7 @@ ENTRY(xen_sysret32) | |||
72 | * still with the kernel gs, so we can easily switch back | 73 | * still with the kernel gs, so we can easily switch back |
73 | */ | 74 | */ |
74 | movq %rsp, PER_CPU_VAR(rsp_scratch) | 75 | movq %rsp, PER_CPU_VAR(rsp_scratch) |
75 | movq PER_CPU_VAR(kernel_stack), %rsp | 76 | movq PER_CPU_VAR(cpu_tss + TSS_sp0), %rsp |
76 | 77 | ||
77 | pushq $__USER32_DS | 78 | pushq $__USER32_DS |
78 | pushq PER_CPU_VAR(rsp_scratch) | 79 | pushq PER_CPU_VAR(rsp_scratch) |