[PATCH 5/5] x86/asm/entry/64: drop exit_intr label

From: Denys Vlasenko
Date: Mon Mar 30 2015 - 14:11:12 EST


At this label, we test whether interrupt/exception was in kernel.
If it did, we jump to preemption check. If preemption does happen
(IOW if we call preempt_schedule_irq), we go back to exit_intr.

But it's pointless, we already know that test succeeded last time,
preemption doesn't change the fact that interrupt/exception
was in kernel. We can go back directly to checking
PER_CPU_VAR(__preempt_count) instead.

This makes exit_intr label unused. Dropping it.

While at it, tidy up TEST insn width to use shorter insn form,
use logically correct JZ mnemonic instead of JE (this doesn't change code),
use X86_EFLAGS_IF_BIT instead of literal 9.

Signed-off-by: Denys Vlasenko <dvlasenk@xxxxxxxxxx>
CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
CC: Steven Rostedt <rostedt@xxxxxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxxxxx>
CC: Borislav Petkov <bp@xxxxxxxxx>
CC: "H. Peter Anvin" <hpa@xxxxxxxxx>
CC: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
CC: Oleg Nesterov <oleg@xxxxxxxxxx>
CC: Frederic Weisbecker <fweisbec@xxxxxxxxx>
CC: Alexei Starovoitov <ast@xxxxxxxxxxxx>
CC: Will Drewry <wad@xxxxxxxxxxxx>
CC: Kees Cook <keescook@xxxxxxxxxxxx>
CC: x86@xxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
---
arch/x86/kernel/entry_64.S | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 16bf357..bc90f63 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -653,9 +653,8 @@ ret_from_intr:
CFI_DEF_CFA_REGISTER rsp
CFI_ADJUST_CFA_OFFSET RBP

-exit_intr:
- testl $3,CS(%rsp)
- je retint_kernel
+ testb $3,CS(%rsp)
+ jz retint_kernel
/* Interrupt came from user space */

GET_THREAD_INFO(%rcx)
@@ -740,12 +739,12 @@ retint_kernel:
#ifdef CONFIG_PREEMPT
/* Interrupts are off */
/* Check if we need preemption */
- cmpl $0,PER_CPU_VAR(__preempt_count)
- jnz 1f
- bt $9,EFLAGS(%rsp) /* interrupts were off? */
+ bt $X86_EFLAGS_IF_BIT,EFLAGS(%rsp) /* interrupts were off? */
jnc 1f
+0: cmpl $0,PER_CPU_VAR(__preempt_count)
+ jnz 1f
call preempt_schedule_irq
- jmp exit_intr
+ jmp 0b
1:
#endif
/*
--
1.8.1.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/