Re: [PATCH next v2 3/4] serial: 8250: Switch to nbcon console

Petr Mladek
2024-09-18T12:26:43Z

On Fri 2024-09-13 16:11:37, John Ogness wrote:
> Implement the necessary callbacks to switch the 8250 console driver
> to perform as an nbcon console.
>
> Add implementations for the nbcon console callbacks (write_atomic,
> write_thread, device_lock, device_unlock) and add CON_NBCON to the
> initial flags.
>
> All register access in the callbacks are within unsafe sections.
> The write_thread() callback allows safe handover/takeover per byte.
> The write_atomic() callback allows safe handover/takeover per
> printk record and adds a preceding newline if it took over mid-line.
>
> For the write_atomic() case, a new irq_work is used to defer modem
> control since it may be a context that does not allow waking up
> tasks.

It would be fair to mention that it does not longer support fifo in
the 8250 driver. It basically reverted the commit 8f3631f0f6eb42e5
("serial/8250: Use fifo in 8250 console driver").

It is not usable in write_thread() because it would not allow
a safe takeover between emitting particular characters.

It might still be used in write_atomic() but it is probably not
worth it. This callback is used "only" in emergency and panic
situations.

> Signed-off-by: John Ogness <john.ogness@linutronix.de>

Otherwise, it looks good to me. And it even works fine.
With an updated commit message:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr