From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932884AbbJINOo (ORCPT ); Fri, 9 Oct 2015 09:14:44 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46180 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932734AbbJINOm (ORCPT ); Fri, 9 Oct 2015 09:14:42 -0400 Date: Fri, 9 Oct 2015 06:13:45 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: mingo@kernel.org, brgerst@gmail.com, peterz@infradead.org, tglx@linutronix.de, luto@kernel.org, dvlasenk@redhat.com, luto@amacapital.net, linux-kernel@vger.kernel.org, bp@alien8.de, hpa@zytor.com, torvalds@linux-foundation.org Reply-To: dvlasenk@redhat.com, luto@amacapital.net, linux-kernel@vger.kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, bp@alien8.de, mingo@kernel.org, luto@kernel.org, tglx@linutronix.de, brgerst@gmail.com, peterz@infradead.org In-Reply-To: <22f34b1096694a37326f36c53407b8dd90f37948.1444091585.git.luto@kernel.org> References: <22f34b1096694a37326f36c53407b8dd90f37948.1444091585.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/entry: Remove unnecessary IRQ twiddling in fast 32-bit syscalls Git-Commit-ID: 8b13c2552ffc8e54e57598df36707183933e8e8c 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: 8b13c2552ffc8e54e57598df36707183933e8e8c Gitweb: http://git.kernel.org/tip/8b13c2552ffc8e54e57598df36707183933e8e8c Author: Andy Lutomirski AuthorDate: Mon, 5 Oct 2015 17:48:17 -0700 Committer: Ingo Molnar CommitDate: Fri, 9 Oct 2015 09:41:11 +0200 x86/entry: Remove unnecessary IRQ twiddling in fast 32-bit syscalls This is slightly messy, but it eliminates an unnecessary cli;sti pair. Signed-off-by: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/22f34b1096694a37326f36c53407b8dd90f37948.1444091585.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/entry/common.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 0ed023d..0d1c842 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -323,10 +323,10 @@ __visible void syscall_return_slowpath(struct pt_regs *regs) #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) /* - * Does a 32-bit syscall. Called with IRQs off and does all entry and - * exit work. + * Does a 32-bit syscall. Called with IRQs on and does all entry and + * exit work and returns with IRQs off. */ -__visible void do_int80_syscall_32(struct pt_regs *regs) +static void do_syscall_32_irqs_on(struct pt_regs *regs) { struct thread_info *ti = pt_regs_to_thread_info(regs); unsigned int nr = (unsigned int)regs->orig_ax; @@ -335,8 +335,6 @@ __visible void do_int80_syscall_32(struct pt_regs *regs) ti->status |= TS_COMPAT; #endif - local_irq_enable(); - if (READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY) { /* * Subtlety here: if ptrace pokes something larger than @@ -363,6 +361,13 @@ __visible void do_int80_syscall_32(struct pt_regs *regs) syscall_return_slowpath(regs); } +/* Handles int $0x80 */ +__visible void do_int80_syscall_32(struct pt_regs *regs) +{ + local_irq_enable(); + do_syscall_32_irqs_on(regs); +} + /* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */ __visible long do_fast_syscall_32(struct pt_regs *regs) { @@ -398,10 +403,9 @@ __visible long do_fast_syscall_32(struct pt_regs *regs) prepare_exit_to_usermode(regs); return 0; /* Keep it simple: use IRET. */ } - local_irq_disable(); /* Now this is just like a normal syscall. */ - do_int80_syscall_32(regs); + do_syscall_32_irqs_on(regs); #ifdef CONFIG_X86_64 /*