Messages in this thread | | | From | John Ogness <> | Subject | Re: [PATCH tty v1 06/74] serial: 8250: Use port lock wrappers | Date | Fri, 15 Sep 2023 13:27:05 +0206 |
| |
On 2023-09-15, Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote: >> @@ -3403,9 +3403,9 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, >> touch_nmi_watchdog(); >> >> if (oops_in_progress) >> - locked = spin_trylock_irqsave(&port->lock, flags); >> + locked = uart_port_trylock_irqsave(port, &flags); >> else >> - spin_lock_irqsave(&port->lock, flags); >> + uart_port_lock_irqsave(port, &flags); > > Not related to any problem (with this patch) but I'm a bit curious is > this construct going to remain there after the follow-up work?
Yes. The uart port lock already provides excellent coverage of unsafe regions in uart drivers. We want to take advantage of that.
> And there's the similar one in some other drivers (with some > variations related to local_irq_save()): > > if (port->sysrq) { > locked = 0; > } else if (oops_in_progress) { > locked = spin_trylock(&port->lock); > } else { > spin_lock(&port->lock); > locked = 1; > }
With the follow-up work we are introducing a new type of console (CON_NBCON) that supports atomic and threaded printing. Current console drivers must be converted if they want these features. When converting a driver to NBCON, such variations as above will need to be addressed. The follow-up work provides new functions and semantics to allow drivers to implement more reliable code than just: "trylock and keep going no matter what".
For console drivers that are _not_ converted to NBCON, the uart port lock wrappers will not provide any changed functionality.
John Ogness
| |