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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -747,6 +747,21 @@ void __init setup_log_buf(int early) · 746 unmodified lines | ||
| 747 | 747 | free, (free * 100) / __LOG_BUF_LEN); |
| 748 | 748 | } |
| 749 | 749 | |
| 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 | + | |
| 750 | 765 | #ifdef CONFIG_BOOT_PRINTK_DELAY |
| 751 | 766 | |
| 752 | 767 | 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 | ||
| 770 | 785 | } |
| 771 | 786 | __setup("boot_delay=", boot_delay_setup); |
| 772 | 787 | |
| 773 | −static void boot_delay_msec(void) | |
| 788 | +static void boot_delay_msec(int level) | |
| 774 | 789 | { |
| 775 | 790 | unsigned long long k; |
| 776 | 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 | 795 | return; |
| 796 | + } | |
| 780 | 797 | |
| 781 | 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 | 814 | #else |
| 798 | −static inline void boot_delay_msec(void) | |
| 815 | +static inline void boot_delay_msec(int level) | |
| 799 | 816 | { |
| 800 | 817 | } |
| 801 | 818 | #endif |
| @@ -1238,21 +1255,6 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) · 436 unmodified lines | ||
| 1238 | 1255 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); |
| 1239 | 1256 | } |
| 1240 | 1257 | |
| 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 | − | |
| 1256 | 1258 | /* |
| 1257 | 1259 | * Call the console drivers, asking them to write out |
| 1258 | 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 | 1500 | int this_cpu; |
| 1499 | 1501 | int printed_len = 0; |
| 1500 | 1502 | |
| 1501 | − boot_delay_msec(); | |
| 1503 | + boot_delay_msec(level); | |
| 1502 | 1504 | printk_delay(); |
| 1503 | 1505 | |
| 1504 | 1506 | /* This stops the holder of console_sem just where we want him */ |