LKML Archive on
 help / color / Atom feed
From: Jann Horn <>
To: Sergey Senozhatsky <>
Cc: Petr Mladek <>,
	Steven Rostedt <>,
	kernel list <>,
	Lech Perczak <>,
	Greg Kroah-Hartman <>,
	"Theodore Ts'o" <>,
	John Ogness <>
Subject: Re: [PATCHv2] printk: queue wake_up_klogd irq_work only if per-CPU areas are ready
Date: Wed, 1 Apr 2020 21:34:29 +0200
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Mar 3, 2020 at 12:30 PM Sergey Senozhatsky
<> wrote:
> printk_deferred(), similarly to printk_safe/printk_nmi,
> does not immediately attempt to print a new message on
> the consoles, avoiding calls into non-reentrant kernel
> paths, e.g. scheduler or timekeeping, which potentially
> can deadlock the system. Those printk() flavors, instead,
> rely on per-CPU flush irq_work to print messages from
> safer contexts. For same reasons (recursive scheduler or
> timekeeping calls) printk() uses per-CPU irq_work in
> order to wake up user space syslog/kmsg readers.
> However, only printk_safe/printk_nmi do make sure that
> per-CPU areas have been initialised and that it's safe
> to modify per-CPU irq_work. This means that, for instance,
> should printk_deferred() be invoked "too early", that
> is before per-CPU areas are initialised, printk_deferred()
> will perform illegal per-CPU access.
> Lech Perczak [0] reports that after commit 1b710b1b10ef
> ("char/random: silence a lockdep splat with printk()")
> user-space syslog/kmsg readers are not able to read new
> kernel messages. The reason is printk_deferred() being
> called too early (as was pointed out by Petr and John).
> Fix printk_deferred() and do not queue per-CPU irq_work
> before per-CPU areas are initialized.

I ran into the same issue during some development work, and Sergey
directed me to this patch. It fixes the problem for me. Thanks!

Tested-by: Jann Horn <>

      parent reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 11:30 Sergey Senozhatsky
2020-03-04 15:21 ` Petr Mladek
2020-03-05  1:30   ` Sergey Senozhatsky
2020-03-05 18:53     ` Greg Kroah-Hartman
2020-04-09 19:25       ` Simon Kirby
2020-04-10  3:07         ` Sergey Senozhatsky
2020-04-10 23:21           ` Sergey Senozhatsky
2020-04-01 19:34 ` Jann Horn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone