Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbbLISyR (ORCPT ); Wed, 9 Dec 2015 13:54:17 -0500 Received: from mail-oi0-f53.google.com ([209.85.218.53]:33732 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbbLISyP convert rfc822-to-8bit (ORCPT ); Wed, 9 Dec 2015 13:54:15 -0500 MIME-Version: 1.0 In-Reply-To: <1449666173-15366-1-git-send-email-brgerst@gmail.com> References: <1449666173-15366-1-git-send-email-brgerst@gmail.com> From: Andy Lutomirski Date: Wed, 9 Dec 2015 10:53:55 -0800 Message-ID: Subject: Re: [PATCH] x86/entry/64: Remove duplicate syscall table for fast path To: Brian Gerst Cc: Andy Lutomirski , "the arch/x86 maintainers" , Linux Kernel Mailing List , Borislav Petkov , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Denys Vlasenko , Linus Torvalds Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2252 Lines: 65 On Wed, Dec 9, 2015 at 5:02 AM, Brian Gerst 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 > To: Andy Lutomirski > Cc: Andy Lutomirski > Cc: the arch/x86 maintainers > Cc: Linux Kernel Mailing List > Cc: Borislav Petkov > Cc: Frédéric Weisbecker > Cc: Denys Vlasenko > Cc: Linus Torvalds > --- > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/