Commit 8b13c255 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ingo Molnar

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: default avatarAndy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/22f34b1096694a37326f36c53407b8dd90f37948.1444091585.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 487e3bf4
...@@ -323,10 +323,10 @@ __visible void syscall_return_slowpath(struct pt_regs *regs) ...@@ -323,10 +323,10 @@ __visible void syscall_return_slowpath(struct pt_regs *regs)
#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
/* /*
* Does a 32-bit syscall. Called with IRQs off and does all entry and * Does a 32-bit syscall. Called with IRQs on and does all entry and
* exit work. * 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); struct thread_info *ti = pt_regs_to_thread_info(regs);
unsigned int nr = (unsigned int)regs->orig_ax; unsigned int nr = (unsigned int)regs->orig_ax;
...@@ -335,8 +335,6 @@ __visible void do_int80_syscall_32(struct pt_regs *regs) ...@@ -335,8 +335,6 @@ __visible void do_int80_syscall_32(struct pt_regs *regs)
ti->status |= TS_COMPAT; ti->status |= TS_COMPAT;
#endif #endif
local_irq_enable();
if (READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY) { if (READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY) {
/* /*
* Subtlety here: if ptrace pokes something larger than * Subtlety here: if ptrace pokes something larger than
...@@ -363,6 +361,13 @@ __visible void do_int80_syscall_32(struct pt_regs *regs) ...@@ -363,6 +361,13 @@ __visible void do_int80_syscall_32(struct pt_regs *regs)
syscall_return_slowpath(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. */ /* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
__visible long do_fast_syscall_32(struct pt_regs *regs) __visible long do_fast_syscall_32(struct pt_regs *regs)
{ {
...@@ -398,10 +403,9 @@ __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); prepare_exit_to_usermode(regs);
return 0; /* Keep it simple: use IRET. */ return 0; /* Keep it simple: use IRET. */
} }
local_irq_disable();
/* Now this is just like a normal syscall. */ /* Now this is just like a normal syscall. */
do_int80_syscall_32(regs); do_syscall_32_irqs_on(regs);
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment