Don't 'printk()' while holding xtime lock for writing
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 24 Mar 2008 18:07:15 +0000 (11:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 24 Mar 2008 18:07:15 +0000 (11:07 -0700)
The printk() can deadlock because it can wake up klogd(), and
task enqueueing will try to read the time in order to set a hrtimer.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Debugged-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/time/timekeeping.c

index 671af612b7684ed27578ae3db8445f71f3499059..a3fa587c350c598063a17c903beeee99fe0f47e0 100644 (file)
@@ -191,8 +191,12 @@ static void change_clocksource(void)
 
        tick_clock_notify();
 
+       /*
+        * We're holding xtime lock and waking up klogd would deadlock
+        * us on enqueue.  So no printing!
        printk(KERN_INFO "Time: %s clocksource has been installed.\n",
               clock->name);
+        */
 }
 #else
 static inline void change_clocksource(void) { }