Skip to content

Commit 0d2eb73

Browse files
joergroedelKAGA-KOKO
authored andcommitted
x86/entry/32: Split off return-to-kernel path
Use a separate return path when returning to the kernel. This allows to put the PTI cr3-switch and the switch to the entry-stack into the return-to-user path without further checking. Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Pavel Machek <pavel@ucw.cz> Cc: "H . Peter Anvin" <hpa@zytor.com> Cc: linux-mm@kvack.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Brian Gerst <brgerst@gmail.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Waiman Long <llong@redhat.com> Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca> Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1531906876-13451-7-git-send-email-joro@8bytes.org
1 parent 8e676ce commit 0d2eb73

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

arch/x86/entry/entry_32.S

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
# define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
6666
#else
6767
# define preempt_stop(clobbers)
68-
# define resume_kernel restore_all
68+
# define resume_kernel restore_all_kernel
6969
#endif
7070

7171
.macro TRACE_IRQS_IRET
@@ -399,9 +399,9 @@ ENTRY(resume_kernel)
399399
DISABLE_INTERRUPTS(CLBR_ANY)
400400
.Lneed_resched:
401401
cmpl $0, PER_CPU_VAR(__preempt_count)
402-
jnz restore_all
402+
jnz restore_all_kernel
403403
testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ?
404-
jz restore_all
404+
jz restore_all_kernel
405405
call preempt_schedule_irq
406406
jmp .Lneed_resched
407407
END(resume_kernel)
@@ -606,6 +606,11 @@ restore_all:
606606
*/
607607
INTERRUPT_RETURN
608608

609+
restore_all_kernel:
610+
TRACE_IRQS_IRET
611+
RESTORE_REGS 4
612+
jmp .Lirq_return
613+
609614
.section .fixup, "ax"
610615
ENTRY(iret_exc )
611616
pushl $0 # no error code

0 commit comments

Comments
 (0)