Skip to contentSkip to conversation

printk: queue wake_up_klogd irq_work only if per-CPU areas are ready

DISCUSSION Sergey Senozhatsky 2 participants 4 messages Apr 14, 2020 – Jul 20, 2020 Stable branch

lore
Share & tools
lore
maintainer
#1 lore raw
Quoted 11 lines · Sergey Senozhatsky

Hello,

Commit ab6f762f0f53162d41 Linus' HEAD.

printk_deferred() does not make sure that it's safe to write to per-CPU data, which causes problems when printk_deferred() is invoked "too early", before per-CPU areas are initialized. There are multiple bug reports, e.g.
https://bugzilla.kernel.org/show_bug.cgi?id=206847

	-ss

So where do you want this commit backported to?

thanks,
greg k-h

#2 lore raw
Quoted 11 lines · Greg KH
Quoted 10 lines · Sergey Senozhatsky

Hello,

Commit ab6f762f0f53162d41 Linus' HEAD.

printk_deferred() does not make sure that it's safe to write to per-CPU data, which causes problems when printk_deferred() is invoked "too early", before per-CPU areas are initialized. There are multiple bug reports, e.g.
https://bugzilla.kernel.org/show_bug.cgi?id=206847

Quoted 3 lines
Quoted 1 line
	-ss

So where do you want this commit backported to?

Well, printk() is affected in all the kernels where printk_deferred() relies on per-CPU data. Which may translate to "pretty much all current stable kernels?" This patch, however, uses printk_safe() bits, so it won't apply on pre-printk_safe() kernels (not sure if we have such -stable kernels though).

	-ss
maintainer
#3 lore raw
Quoted 14 lines · Sergey Senozhatsky
Quoted 13 lines · Greg KH
Quoted 11 lines · Sergey Senozhatsky

Hello,

Commit ab6f762f0f53162d41 Linus' HEAD.

printk_deferred() does not make sure that it's safe to write to per-CPU data, which causes problems when printk_deferred() is invoked "too early", before per-CPU areas are initialized. There are multiple bug reports, e.g.
https://bugzilla.kernel.org/show_bug.cgi?id=206847

	-ss
Quoted 8 lines
Quoted 1 line

So where do you want this commit backported to?

Well, printk() is affected in all the kernels where printk_deferred() relies on per-CPU data. Which may translate to "pretty much all current stable kernels?" This patch, however, uses printk_safe() bits, so it won't apply on pre-printk_safe() kernels (not sure if we have such -stable kernels though).

This is already in the 5.4.y tree, so I've added it to 4.19.y, but I could not apply it to anything older (4.14.y, 4.9.y, 4.4.y) as it did not apply there.

If you want it in those older kernels, and you think it is really needed, please feel free to send a backported version for them.

thanks,

greg k-h