diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-08-08 21:47:09 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-11-09 16:52:43 -0800 |
commit | 71e2f32b6006fcef62578fb5bb7ba025a85a2d44 (patch) | |
tree | 0528b960e04d9db2276c391a1b3fc5e4d2eebabd /kernel/printk.c | |
parent | e3a7dfadd027458955f0783ba19d99c096b1b572 (diff) |
printk: robustify printk
commit b845b517b5e3706a3729f6ea83b88ab85f0725b0 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 00848123afb..204660d0a2a 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -977,10 +977,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; } /** |