Received: by 10.223.164.221 with SMTP id h29csp1101931wrb; Wed, 1 Nov 2017 10:27:35 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QMi1GXgJAx0r52Aa2GIAZzt+iO5a1semjZm3lGqhnfN9KNJqexWlH3G4UrirW60mRx2/Pn X-Received: by 10.99.185.79 with SMTP id v15mr624400pgo.258.1509557254943; Wed, 01 Nov 2017 10:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509557254; cv=none; d=google.com; s=arc-20160816; b=ESCe5Ry3MuThkODHDYZWl+qR5pTXLKb0DdxszaV7a5+AGQ+TGyQRWKfYnRQ8Fw1mFk coML9NmIpBLxuZeG5lLk3T6OQg5/tO/ezJevINdGCLA3HmAAf0ATQdnE1qYmDtU/2P+z mdrvMUfREQLJ5Asd/8cXGkDbrjfr4c65vhBgp6LwNXE7J75wX9rKgkf5KvZpCwzBZQUU 4kdcgwGjlWDtHs3msMu02bozgnDdJ8bLS+oKRcvF0a9KtxcVJ5MSWwKPS01VfaJyrA8/ Cmwd87/EeFBv4IW7IUvY/snoccy7W2d7RCnRyBqzVcTJbVgqlbrzPyDxKUvyTHmGs2ei gBpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=eF/dEFyBAp4yvFqGeAv2/s65bXRbLsbYL1QQgYyQfV4=; b=NxYCM9J+GeXBw8MJH6X3SDv+xbXyjUUj8vo3aiXObNqY4TDLaPTUfBoA7nWameXeTH CYyIszz7ZPjxm6DTAzGMcdy84hoQrU9uQwKaBfqpNHeb1XDkuhpmIYfC+BvaGpQ9dz4N o0rdAkix+yYWeH3AwwhevjBz5qHOHMa/7whnWfinT4YJEA9JWa8eYHQjDMdri00ZmFx9 +dxXUXoEmFplBmuc/rMAbHpCzdM/WtUoGmMxZKaLzNNkJZz3uAPR3aJ1JI/c+XqQuJDs ghweRoI0UNTtBlIcf4iWZnFJqvKtDF9/VAYnTUCfeuVM8Ip2fs9Vs60rNth5+9n2oMWT 9Rsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JIQrevdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r79si1518626pfa.337.2017.11.01.10.27.21; Wed, 01 Nov 2017 10:27:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JIQrevdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755013AbdKARZZ (ORCPT + 99 others); Wed, 1 Nov 2017 13:25:25 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:49225 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347AbdKARZX (ORCPT ); Wed, 1 Nov 2017 13:25:23 -0400 Received: by mail-io0-f196.google.com with SMTP id n137so7670738iod.6 for ; Wed, 01 Nov 2017 10:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eF/dEFyBAp4yvFqGeAv2/s65bXRbLsbYL1QQgYyQfV4=; b=JIQrevdwFVWGp0wNDp2aMTJv8ldvl6lEQfxOPqmxk7ke0k17/deHSZKYHyZj1xokwi O2BtdZ82aNfof1zbPwkFC8qqZ8MIw2eRYjoqgc6ZxgHKw+Djki7frHsWaAahm48qcB5C rVGOYJ9f9Sh5Ds0wqY3ywdHfb0fsv/Q3ePCTwYyU2v0zIHOiWDy3ZFKzkx8m9G3nzHqQ 9mDpNrvZ6+7zY3iuGkJYZ2uXBSIISL0j35Dqg9j8Y/VemKJOVGm1cCUcbL2SUBkLxfbi vyuHqL0piUwlkzewcM4D2BF7nL4ACsOXBPbLxD5Bv9o3/r0oGw5nQ2+Olwpfx0r81N31 ES9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eF/dEFyBAp4yvFqGeAv2/s65bXRbLsbYL1QQgYyQfV4=; b=PKvc8jRe1l5J1JTt2eK1kaVRdhXOHUMzVva/Ay6+SWUur26GXWJ2LfYdNVLSFYtDlc k7E50e4gCwKYThF5FqboDFVgxxY93bQwoBqp6sJ978BXni8t0V1Z70szyw252ZVU3BrI Jszx9OOGmqrlI9CxKHPyd1SCWloaWY2eZX1NR8DGbXJxwadTpetEOq3z9uGmgQVPrkoS GzVZA//RER+EuXUveKe96qRp8DdvPxlS1P9Ae28SoCv2sUPSTxMB0RA5LW03dTmqPZSf XDkz0oEY2N2L/AinbmC6FOQESwAQ6YSqa1aYirLydiONxJVf2Yp4qMov0hXR9j0fMv6X loEw== X-Gm-Message-State: AMCzsaXXfUZYwZyWE6e2BauYDXf1nV2NLqWNYUkyeZWbqIJRH1aD03lO sK/94rC5A4vMtYSmDmrXO+baZw7uGDmGqn4s6w== X-Received: by 10.107.20.209 with SMTP id 200mr720084iou.219.1509557123144; Wed, 01 Nov 2017 10:25:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.141.56 with HTTP; Wed, 1 Nov 2017 10:25:22 -0700 (PDT) In-Reply-To: <998a8c2c39546115f93e4c6e2ad7f918626f6145.1509006199.git.luto@kernel.org> References: <998a8c2c39546115f93e4c6e2ad7f918626f6145.1509006199.git.luto@kernel.org> From: Brian Gerst Date: Wed, 1 Nov 2017 13:25:22 -0400 Message-ID: Subject: Re: [PATCH 07/18] x86/asm/64: Merge the fast and slow SYSRET paths To: Andy Lutomirski Cc: X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Dave Hansen , Linus Torvalds Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 26, 2017 at 4:26 AM, Andy Lutomirski wrote: > They did almost the same thing. Remove a bunch of pointless > instructions (mostly hidden in macros) and reduce cognitive load by > merging them. > > Signed-off-by: Andy Lutomirski > --- > arch/x86/entry/entry_64.S | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > index 9dafafa3e0ec..c855ee91a3a5 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -220,10 +220,9 @@ entry_SYSCALL_64_fastpath: > TRACE_IRQS_ON /* user mode is traced as IRQs on */ > movq RIP(%rsp), %rcx > movq EFLAGS(%rsp), %r11 > - RESTORE_C_REGS_EXCEPT_RCX_R11 > - movq RSP(%rsp), %rsp > + addq $6*8, %rsp /* skip extra regs -- they were preserved */ > UNWIND_HINT_EMPTY > - USERGS_SYSRET64 > + jmp .Lpop_c_regs_except_rcx_r11_and_sysret > > 1: > /* > @@ -315,6 +314,7 @@ syscall_return_via_sysret: > /* rcx and r11 are already restored (see code above) */ > UNWIND_HINT_EMPTY > POP_EXTRA_REGS > +.Lpop_c_regs_except_rcx_r11_and_sysret: > popq %rsi /* skip r11 */ > popq %r10 > popq %r9 Wouldn't it be more logical to keep the SYSRET path at the end of the fast path (reverse of what you are doing here)? That way the fast path falls through without jumping. -- Brian Gerst From 1582867162831366043@xxx Wed Nov 01 12:35:59 +0000 2017 X-GM-THRID: 1582308295795346120 X-Gmail-Labels: Inbox,Category Forums