Re: [PATCH printk v1 01/13] printk: rename cpulock functions

From: Sergey Senozhatsky
Date: Mon Feb 14 2022 - 01:49:16 EST


On (22/02/11 13:44), Petr Mladek wrote:
> On Mon 2022-02-07 20:49:11, John Ogness wrote:
> > Since the printk cpulock is CPU-reentrant and since it is used
> > in all contexts, its usage must be carefully considered and
> > most likely will require programming locklessly. To avoid
> > mistaking the printk cpulock as a typical lock, rename it to
> > cpu_sync. The main functions then become:
> >
> > printk_cpu_sync_get_irqsave(flags);
> > printk_cpu_sync_put_irqrestore(flags);
>
> It is possible that I will understand the motivation later when
> reading the entire patchset. But my initial reaction is confusion ;-)
>
> From mo POV, it is a lock. It tries to get exclusive access and
> has to wait until the current owner releases it.

printk has been using enter/exit naming for a while now (starting with
nmi enter/exit, then printk_safe enter/exit and soon direct enter/exit);
so may be we can follow suit here and use printk_cpu_sync_enter() and
printk_cpu_sync_exit()?


> After all the word "lock" is part of "deadlock".

That's a good one.