mbox series

[next,v2,0/4] convert 8250 to nbcon

Message ID 20240913140538.221708-1-john.ogness@linutronix.de
Headers show
Series convert 8250 to nbcon | expand

Message

John Ogness Sept. 13, 2024, 2:05 p.m. UTC
The recent printk rework introduced a new type of console NBCON
that will perform printing via a dedicated kthread during
normal operation. For times when the kthread is not available
(early boot, panic, reboot/shutdown) the NBCON console will
print directly from the printk() calling context (even if from
NMI).

Futher details about NBCON consoles are in the cover letter of
v1 of the NBCON series [0]. (Note that they were originally
named NOBKL consoles, but were later renamed to NBCON.)

This is v2 of a series to convert the 8250 driver to an NBCON
console, providing both threaded and atomic printing
implementations. v1 of this series is here [1].

Users can verify the UART console is an NBCON console via the
proc filesystem. For example:

$  cat /proc/consoles
ttyS0                -W- (EC N  a)    4:64

The 'N' shows that it is an NBCON console.

There will also be a dedicated printing kthread. For example:

$ ps ax | grep pr/
   16 root       0:00 [pr/ttyS0]

Derek Barbosa performed extensive tests [2] using this driver
and encountered no issues. On the contrary, his tests showed
the improved reliability and non-interference features of the
NBCON-based driver.

Since this is the first console driver to be converted to an
NBCON console, it may include variables and functions that
could be abstracted to all UART consoles (such as the
@console_line_ended field). However, we can abstract such
things later as more consoles are converted to NBCON.

Here are the changes since v1:

- Remove legacy write() code rather than hide it under the
  macro USE_SERIAL_8250_LEGACY_CONSOLE.

- Implement write_atomic() support for RS485 by splitting out
  the IER register modifications into separate wrapper
  functions.

- Update the RS485 call sites to use the new wrapper functions.

- Implement write_atomic() support for modem control by
  deferring to a new dedicated irq_work.

- Rename @console_newline_needed to @console_line_ended and
  invert the logic.

Note that this series is based on the "for-next" branch of the
printk git [3]. This is because the tty-next tree does not have
the NBCON series and thus causes problems for the kbuild
robots. However, this series does apply cleanly on the tty-next
tree (it just will not build).

John Ogness

[0] https://lore.kernel.org/lkml/20230302195618.156940-1-john.ogness@linutronix.de
[1] https://lore.kernel.org/lkml/20240905134719.142554-1-john.ogness@linutronix.de
[2] https://lore.kernel.org/lkml/ZsdoD6PomBRsB-ow@debarbos-thinkpadt14sgen2i.remote.csb
[3] https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git

John Ogness (4):
  serial: 8250: Split out IER from rs485_start_tx()
  serial: 8250: Split out IER from rs485_stop_tx()
  serial: 8250: Switch to nbcon console
  serial: 8250: Revert "drop lockdep annotation from
    serial8250_clear_IER()"

 drivers/tty/serial/8250/8250.h      |   3 +
 drivers/tty/serial/8250/8250_core.c |  35 +++-
 drivers/tty/serial/8250/8250_omap.c |   2 +-
 drivers/tty/serial/8250/8250_port.c | 248 ++++++++++++++++++----------
 include/linux/serial_8250.h         |   9 +-
 5 files changed, 200 insertions(+), 97 deletions(-)


base-commit: b794563ea12fb46d9499da9e30c33d9607e33697