diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2009-09-22 19:43:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:28 -0400 |
commit | af91322ef3f29ae4114e736e2a72e28b4d619cf9 (patch) | |
tree | debba08531c7dd78b90b5d8f2c03f6bf7c9e7877 /kernel/printk.c | |
parent | 3a3b6ed2235f2f619889dd6096e24b6d93bf3339 (diff) |
printk: add printk_delay to make messages readable for some scenarios
When syslog is not possible, at the same time there's no serial/net
console available, it will be hard to read the printk messages. For
example oops/panic/warning messages in shutdown phase.
Add a printk delay feature, we can make each printk message delay some
milliseconds.
Setting the delay by proc/sysctl interface: /proc/sys/kernel/printk_delay
The value range from 0 - 10000, default value is 0
[akpm@linux-foundation.org: fix a few things]
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 932ea21feb18..f38b07f78a4e 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -653,6 +653,20 @@ static int recursion_bug; | |||
653 | static int new_text_line = 1; | 653 | static int new_text_line = 1; |
654 | static char printk_buf[1024]; | 654 | static char printk_buf[1024]; |
655 | 655 | ||
656 | int printk_delay_msec __read_mostly; | ||
657 | |||
658 | static inline void printk_delay(void) | ||
659 | { | ||
660 | if (unlikely(printk_delay_msec)) { | ||
661 | int m = printk_delay_msec; | ||
662 | |||
663 | while (m--) { | ||
664 | mdelay(1); | ||
665 | touch_nmi_watchdog(); | ||
666 | } | ||
667 | } | ||
668 | } | ||
669 | |||
656 | asmlinkage int vprintk(const char *fmt, va_list args) | 670 | asmlinkage int vprintk(const char *fmt, va_list args) |
657 | { | 671 | { |
658 | int printed_len = 0; | 672 | int printed_len = 0; |
@@ -662,6 +676,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
662 | char *p; | 676 | char *p; |
663 | 677 | ||
664 | boot_delay_msec(); | 678 | boot_delay_msec(); |
679 | printk_delay(); | ||
665 | 680 | ||
666 | preempt_disable(); | 681 | preempt_disable(); |
667 | /* This stops the holder of console_sem just where we want him */ | 682 | /* This stops the holder of console_sem just where we want him */ |