lkml.org 
[lkml]   [2018]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 1/2] x86/entry/64: Use the TSS sp2 slot for rsp_scratch

* Andy Lutomirski <luto@kernel.org> wrote:

> In the non-trampoline SYSCALL64 path, we use a percpu variable to
> temporarily store the user RSP value. Instead of a separate
> variable, use the otherwise unused sp2 slot in the TSS. This will
> improve cache locality, as the sp1 slot is already used in the same
> code to find the kernel stack. It will also simplify a future
> change to make the non-trampoline path work in PTI mode.
>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> ---
> arch/x86/include/asm/processor.h | 5 +++++
> arch/x86/include/asm/thread_info.h | 1 +
> arch/x86/kernel/asm-offsets_64.c | 1 +
> arch/x86/kernel/process_64.c | 2 --
> 4 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index cfd29ee8c3da..2ef4c39ded45 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -308,7 +308,12 @@ struct x86_hw_tss {
> */
> u64 sp1;
>
> + /*
> + * sp2 is scratch space used by the SYSCALL64 handler. Linux does
> + * not use rung 2, so sp2 is not otherwise needed.
> + */
> u64 sp2;

s/rung/ring

Thanks,

Ingo

\
 
 \ /
  Last update: 2018-07-22 22:20    [W:0.107 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site