Re: [PATCH printk v1] printk: nbcon: Allow reacquire during panic

From: Petr Mladek
Date: Tue Jun 17 2025 - 06:32:19 EST


On Fri 2025-06-06 21:01:49, John Ogness wrote:
> If a console printer is interrupted during panic, it will never
> be able to reacquire ownership in order to perform and cleanup.
> That in itself is not a problem, since the non-panic CPU will
> simply quiesce in an endless loop within nbcon_reacquire_nobuf().
>
> However, in this state, platforms that do not support a true NMI
> to interrupt the quiesced CPU will not be able to shutdown that
> CPU from within panic(). This then causes problems for such as
> being unable to load and run a kdump kernel.
>
> Fix this by allowing non-panic CPUs to reacquire ownership using
> a direct acquire. Then the non-panic CPUs can successfullyl exit
> the nbcon_reacquire_nobuf() loop and the console driver can
> perform any necessary cleanup. But more importantly, the CPU is
> no longer quiesced and is free to process any interrupts
> necessary for panic() to shutdown the CPU.
>
> All other forms of acquire are still not allowed for non-panic
> CPUs since it is safer to have them avoid gaining console
> ownership that is not strictly necessary.
>
> Reported-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
> Closes: https://lore.kernel.org/r/SN6PR02MB4157A4C5E8CB219A75263A17D46DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>

JFYI, the patch has been committed into printk/linux.git,
branch rework/fixes. It is intended for the next 6.17 merge window.

Best Regards,
Petr