[RFC PATCH 3/3] timer: warn when del_timer_sync() used in hardirq context

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yong Zhang
Date: Monday, August 23, 2010 - 11:58 pm

From: Yong Zhang <yong.zhang@windriver.com>

Add explict warning to prevent del_timer_sync() from using
in hardirq context.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
 kernel/timer.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index 08c9559..1bc4b4a 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -996,7 +996,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)
-- 
1.7.0.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC PATCH 3/3] timer: warn when del_timer_sync() used in ..., Yong Zhang, (Mon Aug 23, 11:58 pm)