diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:54:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:54:49 -0400 |
commit | d1a76187a5be4f89c6cb19d800cb5fb7aac735c5 (patch) | |
tree | 2fac3ffbfffc7560eeef8364b541d0d7a0057920 /kernel/printk.c | |
parent | c7e78cff6b7518212247fb20b1dc6411540dc9af (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into core/locking
Conflicts:
arch/um/include/asm/system.h
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index b51b1567bb55..6341af77eb65 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * Fixed SMP synchronization, 08/08/99, Manfred Spraul | 13 | * Fixed SMP synchronization, 08/08/99, Manfred Spraul |
14 | * manfred@colorfullife.com | 14 | * manfred@colorfullife.com |
15 | * Rewrote bits to get rid of console_lock | 15 | * Rewrote bits to get rid of console_lock |
16 | * 01Mar01 Andrew Morton <andrewm@uow.edu.au> | 16 | * 01Mar01 Andrew Morton |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -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 |
@@ -593,6 +590,8 @@ static int have_callable_console(void) | |||
593 | * | 590 | * |
594 | * See also: | 591 | * See also: |
595 | * printf(3) | 592 | * printf(3) |
593 | * | ||
594 | * See the vsnprintf() documentation for format string extensions over C99. | ||
596 | */ | 595 | */ |
597 | 596 | ||
598 | asmlinkage int printk(const char *fmt, ...) | 597 | asmlinkage int printk(const char *fmt, ...) |
@@ -982,10 +981,25 @@ int is_console_locked(void) | |||
982 | return console_locked; | 981 | return console_locked; |
983 | } | 982 | } |
984 | 983 | ||
985 | void wake_up_klogd(void) | 984 | static DEFINE_PER_CPU(int, printk_pending); |
985 | |||
986 | void printk_tick(void) | ||
986 | { | 987 | { |
987 | if (!oops_in_progress && waitqueue_active(&log_wait)) | 988 | if (__get_cpu_var(printk_pending)) { |
989 | __get_cpu_var(printk_pending) = 0; | ||
988 | wake_up_interruptible(&log_wait); | 990 | wake_up_interruptible(&log_wait); |
991 | } | ||
992 | } | ||
993 | |||
994 | int printk_needs_cpu(int cpu) | ||
995 | { | ||
996 | return per_cpu(printk_pending, cpu); | ||
997 | } | ||
998 | |||
999 | void wake_up_klogd(void) | ||
1000 | { | ||
1001 | if (waitqueue_active(&log_wait)) | ||
1002 | __raw_get_cpu_var(printk_pending) = 1; | ||
989 | } | 1003 | } |
990 | 1004 | ||
991 | /** | 1005 | /** |
@@ -1291,22 +1305,6 @@ static int __init disable_boot_consoles(void) | |||
1291 | } | 1305 | } |
1292 | late_initcall(disable_boot_consoles); | 1306 | late_initcall(disable_boot_consoles); |
1293 | 1307 | ||
1294 | /** | ||
1295 | * tty_write_message - write a message to a certain tty, not just the console. | ||
1296 | * @tty: the destination tty_struct | ||
1297 | * @msg: the message to write | ||
1298 | * | ||
1299 | * This is used for messages that need to be redirected to a specific tty. | ||
1300 | * We don't put it into the syslog queue right now maybe in the future if | ||
1301 | * really needed. | ||
1302 | */ | ||
1303 | void tty_write_message(struct tty_struct *tty, char *msg) | ||
1304 | { | ||
1305 | if (tty && tty->ops->write) | ||
1306 | tty->ops->write(tty, msg, strlen(msg)); | ||
1307 | return; | ||
1308 | } | ||
1309 | |||
1310 | #if defined CONFIG_PRINTK | 1308 | #if defined CONFIG_PRINTK |
1311 | 1309 | ||
1312 | /* | 1310 | /* |