diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-08-08 21:47:09 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-11 13:46:53 +0200 |
commit | b845b517b5e3706a3729f6ea83b88ab85f0725b0 (patch) | |
tree | 4311e4c2e6c3fdbdbe89149d1501944294186455 /kernel/printk.c | |
parent | 796aadeb1b2db9b5d463946766c5bbfd7717158c (diff) | |
download | blackbird-op-linux-b845b517b5e3706a3729f6ea83b88ab85f0725b0.tar.gz blackbird-op-linux-b845b517b5e3706a3729f6ea83b88ab85f0725b0.zip |
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.c | 19 |
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) return console_locked; } -void wake_up_klogd(void) +static DEFINE_PER_CPU(int, printk_pending); + +void printk_tick(void) { - if (!oops_in_progress && waitqueue_active(&log_wait)) + if (__get_cpu_var(printk_pending)) { + __get_cpu_var(printk_pending) = 0; wake_up_interruptible(&log_wait); + } +} + +int printk_needs_cpu(int cpu) +{ + return per_cpu(printk_pending, cpu); +} + +void wake_up_klogd(void) +{ + if (waitqueue_active(&log_wait)) + __get_cpu_var(printk_pending) = 1; } /** |