[PATCH RFC 2/4] printk: deprecate boot_delay in favour of printk_delay
Petr Mladek
pmladek at suse.com
Mon Jun 8 07:07:43 PDT 2026
On Mon 2026-06-01 00:17:38, Andrew Murray wrote:
> The boot_delay (BOOT_PRINTK_DELAY) kernel parameter and printk_delay sysctl
> are two distinct mechanisms for providing similar functionality which add a
> delay prior to each printed printk message.
>
> boot_delay provides a kernel parameter for delaying printk output from
> kernel start through to boot (SYSTEM_RUNNING), whereas printk_delay is
> configurable only via sysctl and thus is only used post boot.
>
> Let's deprecate the boot_delay feature in favour of printk_delay. In order
> to preserve functionality, we'll also extend printk_delay such that it can
> additionally configured via a kernel parameter.
I would make it clear and say: "via an early kernel parameter".
Note that there are also kernel parameters which can be modified at runtime
via /sys/module/kernel/paramters/<parameter>
Also I would make it clear that this changes the behavior, for
example:
<proposal>
Behavior change:
The delay enabled by both "boot_delay" and "printk_delay" continues
working even in SYSTEM_RUNNING state. It must be explicitly stopped
by setting printk_delay=0 via sysctl.
The delay is skipped when the message is suppressed in all system
states. It used to skipped only for the boot_delay.
</proposal>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1339,11 +1327,34 @@ static void boot_delay_msec(int level)
> }
> }
> #else
> -static inline void boot_delay_msec(int level)
> +static inline void __init printk_delay_calculate(void)
> +{
> +}
> +
> +static inline void early_boot_delay_msec(void)
> {
It would be nice to print a warning that the early boot delay
does not work, something like:
pr_warn_once("Early boot delay does not work without CONFIG_GENERIC_CALIBRATE_DELAY enabled.\n");
> }
> #endif
>
> +static int __init printk_delay_setup(char *str)
> +{
> + get_option(&str, &printk_delay_msec);
> + if (printk_delay_msec > 10 * 1000)
> + printk_delay_msec = 0;
Sashiko AI warns that this code accepts negative values.
It might cause long delays, see
https://sashiko.dev/#/patchset/20260601-deprecate_boot_delay-v1-0-c34c187142a6%40thegoodpenguin.co.uk
The problem has already been there even before. But it would be nice
to fix it.
> +
> + printk_delay_calculate();
> +
> + return 0;
> +}
> +early_param("printk_delay", printk_delay_setup);
> +
> +static int __init boot_delay_setup(char *str)
> +{
> + pr_warn("boot_delay will soon be deprecated, please use printk_delay instead");
> + return printk_delay_setup(str);
> +}
> +early_param("boot_delay", boot_delay_setup);
> +
> static bool printk_time = IS_ENABLED(CONFIG_PRINTK_TIME);
> module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
Otherwise, it looks good to me.
Best Regards,
Petr
More information about the linux-arm-kernel
mailing list