diff options
| -rw-r--r-- | Documentation/sysctl/kernel.txt | 8 | ||||
| -rw-r--r-- | include/linux/kernel.h | 2 | ||||
| -rw-r--r-- | kernel/printk.c | 15 | ||||
| -rw-r--r-- | kernel/sysctl.c | 14 |
4 files changed, 39 insertions, 0 deletions
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index 3e5b63ebb821..b3d8b4922740 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
| @@ -313,6 +313,14 @@ send before ratelimiting kicks in. | |||
| 313 | 313 | ||
| 314 | ============================================================== | 314 | ============================================================== |
| 315 | 315 | ||
| 316 | printk_delay: | ||
| 317 | |||
| 318 | Delay each printk message in printk_delay milliseconds | ||
| 319 | |||
| 320 | Value from 0 - 10000 is allowed. | ||
| 321 | |||
| 322 | ============================================================== | ||
| 323 | |||
| 316 | randomize-va-space: | 324 | randomize-va-space: |
| 317 | 325 | ||
| 318 | This option can be used to select the type of process address | 326 | This option can be used to select the type of process address |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 2b5b1e0899a8..0a2a19087863 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -246,6 +246,8 @@ extern int printk_ratelimit(void); | |||
| 246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 246 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 247 | unsigned int interval_msec); | 247 | unsigned int interval_msec); |
| 248 | 248 | ||
| 249 | extern int printk_delay_msec; | ||
| 250 | |||
| 249 | /* | 251 | /* |
| 250 | * Print a one-time message (analogous to WARN_ONCE() et al): | 252 | * Print a one-time message (analogous to WARN_ONCE() et al): |
| 251 | */ | 253 | */ |
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 */ |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6ba49c7cb128..0dfaa47d7cb6 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -106,6 +106,9 @@ static int __maybe_unused one = 1; | |||
| 106 | static int __maybe_unused two = 2; | 106 | static int __maybe_unused two = 2; |
| 107 | static unsigned long one_ul = 1; | 107 | static unsigned long one_ul = 1; |
| 108 | static int one_hundred = 100; | 108 | static int one_hundred = 100; |
| 109 | #ifdef CONFIG_PRINTK | ||
| 110 | static int ten_thousand = 10000; | ||
| 111 | #endif | ||
| 109 | 112 | ||
| 110 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ | 113 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ |
| 111 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; | 114 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; |
| @@ -722,6 +725,17 @@ static struct ctl_table kern_table[] = { | |||
| 722 | .mode = 0644, | 725 | .mode = 0644, |
| 723 | .proc_handler = &proc_dointvec, | 726 | .proc_handler = &proc_dointvec, |
| 724 | }, | 727 | }, |
| 728 | { | ||
| 729 | .ctl_name = CTL_UNNUMBERED, | ||
| 730 | .procname = "printk_delay", | ||
| 731 | .data = &printk_delay_msec, | ||
| 732 | .maxlen = sizeof(int), | ||
| 733 | .mode = 0644, | ||
| 734 | .proc_handler = &proc_dointvec_minmax, | ||
| 735 | .strategy = &sysctl_intvec, | ||
| 736 | .extra1 = &zero, | ||
| 737 | .extra2 = &ten_thousand, | ||
| 738 | }, | ||
| 725 | #endif | 739 | #endif |
| 726 | { | 740 | { |
| 727 | .ctl_name = KERN_NGROUPS_MAX, | 741 | .ctl_name = KERN_NGROUPS_MAX, |
