[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180722201211.GA30923@gmail.com>
Date: Sun, 22 Jul 2018 22:12:11 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Andy Lutomirski <luto@...nel.org>
Cc: x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [RFC 1/2] x86/entry/64: Use the TSS sp2 slot for rsp_scratch
* Andy Lutomirski <luto@...nel.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@...nel.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
Powered by blists - more mailing lists