Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755382AbbHYQ7O (ORCPT ); Tue, 25 Aug 2015 12:59:14 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:33652 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632AbbHYQ7M (ORCPT ); Tue, 25 Aug 2015 12:59:12 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 25 Aug 2015 09:59:10 -0700 X-Google-Sender-Auth: LaLeARge83oI0DndurcGUnn_Gu8 Message-ID: Subject: Re: Proposal for finishing the 64-bit x86 syscall cleanup From: Linus Torvalds To: Andy Lutomirski Cc: Brian Gerst , X86 ML , Denys Vlasenko , Borislav Petkov , "linux-kernel@vger.kernel.org" , Jan Beulich Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1463 Lines: 34 On Tue, Aug 25, 2015 at 9:28 AM, Andy Lutomirski wrote: > > I bet that, with a bit of tweaking, that would actually end up faster > than what we do right now for everything except fully fast-path > syscalls. This would also be a *huge* sanity improvement for the > compat case in which the args are currently jumbled in asm. It would > become: > > if (nr < max) > call the syscall(regs->bx, regs->cx, regs->dx, ...); > > which completely avoids the unreadable and probably buggy mess we have now. I'm willing to try it. Just pass in the system call number and the regs pointer as the arguments, and keep the asm portion as the minimal "save regs, call function, restore regs, return" sequence with absolutely nothing else going on. The main cost would be a few more push/pop instructions, and then the loads from the stack frame in the C function. Go for it. The system calls where the extra five cycles might be noticeable are all irrelevant anyway (ie "getppid()" etc). They aren't actually performance-critical, even if they may be used for benchmarks. But please do make it be very tight push/pop sequences, not those crazy "movq %reg,%off(%rsp)" things. Linus -- 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/