Re: [PATCHv2] printk: queue wake_up_klogd irq_work only if per-CPU areas are ready
From: Simon Kirby
Date: Thu Apr 09 2020 - 15:42:52 EST
On Thu, Mar 05, 2020 at 07:53:48PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 05, 2020 at 10:30:14AM +0900, Sergey Senozhatsky wrote:
> > On (20/03/04 16:21), Petr Mladek wrote:
> > [..]
> > > > Fix printk_deferred() and do not queue per-CPU irq_work
> > > > before per-CPU areas are initialized.
> > > >
> > > > [0] https://lore.kernel.org/lkml/aa0732c6-5c4e-8a8b-a1c1-75ebe3dca05b@xxxxxxxxxxxxxxxxxxxxxx/
> > > >
> > > > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> > > > Reported-by: Lech Perczak <l.perczak@xxxxxxxxxxxxxxxxxxxxxx>
> > > > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > > > Cc: Theodore Ts'o <tytso@xxxxxxx>
> > > > Cc: John Ogness <john.ogness@xxxxxxxxxxxxx>
> > >
> > > Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
> >
> > Thanks!
> >
> > > Now, the question is whether to hurry this fix into 5.6 or if
> > > it could wait for 5.7.
> > >
> > > I think that it could wait because 5.6 is not affected by
> > > the particular printk_deferred(). This patch fixes a long-term
> > > generic problem. But I am open for other opinions.
> >
> > Good question. My 5 cents, I would _probably_ push it now. Not
> > because it fixes any known issues on 5.6, but because we have
> > a number of LTS kernel (4.19, 4.14, 4.9, 4.4, 3.16) that can be
> > affected should 1b710b1b10eff9d4 be backported to those kernels.
>
> It was backported there, and now has been reverted. So no big rush from
> what I can tell.
This causes "dmesg -w" or "cat /dev/kmsg" to not print new messages after
dumping the current ring. I hit this on v5.5.9, v5.5.15, v5.6.3, and
Linus HEAD. This prints no "hi":
(sleep 1;echo hi > /dev/kmsg)& dmesg -w
...curiously, "strace dmesg -w" shows the data received once ^C is hit.
Jann pointed me to this patch. Applying it or reverting 1b710b1b10eff9d4
does fix it for me. However, Linus HEAD is still broken and, AFAICS,
remains unreverted and unfixed in stable/linux-5.4.y through linux-5.6.y.
It was introduced in 5.6 but backported to those, not just the LTS above.
Simon-