Re: [PATCH printk v2 1/2] printk/nbcon: Flush nbcon_irq_work in nbcon_free()
From: Petr Mladek
Date: Mon Aug 31 2026 - 13:13:40 EST
On Fri 2026-08-28 16:08:08, John Ogness wrote:
> Ensure any pending nbcon_irq_work is flushed before allowing the
> console to be recycled.
>
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> ---
> kernel/printk/nbcon.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
> index a5921a84a80ed..218b1922a58de 100644
> --- a/kernel/printk/nbcon.c
> +++ b/kernel/printk/nbcon.c
> @@ -1849,6 +1849,8 @@ void nbcon_free(struct console *con)
> printk_kthreads_running = false;
> }
>
> + irq_work_sync(&con->irq_work);
The irq_work work tries to wake up the printk kthread which
has been destroyed above.
IMHO, we should move this up above
if (printk_kthreads_running) {
nbcon_kthread_stop(con);
Note that nbcon_free() is called when @con is not longer in
the console_list and after synchronize_srcu(). So that nobody
should queue this irq_work anymore.
Best Regards,
Petr
> +
> nbcon_state_set(con, &state);
>
> /* Boot consoles share global printk buffers. */
> --
> 2.47.3