aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/printk.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index b51b1567bb55..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
985void wake_up_klogd(void) 982static DEFINE_PER_CPU(int, printk_pending);
983
984void 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
992int printk_needs_cpu(int cpu)
993{
994 return per_cpu(printk_pending, cpu);
995}
996
997void 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/**
@@ -1291,22 +1303,6 @@ static int __init disable_boot_consoles(void)
1291} 1303}
1292late_initcall(disable_boot_consoles); 1304late_initcall(disable_boot_consoles);
1293 1305
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 */
1303void 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 1306#if defined CONFIG_PRINTK
1311 1307
1312/* 1308/*