On Tue 2025-09-02 15:33:54, Marcos Paulo de Souza wrote:
> KDB can interrupt any console to execute the "mirrored printing" at any
> time, so add an exception to nbcon_context_try_acquire_direct to allow
> to get the context if the current CPU is the same as kdb_printf_cpu.
> 
> This change will be necessary for the next patch, which fixes
> kdb_msg_write to work with NBCON consoles by calling ->write_atomic on
> such consoles. But to print it first needs to acquire the ownership of
> the console, so nbcon_context_try_acquire_direct is fixed here.
> 
> --- a/kernel/printk/nbcon.c
> +++ b/kernel/printk/nbcon.c
> @@ -247,6 +248,8 @@ static int nbcon_context_try_acquire_direct(struct 
> nbcon_context *ctxt,
>                * Panic does not imply that the console is owned. However,
>                * since all non-panic CPUs are stopped during panic(), it
>                * is safer to have them avoid gaining console ownership.
> +              * The only exception is if kdb is active, which may print
> +              * from multiple CPUs during a panic.

Strictly speaking this is not the only exception. The reacquire is
another one. I would put this into a separate paragraph and write:

                 * One exception is when kdb is active, which may print
                 * from multiple CPUs during a panic.

>                * If this acquire is a reacquire (and an unsafe takeover

And here start the paragrah with

                 * Second exception is a reacquire (and an usafe ...

>                * has not previously occurred) then it is allowed to attempt

Best Regards,
Petr


_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to