Re: [RFC][PATCH 1/2] printk: lock console_sem before we unregister boot consoles
From: Sergey Senozhatsky
Date: Thu Apr 25 2019 - 03:56:14 EST
On (04/25/19 09:50), Petr Mladek wrote:
> > Sure we can.
> >
> > We also can take extra care of pr_info("%sconsole [%s%d] enabled\n".
> > Right now we do
> >
> > ...
> > console_unlock();
> > console_sysfs_notify();
> >
> > pr_info("%sconsole [%s%d] enabled\n",....
> >
> >
> > But we can simply move that pr_info() a bit up:
> >
> > pr_info("%sconsole [%s%d] enabled\n",
> > console_unlock();
> > console_sysfs_notify();
> >
> >
> > So the message will be printed on all consoles.
>
> Great idea!
>
> It would deserve a separate patch that moves the pr_info()
> and removes the invalid comment.
>
> Actually, the pr_info() would deserve a comment explaining
> why it should be called before console_unlock().
Good. So I think I'll drop patch #1 from the series, add
two more patches - invalid comment + pr_info() - and rework
locking in patch #3 (this should take care of a race which
patch #1 was intended to fix).
-ss