Re: locking API: was: [PATCH printk v1 00/18] serial: 8250: implement non-BKL console

From: Petr Mladek
Date: Wed Mar 29 2023 - 04:03:53 EST


On Tue 2023-03-28 23:53:16, John Ogness wrote:
> On 2023-03-28, Petr Mladek <pmladek@xxxxxxxx> wrote:
> >> If an atomic context loses ownership while doing certain activities,
> >> it may need to re-acquire ownership in order to finish or cleanup
> >> what it started.
> >
> > This sounds suspicious. If a console/writer context has lost the lock
> > then all shared/locked resources might already be used by the new
> > owner.
>
> Correct.
>
> > I would expect that the context could touch only non-shared resources
> > after loosing the lock.
>
> Correct.
>
> The 8250 driver must disable interrupts before writing to the TX
> FIFO. After writing it re-enables the interrupts. However, it might be
> the case that the interrupts were already disabled, in which case after
> writing they are left disabled.

I see. The reacquire() makes sense now.

Thanks a lot for explanation.

Best Regards,
Petr