Skip to content

Make printk_deferred() work properly before percpu setup is done

Jann Horn lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2irq_work: Reinitialize list heads for secondary CPUskernel/irq_work.c+22 -00 replies
2/2printk: Reinitialize klogd percpu state for secondary CPUskernel/printk/printk.c+23 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Make printk_deferred() work properly before percpu setup is done

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

Signature · 1 line
2.25.1.696.g5e7596f4ac-goog