[PATCH 02/12] lockdep: i386: connect the sysexit hook

From: Peter Zijlstra
Date: Fri Sep 28 2007 - 04:04:22 EST


Run the lockdep_sys_exit hook after all other C code on the syscall
return path.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
arch/i386/kernel/entry.S | 3 +++
include/asm-i386/irqflags.h | 13 +++++++++++++
2 files changed, 16 insertions(+)

Index: linux-2.6/arch/i386/kernel/entry.S
===================================================================
--- linux-2.6.orig/arch/i386/kernel/entry.S
+++ linux-2.6/arch/i386/kernel/entry.S
@@ -338,6 +338,7 @@ sysenter_past_esp:
jae syscall_badsys
call *sys_call_table(,%eax,4)
movl %eax,PT_EAX(%esp)
+ LOCKDEP_SYS_EXIT
DISABLE_INTERRUPTS(CLBR_ANY)
TRACE_IRQS_OFF
movl TI_flags(%ebp), %ecx
@@ -376,6 +377,7 @@ ENTRY(system_call)
syscall_call:
call *sys_call_table(,%eax,4)
movl %eax,PT_EAX(%esp) # store the return value
+ LOCKDEP_SYS_EXIT
syscall_exit:
DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
# setting need_resched or sigpending
@@ -532,6 +534,7 @@ syscall_exit_work:
movl %esp, %eax
movl $1, %edx
call do_syscall_trace
+ LOCKDEP_SYS_EXIT
jmp resume_userspace
END(syscall_exit_work)
CFI_ENDPROC
Index: linux-2.6/include/asm-i386/irqflags.h
===================================================================
--- linux-2.6.orig/include/asm-i386/irqflags.h
+++ linux-2.6/include/asm-i386/irqflags.h
@@ -160,4 +160,17 @@ static inline int raw_irqs_disabled(void
# define TRACE_IRQS_OFF
#endif

+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+# define LOCKDEP_SYS_EXIT \
+ pushl %eax; \
+ pushl %ecx; \
+ pushl %edx; \
+ call lockdep_sys_exit; \
+ popl %edx; \
+ popl %ecx; \
+ popl %eax;
+#else
+# define LOCKDEP_SYS_EXIT
+#endif
+
#endif

--

-
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/