lkml.org 
[lkml]   [2008]   [Mar]   [24]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
Patch in this message
/
DateMon, 24 Mar 2008 13:24:26 +0100
FromPeter Zijlstra <>
Subject[PATCH 2/2] time: xtime lock vs printk
This printk() can deadlock because it can wake up klogd(), and
task enqueueing will try to read the time in order to set a hrtimer.

Use the new printk_nowakeup() which will avoid waking klogd.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/time/timekeeping.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Index: linux-2.6-2/kernel/time/timekeeping.c
===================================================================
--- linux-2.6-2.orig/kernel/time/timekeeping.c
+++ linux-2.6-2/kernel/time/timekeeping.c
@@ -191,7 +191,11 @@ static void change_clocksource(void)
 
 	tick_clock_notify();
 
-	printk(KERN_INFO "Time: %s clocksource has been installed.\n",
+	/*
+	 * We're holding xtime lock and waking up klogd would deadlock
+	 * us on enqueue. Print without waking.
+	 */
+	printk_nowakeup(KERN_INFO "Time: %s clocksource has been installed.\n",
 	       clock->name);
 }
 #else
--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-03-24 12:43    [W:0.082 / U:1.660 seconds]
©2003-2008 Jasper Spaans