提交 10cd706d 编写于 作者: P Peter Zijlstra

lockdep: x86_64: connect the sysexit hook

Run the lockdep_sys_exit hook after all other C code on the syscall
return path.
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 c7e872e7
...@@ -244,6 +244,7 @@ ret_from_sys_call: ...@@ -244,6 +244,7 @@ ret_from_sys_call:
movl $_TIF_ALLWORK_MASK,%edi movl $_TIF_ALLWORK_MASK,%edi
/* edi: flagmask */ /* edi: flagmask */
sysret_check: sysret_check:
LOCKDEP_SYS_EXIT
GET_THREAD_INFO(%rcx) GET_THREAD_INFO(%rcx)
cli cli
TRACE_IRQS_OFF TRACE_IRQS_OFF
...@@ -333,6 +334,7 @@ int_ret_from_sys_call: ...@@ -333,6 +334,7 @@ int_ret_from_sys_call:
movl $_TIF_ALLWORK_MASK,%edi movl $_TIF_ALLWORK_MASK,%edi
/* edi: mask to check */ /* edi: mask to check */
int_with_check: int_with_check:
LOCKDEP_SYS_EXIT_IRQ
GET_THREAD_INFO(%rcx) GET_THREAD_INFO(%rcx)
movl threadinfo_flags(%rcx),%edx movl threadinfo_flags(%rcx),%edx
andl %edi,%edx andl %edi,%edx
...@@ -544,11 +546,13 @@ exit_intr: ...@@ -544,11 +546,13 @@ exit_intr:
retint_with_reschedule: retint_with_reschedule:
movl $_TIF_WORK_MASK,%edi movl $_TIF_WORK_MASK,%edi
retint_check: retint_check:
LOCKDEP_SYS_EXIT_IRQ
movl threadinfo_flags(%rcx),%edx movl threadinfo_flags(%rcx),%edx
andl %edi,%edx andl %edi,%edx
CFI_REMEMBER_STATE CFI_REMEMBER_STATE
jnz retint_careful jnz retint_careful
retint_swapgs:
retint_swapgs: /* return to user-space */
/* /*
* The iretq could re-enable interrupts: * The iretq could re-enable interrupts:
*/ */
...@@ -557,7 +561,7 @@ retint_swapgs: ...@@ -557,7 +561,7 @@ retint_swapgs:
swapgs swapgs
jmp restore_args jmp restore_args
retint_restore_args: retint_restore_args: /* return to kernel space */
cli cli
/* /*
* The iretq could re-enable interrupts: * The iretq could re-enable interrupts:
...@@ -866,26 +870,21 @@ error_sti: ...@@ -866,26 +870,21 @@ error_sti:
movq ORIG_RAX(%rsp),%rsi /* get error code */ movq ORIG_RAX(%rsp),%rsi /* get error code */
movq $-1,ORIG_RAX(%rsp) movq $-1,ORIG_RAX(%rsp)
call *%rax call *%rax
/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */ /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
error_exit: error_exit:
movl %ebx,%eax movl %ebx,%eax
RESTORE_REST RESTORE_REST
cli cli
TRACE_IRQS_OFF TRACE_IRQS_OFF
GET_THREAD_INFO(%rcx) GET_THREAD_INFO(%rcx)
testl %eax,%eax testl %eax,%eax
jne retint_kernel jne retint_kernel
LOCKDEP_SYS_EXIT_IRQ
movl threadinfo_flags(%rcx),%edx movl threadinfo_flags(%rcx),%edx
movl $_TIF_WORK_MASK,%edi movl $_TIF_WORK_MASK,%edi
andl %edi,%edx andl %edi,%edx
jnz retint_careful jnz retint_careful
/* jmp retint_swapgs
* The iret might restore flags:
*/
TRACE_IRQS_IRETQ
swapgs
RESTORE_ARGS 0,8,0
jmp iret_label
CFI_ENDPROC CFI_ENDPROC
error_kernelspace: error_kernelspace:
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
thunk trace_hardirqs_on_thunk,trace_hardirqs_on thunk trace_hardirqs_on_thunk,trace_hardirqs_on
thunk trace_hardirqs_off_thunk,trace_hardirqs_off thunk trace_hardirqs_off_thunk,trace_hardirqs_off
#endif #endif
#ifdef CONFIG_DEBUG_LOCK_ALLOC
thunk lockdep_sys_exit_thunk,lockdep_sys_exit
#endif
/* SAVE_ARGS below is used only for the .cfi directives it contains. */ /* SAVE_ARGS below is used only for the .cfi directives it contains. */
CFI_STARTPROC CFI_STARTPROC
......
...@@ -137,6 +137,20 @@ static inline void halt(void) ...@@ -137,6 +137,20 @@ static inline void halt(void)
# define TRACE_IRQS_ON # define TRACE_IRQS_ON
# define TRACE_IRQS_OFF # define TRACE_IRQS_OFF
# endif # endif
# ifdef CONFIG_DEBUG_LOCK_ALLOC
# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk
# define LOCKDEP_SYS_EXIT_IRQ \
TRACE_IRQS_ON; \
sti; \
SAVE_REST; \
LOCKDEP_SYS_EXIT; \
RESTORE_REST; \
cli; \
TRACE_IRQS_OFF;
# else
# define LOCKDEP_SYS_EXIT
# define LOCKDEP_SYS_EXIT_IRQ
# endif
#endif #endif
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册