The patch titled debug workqueue locking sanity has been added to the -mm tree. Its filename is debug-workqueue-locking-sanity-v2.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: debug workqueue locking sanity From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Workqueue functions should not leak locks, assert so, printing the last function ran. Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Acked-by: Ingo Molnar <mingo@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/linux/lockdep.h | 11 +++++++++++ kernel/workqueue.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff -puN include/linux/lockdep.h~debug-workqueue-locking-sanity-v2 include/linux/lockdep.h --- a/include/linux/lockdep.h~debug-workqueue-locking-sanity-v2 +++ a/include/linux/lockdep.h @@ -243,6 +243,11 @@ extern void lock_release(struct lockdep_ # define INIT_LOCKDEP .lockdep_recursion = 0, +static inline int lockdep_depth(struct task *tsk) +{ + return tsk->lockdep_depth; +} + #else /* !LOCKDEP */ static inline void lockdep_off(void) @@ -277,6 +282,12 @@ static inline int lockdep_internal(void) * The class key takes no space if lockdep is disabled: */ struct lock_class_key { }; + +static inline int lockdep_depth(struct task *tsk) +{ + return 0; +} + #endif /* !LOCKDEP */ #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) diff -puN kernel/workqueue.c~debug-workqueue-locking-sanity-v2 kernel/workqueue.c --- a/kernel/workqueue.c~debug-workqueue-locking-sanity-v2 +++ a/kernel/workqueue.c @@ -29,6 +29,7 @@ #include <linux/kthread.h> #include <linux/hardirq.h> #include <linux/mempolicy.h> +#include <linux/kallsyms.h> /* * The per-CPU workqueue (if single thread, we always use the first @@ -222,6 +223,17 @@ static void run_workqueue(struct cpu_wor clear_bit(0, &work->pending); f(data); + if (unlikely(in_atomic() || lockdep_depth(current) > 0)) { + printk(KERN_ERR "BUG: workqueue leaked lock or atomic: " + "%s/0x%08x/%d\n", + current->comm, preempt_count(), + current->pid); + printk(KERN_ERR " last function: "); + print_symbol("%s\n", (unsigned long)f); + debug_show_held_locks(current); + dump_stack(); + } + spin_lock_irqsave(&cwq->lock, flags); cwq->remove_sequence++; wake_up(&cwq->work_done); _ Patches currently in -mm which might be from a.p.zijlstra@xxxxxxxxx are origin.patch lockdep-fix-delayacct-locking-bug.patch sunrpc-add-missing-spin_unlock.patch bonding-lockdep-annotation.patch lockdep-annotate-sk_lock-nesting-in-af_bluetooth-v2.patch grab-swap-token-reordered.patch new-scheme-to-preempt-swap-token.patch new-scheme-to-preempt-swap-token-tidy.patch mm-arch-do_page_fault-vs-in_atomic.patch mm-pagefault_disableenable.patch mm-pagefault_disableenable-s390-fix.patch mm-kummap_atomic-vs-in_atomic.patch lockdep-annotate-nfs-nfsd-in-kernel-sockets.patch lockdep-annotate-nfs-nfsd-in-kernel-sockets-tidy.patch lockdep-fix-ide-proc-interaction.patch lockdep-spin_lock_irqsave_nested.patch lockdep-spin_lock_irqsave_nested-fix.patch lockdep-spin_lock_irqsave_nested-fix-2.patch lockdep-annotate-bcsp-driver.patch lockdep-print-current-locks-on-in_atomic-warnings.patch lockdep-name-some-old-style-locks.patch debug-workqueue-locking-sanity-v2.patch tty-signal-tty-locking.patch tty-signal-tty-locking-3270-fix.patch do_task_stat-dont-take-tty_mutex.patch do_acct_process-dont-take-tty_mutex.patch sys_unshare-remove-a-broken-clone_sighand-code.patch remove-the-old-bd_mutex-lockdep-annotation.patch new-bd_mutex-lockdep-annotation.patch remove-lock_key-approach-to-managing-nested-bd_mutex-locks.patch simplify-some-aspects-of-bd_mutex-nesting.patch use-mutex_lock_nested-for-bd_mutex-to-avoid-lockdep-warning.patch avoid-lockdep-warning-in-md.patch bdev-fix-bd_part_count-leak.patch lockdep-annotate-nfsd4-recover-code.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html