Skip to content

printk: Deadlock in NMI regression

Petr Mladek lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 16 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3printk: Split the code for storing a message into the log bufferkernel/printk/printk.c+26 -171 reply
2/3printk: Create helper function to queue deferred console handlingkernel/printk/printk.c+9 -52 replies
3/3printk/nmi: Prevent deadlock when accessing the main log buffer in NMIinclude/linux/printk.h kernel/printk/internal.h kernel/printk/printk_safe.c +2 more+52 -265 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchSergey Senozhatsky
1/3A-b
2/3A-b
3/3A-b

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

Read the v2 thread

Cover letter [PATCH v2 0/3] printk: Deadlock in NMI regression

The commit 719f6a7040f1bdaf96 ("printk: Use the main logbuf in NMI when logbuf_lock is available") brought back the possible deadlocks in printk() and NMI.

This is rework of the proposed fix, see
https://lkml.kernel.org/r/[email protected]

I realized that we could rather easily move the check to vprintk_func() and still avoid any race. I believe that this is a win-win solution.

Changes against v1:

+ Move the check from vprintk_emit() to vprintk_func()
+ More straightforward commit message
+ Fix build with CONFIG_PRINTK_NMI disabled

Petr Mladek (3):
printk: Split the code for storing a message into the log buffer
printk: Create helper function to queue deferred console handling printk/nmi: Prevent deadlock when accessing the main log buffer in NMI

 include/linux/printk.h      |  4 ++++
 kernel/printk/internal.h    |  9 ++++++-
 kernel/printk/printk.c      | 57 +++++++++++++++++++++++++++-----------------
 kernel/printk/printk_safe.c | 58 +++++++++++++++++++++++++++++----------------
 kernel/trace/trace.c        |  4 +++-
 lib/nmi_backtrace.c         |  3 ---
 6 files changed, 87 insertions(+), 48 deletions(-)
Signature · 1 line
2.13.7