aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-08-08 15:47:09 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-11 07:46:53 -0400
commitb845b517b5e3706a3729f6ea83b88ab85f0725b0 (patch)
tree4311e4c2e6c3fdbdbe89149d1501944294186455 /kernel/printk.c
parent796aadeb1b2db9b5d463946766c5bbfd7717158c (diff)
printk: robustify printk
Avoid deadlocks against rq->lock and xtime_lock by deferring the klogd wakeup by polling from the timer tick. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index b51b1567bb55..655cc2ca10cc 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -982,10 +982,25 @@ int is_console_locked(void)
982 return console_locked; 982 return console_locked;
983} 983}
984 984
985void wake_up_klogd(void) 985static DEFINE_PER_CPU(int, printk_pending);
986
987void printk_tick(void)
986{ 988{
987 if (!oops_in_progress && waitqueue_active(&log_wait)) 989 if (__get_cpu_var(printk_pending)) {
990 __get_cpu_var(printk_pending) = 0;
988 wake_up_interruptible(&log_wait); 991 wake_up_interruptible(&log_wait);
992 }
993}
994
995int printk_needs_cpu(int cpu)
996{
997 return per_cpu(printk_pending, cpu);
998}
999
1000void wake_up_klogd(void)
1001{
1002 if (waitqueue_active(&log_wait))
1003 __get_cpu_var(printk_pending) = 1;
989} 1004}
990 1005
991/** 1006/**