Re: [PATCH] serial: core: Don't spin for nbcon ownership with the port lock held
From: John Ogness
Date: Tue Dec 01 2026 - 11:29:36 EST
On 2026-12-01, Eliav Farber <farbere@xxxxxxxxxx> wrote:
> If you want the trylock wrappers reused anyway, this keeps the assert
> valid and leaves the normal path on spin_lock():
>
> static inline void uart_port_lock(struct uart_port *up)
> {
> spin_lock(&up->lock);
> if (__uart_port_nbcon_try_acquire(up))
> return;
> spin_unlock(&up->lock);
>
> while (!uart_port_trylock(up))
> cpu_relax();
> }
>
> Which one do you want in v2?
Thanks for working out the details. My suggestion was a really bad
one. We do not want to convert spinlocks into busy-wait trylocks, even
for the nbcon case.
Your original version looks good. Sorry for the noise.
Reviewed-by: John Ogness <john.ogness@xxxxxxxxxxxxx>