Re: [PATCH v3] printk: Remove remaining boot consoles when a real console exists
From: Petr Mladek
Date: Wed Aug 26 2026 - 11:06:54 EST
On Fri 2026-08-21 15:17:21, Xiaochun Li wrote:
> Boot consoles are temporary and should be removed once a real console is
> available. However, the late init cleanup currently only unregisters boot
> consoles that use init section memory. Other boot consoles are expected
> to be removed when the real preferred console is registered.
>
> This does not cover cases where a real console has registered, but the
> boot console was not removed because the real console did not become the
> preferred console. For example, with multiple console= parameters using
> the same driver, a real 8250 console may be enabled while the early
> console remains registered. The result is duplicate printk output from
> both consoles.
>
> In the mailing list discussion, two possible approaches were suggested
> to fix this problem [1]. This patch implements the first one: during
> printk_late_init(), check whether at least one real console is already
> registered. If so, unregister all remaining boot consoles. If no real
> console exists yet, keep the existing behavior and unregister only boot
> consoles that reference init section memory, avoiding a period with no
> console output while waiting for a deferred or modular real console.
>
> Suggested-by: Petr Mladek <pmladek@xxxxxxxx>
> Link: https://lore.kernel.org/lkml/ahBsSW2bB2CRfW-k@xxxxxxxxxxxxxxx/ # [1]
> Signed-off-by: Xiaochun Li <lixiaochun@xxxxxxxxxxxxxx>
The patch looks good:
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
Tested-by: Petr Mladek <pmladek@xxxxxxxx>
The patch looks ready for linux-next. I am going to wait one week
for more potential feedback. Then I will push it to printk/linux.git
unless anyone complains in the meantime.
Best Regards,
Petr