lkml.org 
[lkml]   [2015]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86/entry/64: Remove duplicate syscall table for fast path
On Wed, Dec 9, 2015 at 5:02 AM, Brian Gerst <brgerst@gmail.com> wrote:
> Instead of using a duplicate syscall table for the fast path, create stubs for
> the syscalls that need pt_regs that save the extra registers if a flag for the
> slow path is not set.
>
> Signed-off-by: Brian Gerst <brgerst@gmail.com>
> To: Andy Lutomirski <luto@amacapital.net>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: the arch/x86 maintainers <x86@kernel.org>
> Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Frédéric Weisbecker <fweisbec@gmail.com>
> Cc: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> ---
>
> Applies on top of Andy's syscall cleanup series.

A couple questions:

> @@ -306,15 +306,37 @@ END(entry_SYSCALL_64)
>
> ENTRY(stub_ptregs_64)
> /*
> - * Syscalls marked as needing ptregs that go through the fast path
> - * land here. We transfer to the slow path.
> + * Syscalls marked as needing ptregs land here.
> + * If we are on the fast path, we need to save the extra regs.
> + * If we are on the slow path, the extra regs are already saved.
> */
> - DISABLE_INTERRUPTS(CLBR_NONE)
> - TRACE_IRQS_OFF
> - addq $8, %rsp
> - jmp entry_SYSCALL64_slow_path
> + movq PER_CPU_VAR(cpu_current_top_of_stack), %r10
> + testl $TS_SLOWPATH, ASM_THREAD_INFO(TI_status, %r10, 0)
> + jnz 1f

OK (but see below), but why not do:

addq $8, %rsp
jmp entry_SYSCALL64_slow_path

here instead of the stack munging below?

> + subq $SIZEOF_PTREGS, %r10
> + SAVE_EXTRA_REGS base=r10
> + movq %r10, %rbx
> + call *%rax
> + movq %rbx, %r10
> + RESTORE_EXTRA_REGS base=r10
> + ret
> +1:
> + jmp *%rax
> END(stub_ptregs_64)

Also, can we not get away with keying off rip or rsp instead of
ti->status? That should be faster and less magical IMO.

--Andy


\
 
 \ /
  Last update: 2015-12-09 20:01    [W:0.084 / U:1.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site