[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] deadlock over timerlist_lock


One can't do a printk() with timerlist_lock held.  This is
because the console code does a mod_timer(), which
acquires timerlist_lock.


--- linux-2.4.0-test7-pre5/kernel/timer.c	Fri Aug 11 19:06:13 2000
+++ linux-akpm/kernel/timer.c	Sun Aug 20 22:50:26 2000
@@ -180,17 +180,15 @@
 	unsigned long flags;
 
 	spin_lock_irqsave(&timerlist_lock, flags);
-	if (timer->list.next)
+	if (timer_pending(timer))
 		goto bug;
 	internal_add_timer(timer);
-out:
 	spin_unlock_irqrestore(&timerlist_lock, flags);
 	return;
-
 bug:
+	spin_unlock_irqrestore(&timerlist_lock, flags);
 	printk("bug: kernel timer added twice at %p.\n",
 			__builtin_return_address(0));
-	goto out;
 }
 
 static inline int detach_timer (struct timer_list *timer)


BTW: this implies that the NMI oopser should bust
timerlist_lock as well as console_lock.  Also,
the oops code in do_page_fault() should also bust both
spinlocks before trying to print.  And if we're using
a serial console there may be a different set of spinlocks
which need busting. And the fbdev drivers...   I'll take
a look.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」