History

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.

Andrew Cooks committed 13 years ago

Commit 2fa72c81 parent afde3be1 file · +21 −19Browse files

Unified · Split

kernel/printk.c+21−19
@@ -747,6 +747,21 @@ void __init setup_log_buf(int early) · 746 unmodified lines
747747 free, (free * 100) / __LOG_BUF_LEN);
748748 }
749749
750+static bool __read_mostly ignore_loglevel;
751+
752+static 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+
760+early_param("ignore_loglevel", ignore_loglevel_setup);
761+module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
762+MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
763+ "print all kernel messages to the console.");
764+
750765 #ifdef CONFIG_BOOT_PRINTK_DELAY
751766
752767 static int boot_delay; /* msecs delay after each printk during bootup */
@@ -770,13 +785,15 @@ static int __init boot_delay_setup(char *str) · 17 unmodified lines
770785 }
771786 __setup("boot_delay=", boot_delay_setup);
772787
773−static void boot_delay_msec(void)
788+static void boot_delay_msec(int level)
774789 {
775790 unsigned long long k;
776791 unsigned long timeout;
777792
778− if (boot_delay == 0 || system_state != SYSTEM_BOOTING)
793+ if ((boot_delay == 0 || system_state != SYSTEM_BOOTING)
794+ || (level >= console_loglevel && !ignore_loglevel)) {
779795 return;
796+ }
780797
781798 k = (unsigned long long)loops_per_msec * boot_delay;
782799
@@ -795,7 +812,7 @@ static void boot_delay_msec(void) · 12 unmodified lines
795812 }
796813 }
797814 #else
798−static inline void boot_delay_msec(void)
815+static inline void boot_delay_msec(int level)
799816 {
800817 }
801818 #endif
@@ -1238,21 +1255,6 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) · 436 unmodified lines
12381255 return do_syslog(type, buf, len, SYSLOG_FROM_CALL);
12391256 }
12401257
1241−static bool __read_mostly ignore_loglevel;
1242−
1243−static 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−
1251−early_param("ignore_loglevel", ignore_loglevel_setup);
1252−module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
1253−MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
1254− "print all kernel messages to the console.");
1255−
12561258 /*
12571259 * Call the console drivers, asking them to write out
12581260 * log_buf[start] to log_buf[end - 1].
@@ -1498,7 +1500,7 @@ asmlinkage int vprintk_emit(int facility, int level, · 239 unmodified lines
14981500 int this_cpu;
14991501 int printed_len = 0;
15001502
1501− boot_delay_msec();
1503+ boot_delay_msec(level);
15021504 printk_delay();
15031505
15041506 /* This stops the holder of console_sem just where we want him */