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

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/printk.c+21−19
@@ -747,6 +747,21 @@ void __init setup_log_buf(int early) · 746 unmodified lines
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_DELAY765#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) · 17 unmodified lines
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) · 12 unmodified lines
795 }812 }
796}813}
797#else814#else
798static inline void boot_delay_msec(void)815static inline void boot_delay_msec(int level)
799{816{
800}817}
801#endif818#endif
@@ -1238,21 +1255,6 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) · 436 unmodified lines
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 out1259 * 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, · 239 unmodified lines
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 */