Skip to content

Convert timekeeping core to use printk_deferred (v2)

John Stultz lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Changes since v1 from the cover letter

* Rebased on next/akpm, since there are queued prink patches there
* Re-added irqsave/restore per irc discussion w/ PeterZ

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4printk: Re-add irqsave/restore in printk_schedkernel/printk/printk.c+3 -03 replies
2/4printk: Rename printk_sched to printk_deferredinclude/linux/printk.h kernel/printk/printk.c kernel/sched/core.c +2 more+7 -70 replies
3/4printk: Add printk_once_deferredinclude/linux/printk.h kernel/sched/deadline.c kernel/sched/rt.c+13 -130 replies
4/4timekeeping: Use printk_deferred when holding timekeeping seqlockkernel/time/ntp.c kernel/time/timekeeping.c+13 -90 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSteven Rostedt
SeriesR-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] Convert timekeeping core to use printk_deferred (v2)

Recently, Jiri pointed out a potential deadlock when calling printk while holding the timekeeping seqlock.

Annoyingly, the seqlock lockdep enablement doesn't catch this, as printk disables lockdep.

When looking for possible solutions, one idea was to use a local buffer and defer the printk to later. Ends up there is already similar functionality in printk_sched() to avoid similar style deadlocks w/ the scheduler.

Thus this patchset (based on next/akpm) renames printk_sched to printk_deferred and then moves the affected timekeeping printks to make use of it.

There were some points in the discussion between Jan and Peter that made it seem that there may still be problems lurking in the console layer, and I'm not sure I fully understand their point, so this solution may be incomplete.

Additionally, the same issue likely affects any WARN_ONs as well, but I wanted to get some thoughts on this approach before trying to remove or convert affected WARN_ONS.

Your thoughts and feedback are greatly appreciated!

thanks
-john

Changes since v1:
* Rebased on next/akpm, since there are queued prink patches there
* Re-added irqsave/restore per irc discussion w/ PeterZ

Cc Jan Kara <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Jiri Bohac <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Steven Rostedt <[email protected]>

John Stultz (4):
printk: Re-add irqsave/restore in printk_sched
printk: Rename printk_sched to printk_deferred
printk: Add printk_once_deferred
timekeeping: Use printk_deferred when holding timekeeping seqlock

 include/linux/printk.h    | 17 ++++++++++++++---
 kernel/printk/printk.c    |  5 ++++-
 kernel/sched/core.c       |  2 +-
 kernel/sched/deadline.c   |  7 +------
 kernel/sched/rt.c         |  8 +-------
 kernel/time/ntp.c         | 15 +++++++++------
 kernel/time/timekeeping.c |  7 ++++---
 7 files changed, 34 insertions(+), 27 deletions(-)
Signature · 1 line
1.9.1