Re: [PATCH 0/2] braille: nbcon: Allow using a serial driver converted to nbcon API as a Braille console
From: John Ogness
Date: Fri Sep 25 2026 - 09:12:33 EST
On 2026-09-22, Petr Mladek <pmladek@xxxxxxxx> wrote:
> I have been working on v5 [1] of the patchset cleaning console registration
> code and I found that the system did not boot when I selected a Braille
> on the command line, for example:
>
> console=brl,ttyS0,115200 console=tty0
>
> Bisection went down to the commit d3539347022a ("serial: 8250: Switch to
> nbcon console, take 2"). I found that the Braille console driver called
> braille_co->write() internally where braille_co pointed to the uart
> 8250 driver.
The Braille console blindly calling (struct console).write() is
obviously bad. This needs to be fixed. And not just because of the
8250. Other NBCON drivers already exist mainline and have this same
issue.
> I added the support for the nbcon console API similar way as we did
> for kdb [2].
kdb does not need to care about latencies. The Braille consoles do. I
will comment more on this in the related patch.
> Note 1: I believe that we have a bug in the kdb patch because we call
> con->write() atomic callback after entering the unsafe mode.
> But we should do so in the default "safe" mode.
Why do you believe this? kdb operates within an unsafe section so that
other CPUs cannot take ownership. (BTW: For kdb the other CPUs are
supposed to be quiesced, so there should not be any ownership attempts
anyway. The unsafe section is just an extra precaution.)
> Note 2: I am not completely sure about the locking. It might be better
> to use NBCON_PRIO_PANIC in panic().
Why does it matter? printk() is not trying to do any Braille printing
during panic, so it will not attempt to acquire the Braille console.
> Also I thought about using con->write_thread(). But I think
> that we have to use the atomic variant because the Braille
> console can be called from printk() via the VT code, aka
> graphical console.
How can it be called from printk()? Even printk() writing to VT is only
if it is registered as a console. Braille consoles are not registered.
Please explain.
Note that ->write_thread() is the only NBCON callback guaranteed to
exist.
John