aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Cooks <acooks@gmail.com>2012-12-17 18:59:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:13 -0500
commit2fa72c8fa5d03c4e07894ccb9f0be72e8687a455 (patch)
treed71a2c684e931d187901dbb8ddd926ebd93a46ba
parentafde3be121efcc658e26f8cc71ead04af96d38f9 (diff)
printk: boot_delay should only affect output
The boot_delay parameter affects all printk(), even if the log level prevents visible output from the call. It results in delays greater than the user intended without purpose. This patch changes the behaviour of boot_delay to only delay output. Signed-off-by: Andrew Cooks <acooks@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/printk.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 22e070f3470a..19c0d7bcf24a 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -747,6 +747,21 @@ void __init setup_log_buf(int early)
747 free, (free * 100) / __LOG_BUF_LEN); 747 free, (free * 100) / __LOG_BUF_LEN);
748} 748}
749 749
750static bool __read_mostly ignore_loglevel;
751
752static int __init ignore_loglevel_setup(char *str)
753{
754 ignore_loglevel = 1;
755 printk(KERN_INFO "debug: ignoring loglevel setting.\n");
756
757 return 0;
758}
759
760early_param("ignore_loglevel", ignore_loglevel_setup);
761module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
762MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
763 "print all kernel messages to the console.");
764
750#ifdef CONFIG_BOOT_PRINTK_DELAY 765#ifdef CONFIG_BOOT_PRINTK_DELAY
751 766
752static int boot_delay; /* msecs delay after each printk during bootup */ 767static int boot_delay; /* msecs delay after each printk during bootup */
@@ -770,13 +785,15 @@ static int __init boot_delay_setup(char *str)
770} 785}
771__setup("boot_delay=", boot_delay_setup); 786__setup("boot_delay=", boot_delay_setup);
772 787
773static void boot_delay_msec(void) 788static void boot_delay_msec(int level)
774{ 789{
775 unsigned long long k; 790 unsigned long long k;
776 unsigned long timeout; 791 unsigned long timeout;
777 792
778 if (boot_delay == 0 || system_state != SYSTEM_BOOTING) 793 if ((boot_delay == 0 || system_state != SYSTEM_BOOTING)
794 || (level >= console_loglevel && !ignore_loglevel)) {
779 return; 795 return;
796 }
780 797
781 k = (unsigned long long)loops_per_msec * boot_delay; 798 k = (unsigned long long)loops_per_msec * boot_delay;
782 799
@@ -795,7 +812,7 @@ static void boot_delay_msec(void)
795 } 812 }
796} 813}
797#else 814#else
798static inline void boot_delay_msec(void) 815static inline void boot_delay_msec(int level)
799{ 816{
800} 817}
801#endif 818#endif
@@ -1238,21 +1255,6 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
1238 return do_syslog(type, buf, len, SYSLOG_FROM_CALL); 1255 return do_syslog(type, buf, len, SYSLOG_FROM_CALL);
1239} 1256}
1240 1257
1241static bool __read_mostly ignore_loglevel;
1242
1243static int __init ignore_loglevel_setup(char *str)
1244{
1245 ignore_loglevel = 1;
1246 printk(KERN_INFO "debug: ignoring loglevel setting.\n");
1247
1248 return 0;
1249}
1250
1251early_param("ignore_loglevel", ignore_loglevel_setup);
1252module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
1253MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
1254 "print all kernel messages to the console.");
1255
1256/* 1258/*
1257 * Call the console drivers, asking them to write out 1259 * Call the console drivers, asking them to write out
1258 * log_buf[start] to log_buf[end - 1]. 1260 * log_buf[start] to log_buf[end - 1].
@@ -1498,7 +1500,7 @@ asmlinkage int vprintk_emit(int facility, int level,
1498 int this_cpu; 1500 int this_cpu;
1499 int printed_len = 0; 1501 int printed_len = 0;
1500 1502
1501 boot_delay_msec(); 1503 boot_delay_msec(level);
1502 printk_delay(); 1504 printk_delay();
1503 1505
1504 /* This stops the holder of console_sem just where we want him */ 1506 /* This stops the holder of console_sem just where we want him */