From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755645AbdKBK4I (ORCPT ); Thu, 2 Nov 2017 06:56:08 -0400 Received: from terminus.zytor.com ([65.50.211.136]:48289 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbdKBK4G (ORCPT ); Thu, 2 Nov 2017 06:56:06 -0400 Date: Thu, 2 Nov 2017 03:51:32 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: dave.hansen@intel.com, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, luto@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, bpetkov@suse.de, brgerst@gmail.com Reply-To: bpetkov@suse.de, brgerst@gmail.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, dave.hansen@intel.com In-Reply-To: <1204e20233fcab9130a1ba80b3b1879b5db3fc1f.1509609304.git.luto@kernel.org> References: <1204e20233fcab9130a1ba80b3b1879b5db3fc1f.1509609304.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/entry/64: Merge the fast and slow SYSRET paths Git-Commit-ID: a512210643da8082cb44181dba8b18e752bd68f0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a512210643da8082cb44181dba8b18e752bd68f0 Gitweb: https://git.kernel.org/tip/a512210643da8082cb44181dba8b18e752bd68f0 Author: Andy Lutomirski AuthorDate: Thu, 2 Nov 2017 00:59:04 -0700 Committer: Ingo Molnar CommitDate: Thu, 2 Nov 2017 11:04:40 +0100 x86/entry/64: Merge the fast and slow SYSRET paths 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 Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1204e20233fcab9130a1ba80b3b1879b5db3fc1f.1509609304.git.luto@kernel.org Signed-off-by: Ingo Molnar --- 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 4f9b446..b5a0ea6 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: /* @@ -317,6 +316,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