From: Andrew Morton - the delay should be in vprintk(), not printk() - cleanups - This: long long = long * long; doesn't work: the rhs will still be 32-bit. Need to make the expression 64-bit somehow. Cc: Dave Jones Cc: Randy Dunlap Signed-off-by: Andrew Morton --- kernel/printk.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff -puN kernel/printk.c~slow-down-printk-during-boot-fix-2 kernel/printk.c --- a/kernel/printk.c~slow-down-printk-during-boot-fix-2 +++ a/kernel/printk.c @@ -171,8 +171,11 @@ unsigned long long printk_delay_msec; /* static int __init boot_delay_setup(char *str) { - unsigned long lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */ - unsigned long long loops_per_msec = lpj / 1000 * HZ; + unsigned long lpj; + unsigned long long loops_per_msec; + + lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */ + loops_per_msec = (unsigned long long)lpj / 1000 * HZ; get_option(&str, &boot_delay); if (boot_delay > 10 * 1000) @@ -186,12 +189,17 @@ static int __init boot_delay_setup(char } __setup("boot_delay=", boot_delay_setup); -static void boot_delay_msec(int millisecs) +static void boot_delay_msec(void) { - unsigned long long k = printk_delay_msec * millisecs; + unsigned long long k; unsigned long timeout; - timeout = jiffies + msecs_to_jiffies(millisecs); + if (boot_delay == 0 || system_state != SYSTEM_BOOTING) + return; + + k = (unsigned long long)printk_delay_msec * boot_delay; + + timeout = jiffies + msecs_to_jiffies(boot_delay); while (k) { k--; cpu_relax(); @@ -205,7 +213,10 @@ static void boot_delay_msec(int millisec touch_nmi_watchdog(); } } - +#else +static inline void boot_delay_msec(void) +{ +} #endif /* @@ -559,11 +570,6 @@ asmlinkage int printk(const char *fmt, . r = vprintk(fmt, args); va_end(args); -#ifdef CONFIG_BOOT_PRINTK_DELAY - if (boot_delay && system_state == SYSTEM_BOOTING) - boot_delay_msec(boot_delay); -#endif - return r; } @@ -578,6 +584,8 @@ asmlinkage int vprintk(const char *fmt, static char printk_buf[1024]; static int log_level_unknown = 1; + boot_delay_msec(); + preempt_disable(); if (unlikely(oops_in_progress) && printk_cpu == smp_processor_id()) /* If a crash is occurring during printk() on this CPU, _