浏览代码

Don't 'printk()' while holding xtime lock for writing

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>
Linus Torvalds 17 年之前
父节点
当前提交
92896bd9fd
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      kernel/time/timekeeping.c

+ 4 - 0
kernel/time/timekeeping.c

@@ -191,8 +191,12 @@ static void change_clocksource(void)
 
 
 	tick_clock_notify();
 	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",
 	printk(KERN_INFO "Time: %s clocksource has been installed.\n",
 	       clock->name);
 	       clock->name);
+	 */
 }
 }
 #else
 #else
 static inline void change_clocksource(void) { }
 static inline void change_clocksource(void) { }