linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Make printk_deferred() work properly before percpu setup is done
@ 2020-03-26 16:32 Jann Horn
  2020-03-26 16:32 ` [PATCH 1/2] irq_work: Reinitialize list heads for secondary CPUs Jann Horn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jann Horn @ 2020-03-26 16:32 UTC (permalink / raw)
  To: Peter Zijlstra, Petr Mladek, Sergey Senozhatsky
  Cc: linux-kernel, Dennis Zhou, Tejun Heo, Christoph Lameter,
	Steven Rostedt, Thomas Gleixner, Frederic Weisbecker

While I was doing some development work, I noticed that if you call
printk_deferred() before percpu setup has finished, stuff breaks, and
e.g. "dmesg -w" fails to print new messages.

This happens because writing to percpu memory before percpu
initialization is done causes the modified percpu memory to be
propagated from the boot CPU to all the secondary CPUs; and both the
printk code as well as the irq_work implementation use percpu memory.

I think that printk_deferred() ought to work even before percpu
initialization, since it is used by things like pr_warn_ratelimited()
and the unwinder infrastructure. I'm not entirely sure though whether
this is the best way to implement that, or whether it would be better to
let printk_deferred() do something different if it is called during
early boot.

Jann Horn (2):
  irq_work: Reinitialize list heads for secondary CPUs
  printk: Reinitialize klogd percpu state for secondary CPUs

 kernel/irq_work.c      | 22 ++++++++++++++++++++++
 kernel/printk/printk.c | 23 +++++++++++++++++++++++
 2 files changed, 45 insertions(+)


base-commit: 76ccd234269bd05debdbc12c96eafe62dd9a6180
-- 
2.25.1.696.g5e7596f4ac-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-27  3:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 16:32 [PATCH 0/2] Make printk_deferred() work properly before percpu setup is done Jann Horn
2020-03-26 16:32 ` [PATCH 1/2] irq_work: Reinitialize list heads for secondary CPUs Jann Horn
2020-03-26 16:32 ` [PATCH 2/2] printk: Reinitialize klogd percpu state " Jann Horn
2020-03-27  2:45 ` [PATCH 0/2] Make printk_deferred() work properly before percpu setup is done Sergey Senozhatsky
2020-03-27  3:05   ` Jann Horn
2020-03-27  3:11     ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).