x86/entry/32: Simplify debug entry point
authorJoerg Roedel <jroedel@suse.de>
Wed, 18 Jul 2018 09:40:48 +0000 (11:40 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 19 Jul 2018 23:11:39 +0000 (01:11 +0200)
The common exception entry code now handles the entry-from-sysenter stack
situation and makes sure to leave with the same stack as it entered the
kernel.

So there is no need anymore for the special handling in the debug entry
code.

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-12-git-send-email-joro@8bytes.org
arch/x86/entry/entry_32.S

index 9d6eceba0461ff819695c1e34ed31d3ed3ac020d..dbf7d619dcd63c48fa09605867d7542815e817d4 100644 (file)
@@ -1226,41 +1226,12 @@ END(common_exception)
 
 ENTRY(debug)
        /*
-        * #DB can happen at the first instruction of
-        * entry_SYSENTER_32 or in Xen's SYSENTER prologue.  If this
-        * happens, then we will be running on a very small stack.  We
-        * need to detect this condition and switch to the thread
-        * stack before calling any C code at all.
-        *
-        * If you edit this code, keep in mind that NMIs can happen in here.
+        * Entry from sysenter is now handled in common_exception
         */
        ASM_CLAC
        pushl   $-1                             # mark this as an int
-
-       SAVE_ALL
-       ENCODE_FRAME_POINTER
-       xorl    %edx, %edx                      # error code 0
-       movl    %esp, %eax                      # pt_regs pointer
-
-       /* Are we currently on the SYSENTER stack? */
-       movl    PER_CPU_VAR(cpu_entry_area), %ecx
-       addl    $CPU_ENTRY_AREA_entry_stack + SIZEOF_entry_stack, %ecx
-       subl    %eax, %ecx      /* ecx = (end of entry_stack) - esp */
-       cmpl    $SIZEOF_entry_stack, %ecx
-       jb      .Ldebug_from_sysenter_stack
-
-       TRACE_IRQS_OFF
-       call    do_debug
-       jmp     ret_from_exception
-
-.Ldebug_from_sysenter_stack:
-       /* We're on the SYSENTER stack.  Switch off. */
-       movl    %esp, %ebx
-       movl    PER_CPU_VAR(cpu_current_top_of_stack), %esp
-       TRACE_IRQS_OFF
-       call    do_debug
-       movl    %ebx, %esp
-       jmp     ret_from_exception
+       pushl   $do_debug
+       jmp     common_exception
 END(debug)
 
 /*