aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2017-11-02 03:59:14 -0400
committerIngo Molnar <mingo@kernel.org>2017-11-02 06:04:47 -0400
commit46f5a10a721ce8dce8cc8fe55279b49e1c6b3288 (patch)
tree4e6ca348b4ec0a7033f268399a1df3cb44b58c6b
parent20bb83443ea79087b5e5f8dab4e9d80bb9bf7acb (diff)
x86/entry/64: Remove all remaining direct thread_struct::sp0 reads
The only remaining readers in context switch code or vm86(), and they all just want to update TSS.sp0 to match the current task. Replace them all with a new helper update_sp0(). Signed-off-by: Andy Lutomirski <luto@kernel.org> Reviewed-by: Borislav Petkov <bp@suse.de> Cc: Borislav Petkov <bpetkov@suse.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/2d231687f4ff288c9d9e98d7861b7df374246ac3.1509609304.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/switch_to.h6
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/vm86_32.c4
4 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h
index 7ae8caffbada..54e64d909725 100644
--- a/arch/x86/include/asm/switch_to.h
+++ b/arch/x86/include/asm/switch_to.h
@@ -84,4 +84,10 @@ static inline void refresh_sysenter_cs(struct thread_struct *thread)
84} 84}
85#endif 85#endif
86 86
87/* This is used when switching tasks or entering/exiting vm86 mode. */
88static inline void update_sp0(struct task_struct *task)
89{
90 load_sp0(task->thread.sp0);
91}
92
87#endif /* _ASM_X86_SWITCH_TO_H */ 93#endif /* _ASM_X86_SWITCH_TO_H */
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 40b85870e429..45bf0c5f93e1 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -287,7 +287,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
287 * current_thread_info(). Refresh the SYSENTER configuration in 287 * current_thread_info(). Refresh the SYSENTER configuration in
288 * case prev or next is vm86. 288 * case prev or next is vm86.
289 */ 289 */
290 load_sp0(next->sp0); 290 update_sp0(next_p);
291 refresh_sysenter_cs(next); 291 refresh_sysenter_cs(next);
292 this_cpu_write(cpu_current_top_of_stack, 292 this_cpu_write(cpu_current_top_of_stack,
293 (unsigned long)task_stack_page(next_p) + 293 (unsigned long)task_stack_page(next_p) +
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 2124304fb77a..45e380958392 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -465,7 +465,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
465 this_cpu_write(current_task, next_p); 465 this_cpu_write(current_task, next_p);
466 466
467 /* Reload sp0. */ 467 /* Reload sp0. */
468 load_sp0(next->sp0); 468 update_sp0(next_p);
469 469
470 /* 470 /*
471 * Now maybe reload the debug registers and handle I/O bitmaps 471 * Now maybe reload the debug registers and handle I/O bitmaps
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index 0f1d92cd20ad..a7b44c75c642 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -148,7 +148,7 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
148 preempt_disable(); 148 preempt_disable();
149 tsk->thread.sp0 = vm86->saved_sp0; 149 tsk->thread.sp0 = vm86->saved_sp0;
150 tsk->thread.sysenter_cs = __KERNEL_CS; 150 tsk->thread.sysenter_cs = __KERNEL_CS;
151 load_sp0(tsk->thread.sp0); 151 update_sp0(tsk);
152 refresh_sysenter_cs(&tsk->thread); 152 refresh_sysenter_cs(&tsk->thread);
153 vm86->saved_sp0 = 0; 153 vm86->saved_sp0 = 0;
154 preempt_enable(); 154 preempt_enable();
@@ -373,7 +373,7 @@ static long do_sys_vm86(struct vm86plus_struct __user *user_vm86, bool plus)
373 refresh_sysenter_cs(&tsk->thread); 373 refresh_sysenter_cs(&tsk->thread);
374 } 374 }
375 375
376 load_sp0(tsk->thread.sp0); 376 update_sp0(tsk);
377 preempt_enable(); 377 preempt_enable();
378 378
379 if (vm86->flags & VM86_SCREEN_BITMAP) 379 if (vm86->flags & VM86_SCREEN_BITMAP)