diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index a430fd04008b..aee891a869a4 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -577,9 +577,6 @@ static int have_callable_console(void) | |||
577 | * @fmt: format string | 577 | * @fmt: format string |
578 | * | 578 | * |
579 | * This is printk(). It can be called from any context. We want it to work. | 579 | * This is printk(). It can be called from any context. We want it to work. |
580 | * Be aware of the fact that if oops_in_progress is not set, we might try to | ||
581 | * wake klogd up which could deadlock on runqueue lock if printk() is called | ||
582 | * from scheduler code. | ||
583 | * | 580 | * |
584 | * We try to grab the console_sem. If we succeed, it's easy - we log the output and | 581 | * We try to grab the console_sem. If we succeed, it's easy - we log the output and |
585 | * call the console drivers. If we fail to get the semaphore we place the output | 582 | * call the console drivers. If we fail to get the semaphore we place the output |
@@ -982,10 +979,25 @@ int is_console_locked(void) | |||
982 | return console_locked; | 979 | return console_locked; |
983 | } | 980 | } |
984 | 981 | ||
985 | void wake_up_klogd(void) | 982 | static DEFINE_PER_CPU(int, printk_pending); |
983 | |||
984 | void printk_tick(void) | ||
986 | { | 985 | { |
987 | if (!oops_in_progress && waitqueue_active(&log_wait)) | 986 | if (__get_cpu_var(printk_pending)) { |
987 | __get_cpu_var(printk_pending) = 0; | ||
988 | wake_up_interruptible(&log_wait); | 988 | wake_up_interruptible(&log_wait); |
989 | } | ||
990 | } | ||
991 | |||
992 | int printk_needs_cpu(int cpu) | ||
993 | { | ||
994 | return per_cpu(printk_pending, cpu); | ||
995 | } | ||
996 | |||
997 | void wake_up_klogd(void) | ||
998 | { | ||
999 | if (waitqueue_active(&log_wait)) | ||
1000 | __raw_get_cpu_var(printk_pending) = 1; | ||
989 | } | 1001 | } |
990 | 1002 | ||
991 | /** | 1003 | /** |