diff options
Diffstat (limited to 'kernel/printk.c')
| -rw-r--r-- | kernel/printk.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 602033acd6c7..f38b07f78a4e 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
| @@ -206,12 +206,11 @@ __setup("log_buf_len=", log_buf_len_setup); | |||
| 206 | #ifdef CONFIG_BOOT_PRINTK_DELAY | 206 | #ifdef CONFIG_BOOT_PRINTK_DELAY |
| 207 | 207 | ||
| 208 | static unsigned int boot_delay; /* msecs delay after each printk during bootup */ | 208 | static unsigned int boot_delay; /* msecs delay after each printk during bootup */ |
| 209 | static unsigned long long printk_delay_msec; /* per msec, based on boot_delay */ | 209 | static unsigned long long loops_per_msec; /* based on boot_delay */ |
| 210 | 210 | ||
| 211 | static int __init boot_delay_setup(char *str) | 211 | static int __init boot_delay_setup(char *str) |
| 212 | { | 212 | { |
| 213 | unsigned long lpj; | 213 | unsigned long lpj; |
| 214 | unsigned long long loops_per_msec; | ||
| 215 | 214 | ||
| 216 | lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */ | 215 | lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */ |
| 217 | loops_per_msec = (unsigned long long)lpj / 1000 * HZ; | 216 | loops_per_msec = (unsigned long long)lpj / 1000 * HZ; |
| @@ -220,10 +219,9 @@ static int __init boot_delay_setup(char *str) | |||
| 220 | if (boot_delay > 10 * 1000) | 219 | if (boot_delay > 10 * 1000) |
| 221 | boot_delay = 0; | 220 | boot_delay = 0; |
| 222 | 221 | ||
| 223 | printk_delay_msec = loops_per_msec; | 222 | pr_debug("boot_delay: %u, preset_lpj: %ld, lpj: %lu, " |
| 224 | printk(KERN_DEBUG "boot_delay: %u, preset_lpj: %ld, lpj: %lu, " | 223 | "HZ: %d, loops_per_msec: %llu\n", |
| 225 | "HZ: %d, printk_delay_msec: %llu\n", | 224 | boot_delay, preset_lpj, lpj, HZ, loops_per_msec); |
| 226 | boot_delay, preset_lpj, lpj, HZ, printk_delay_msec); | ||
| 227 | return 1; | 225 | return 1; |
| 228 | } | 226 | } |
| 229 | __setup("boot_delay=", boot_delay_setup); | 227 | __setup("boot_delay=", boot_delay_setup); |
| @@ -236,7 +234,7 @@ static void boot_delay_msec(void) | |||
| 236 | if (boot_delay == 0 || system_state != SYSTEM_BOOTING) | 234 | if (boot_delay == 0 || system_state != SYSTEM_BOOTING) |
| 237 | return; | 235 | return; |
| 238 | 236 | ||
| 239 | k = (unsigned long long)printk_delay_msec * boot_delay; | 237 | k = (unsigned long long)loops_per_msec * boot_delay; |
| 240 | 238 | ||
| 241 | timeout = jiffies + msecs_to_jiffies(boot_delay); | 239 | timeout = jiffies + msecs_to_jiffies(boot_delay); |
| 242 | while (k) { | 240 | while (k) { |
| @@ -655,6 +653,20 @@ static int recursion_bug; | |||
| 655 | static int new_text_line = 1; | 653 | static int new_text_line = 1; |
| 656 | static char printk_buf[1024]; | 654 | static char printk_buf[1024]; |
| 657 | 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 | |||
| 658 | asmlinkage int vprintk(const char *fmt, va_list args) | 670 | asmlinkage int vprintk(const char *fmt, va_list args) |
| 659 | { | 671 | { |
| 660 | int printed_len = 0; | 672 | int printed_len = 0; |
| @@ -664,6 +676,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
| 664 | char *p; | 676 | char *p; |
| 665 | 677 | ||
| 666 | boot_delay_msec(); | 678 | boot_delay_msec(); |
| 679 | printk_delay(); | ||
| 667 | 680 | ||
| 668 | preempt_disable(); | 681 | preempt_disable(); |
| 669 | /* 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 */ |
