Re: replay log: Re: [PATCH printk v4 38/39] printk: relieve console_lock of list synchronization duties

From: Petr Mladek
Date: Tue Nov 15 2022 - 11:41:33 EST


On Tue 2022-11-15 16:34:10, Petr Mladek wrote:
> On Mon 2022-11-14 17:35:31, John Ogness wrote:
> > The console_list_lock provides synchronization for console list and
> > console->flags updates. All call sites that were using the console_lock
> > for this synchronization have either switched to use the
> > console_list_lock or the SRCU list iterator.
> >
> > Remove console_lock usage for console list updates and console->flags
> > updates.
> >
> > Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
>
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -3334,6 +3330,11 @@ void register_console(struct console *newcon)
> > * boot console that is the furthest behind.
> > */
> > if (bootcon_registered && !keep_bootcon) {
> > + /*
> > + * Hold the console_lock to guarantee safe access to
> > + * console->seq.
> > + */
> > + console_lock();
> > for_each_console(con) {
> > if ((con->flags & CON_BOOT) &&
> > (con->flags & CON_ENABLED) &&
> > @@ -3341,6 +3342,7 @@ void register_console(struct console *newcon)
> > newcon->seq = con->seq;
> > }
> > }
> > + console_unlock();
>
> Thinking more about it. This console_unlock() will actually cause
> flushing the boot consoles. A solution would be to call
> console_flush_all() here.
>
> And we could/should solve this in a separate patch. This code was not locked
> before. It is a corner case. It could be solved later.
>
> > }
> > }
> >

The rest of the patch looks fine. I checked hopefully console_list walks
and console flags manipulations and everything looks good.

So, without the above two hunks:

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr