timer: Warn when del_timer_sync() is called in hardirq context
authorYong Zhang <yong.zhang@windriver.com>
Wed, 20 Oct 2010 22:57:33 +0000 (15:57 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 22 Oct 2010 12:46:25 +0000 (14:46 +0200)
Add explict warning when del_timer_sync() is called in hardirq
context.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

kernel/timer.c

index 612de03..483e54b 100644 (file)
@@ -974,7 +974,11 @@ int del_timer_sync(struct timer_list *timer)
        lock_map_release(&timer->lockdep_map);
        local_bh_enable();
 #endif
-
+       /*
+        * don't use it in hardirq context, because it
+        * could lead to deadlock.
+        */
+       WARN_ON(in_irq());
        for (;;) {
                int ret = try_to_del_timer_sync(timer);
                if (ret >= 0)