x86/entry, locking/lockdep: Move lockdep_sys_exit() to prepare_exit_to_usermode()
authorAndy Lutomirski <luto@kernel.org>
Tue, 6 Oct 2015 00:47:54 +0000 (17:47 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 7 Oct 2015 09:34:07 +0000 (11:34 +0200)
Rather than worrying about exactly where LOCKDEP_SYS_EXIT should
go in the asm code, add it to prepare_exit_from_usermode() and
remove all of the asm calls that are followed by
prepare_exit_to_usermode().

LOCKDEP_SYS_EXIT now appears only in the syscall fast paths.

Signed-off-by: Andy 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/1736ebe948b845e68120b86b89091f3ec27f5e8e.1444091584.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/entry/common.c
arch/x86/entry/entry_32.S
arch/x86/entry/entry_64.S

index 80dcc9261ca31a41b9db930cfb66a9f07b5340d4..d94a60c160293577a5f9fd724159b7b756513769 100644 (file)
@@ -220,6 +220,8 @@ __visible void prepare_exit_to_usermode(struct pt_regs *regs)
        if (WARN_ON(!irqs_disabled()))
                local_irq_disable();
 
+       lockdep_sys_exit();
+
        /*
         * In order to return to user mode, we need to have IRQs off with
         * none of _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_USER_RETURN_NOTIFY,
index b2909bf8cf7029b17f6457edcd86b6e04395e94b..a08ded481aba7250b354e4b4c2d2f1db38bf6850 100644 (file)
@@ -255,7 +255,6 @@ ret_from_intr:
        jb      resume_kernel                   # not returning to v8086 or userspace
 
 ENTRY(resume_userspace)
-       LOCKDEP_SYS_EXIT
        DISABLE_INTERRUPTS(CLBR_ANY)
        TRACE_IRQS_OFF
        movl    %esp, %eax
@@ -372,7 +371,6 @@ syscall_call:
 syscall_after_call:
        movl    %eax, PT_EAX(%esp)              # store the return value
 syscall_exit:
-       LOCKDEP_SYS_EXIT
        jmp     syscall_exit_work
 
 restore_all:
index 055a01de7c8da6e052cfdebe0be8447b14933c87..7dc285036b6d45d111e9848b8002b5cacb9e5889 100644 (file)
@@ -557,7 +557,6 @@ ret_from_intr:
        jz      retint_kernel
 
        /* Interrupt came from user space */
-       LOCKDEP_SYS_EXIT_IRQ
 GLOBAL(retint_user)
        mov     %rsp,%rdi
        call    prepare_exit_to_usermode