lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAC251sX=FezWGmZ==hAJg+8sbe-MS_CVSx8HwJfFthiAh2-L5g@mail.gmail.com>
Date: Thu, 5 Jun 2025 10:46:31 +0100
From: Michael Cobb <mcobb@...goodpenguin.co.uk>
To: Petr Mladek <pmladek@...e.com>
Cc: John Ogness <john.ogness@...utronix.de>, rostedt@...dmis.org, 
	senozhatsky@...omium.org, linux-serial@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] printk: Allow to use the printk kthread immediately even
 for 1st nbcon

On Wed, 4 Jun 2025 at 15:21, Petr Mladek <pmladek@...e.com> wrote:
>
> The kthreads for nbcon consoles are created by nbcon_alloc() at
> the beginning of the console registration. But it currently works
> only for the 2nd or later nbcon console because the code checks
> @printk_kthreads_running.
>
> The kthread for the 1st registered nbcon console is created at the very
> end of register_console() by printk_kthreads_check_locked(). As a result,
> the entire log is replayed synchronously when the "enabled" message
> gets printed. It might block the boot for a long time with a slow serial
> console.
>
> Prevent the synchronous flush by creating the kthread even for the 1st
> nbcon console when it is safe (kthreads ready and no boot consoles).
>
> Also inform printk() to use the kthread by setting
> @printk_kthreads_running. Note that the kthreads already must be
> running when it is safe and this is not the 1st nbcon console.
>
> Symmetrically, clear @printk_kthreads_running when the last nbcon
> console was unregistered by nbcon_free(). This requires updating
> @have_nbcon_console before nbcon_free() gets called.
>
> Note that there is _no_ problem when the 1st nbcon console replaces boot
> consoles. In this case, the kthread will be started at the end
> of registration after the boot consoles are removed. But the console
> does not reply the entire log buffer in this case. Note that
> the flag CON_PRINTBUFFER is always cleared when the boot consoles are
> removed and vice versa.
>
> Closes: https://lore.kernel.org/r/20250514173514.2117832-1-mcobb@thegoodpenguin.co.uk
> Signed-off-by: Petr Mladek <pmladek@...e.com>

Tested-by: Michael Cobb <mcobb@...goodpenguin.co.uk>

With this patch, on Raspberry Pi 3B+, I'm seeing the kernel will reach
userspace in ~1.5s, which is consistent with a boot with no console
output (loglevel=1) and at slower baudrates too. For reference, I was
seeing ~5s to reach userspace at 115200 baud and ~15s with
initcall_debug turned on.

Thanks for your work on this Petr and John for your support!

Kind regards,

Michael Cobb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ