linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: "Steven Rostedt" <rostedt@goodmis.org>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Lech Perczak" <l.perczak@camlintechnologies.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Krzysztof Drobiński" <k.drobinski@camlintechnologies.com>,
	"Pawel Lenkow" <p.lenkow@camlintechnologies.com>,
	"John Ogness" <john.ogness@linutronix.de>,
	"Tejun Heo" <tj@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>
Subject: Re: Regression in v4.19.106 breaking waking up of readers of /proc/kmsg and /dev/kmsg
Date: Mon, 2 Mar 2020 10:49:07 +0100	[thread overview]
Message-ID: <20200302094907.qdbhe6iobegah56t@pathway.suse.cz> (raw)
In-Reply-To: <20200301052219.GA83612@google.com>

On Sun 2020-03-01 14:22:19, Sergey Senozhatsky wrote:
> On (20/02/29 18:47), Steven Rostedt wrote:
> [..]
> > > > What do folks think?  
> > > 
> > > Well, my 5 cents, there is nothing that prevents "too-early"
> > > printk_deferred() calls in the future. From that POV I'd probably
> > > prefer to "forbid" printk_deffered() to touch per-CPU deferred
> > > machinery until it's not "too early" anymore. Similar to what we
> > > do in printk_safe::queue_flush_work().
> > 
> > I agree that printk_deferred() should handle being called too early.
> > But the issue is with per_cpu variables correct? Not the irq_work?
> 
> Correct. printk_deferred() and printk_safe()/printk_nmi() irq_works
> are per-CPU. We use "a special" flag in printk_safe()/printk_nmi() to
> tell if it's too early to modify per-CPU irq_work or not.
> 
> I believe that we need to use that flag for all printk-safe/nmi
> per-CPU data, including buffers, not only for irq_work. Just in
> case if printk_safe or printk_nmi, somehow, are being called too
> early.
> 
> > We could add a flag in init/main.c after setup_per_cpu_areas() and then
> > just have printk_deferred() act like a normal printk(). At that point,
> > there shouldn't be an issue in calling printk() directly, is there?
> 
> Sure, this will work. I believe we introduced a "work around" approach
> in printk-safe because noone would ACK a global init/main.c flag for
> printk(). If we can land a "per_cpu_areas_ready" flag (I've some doubts
> here), then yes (!), let's use it and let's remove printk-safe workaround.

A compromise might be to set a flag in setup_log_buf(). It is called
much earlier but it seems to be safe enough.

mm_init() is called close after setup_log_buf(). And it seems to be
using per-cpu variables when creating caches, see:

  + mm_init()
    + kmem_cache_init()
      + create_boot_cache()
        + __kmem_cache_create()
	  + setup_cpu_cache()

It is just a detail. But I would make the flag independent
on the existing printk_safe stuff. printk_safe will get removed
with the lockless printk buffer. While the irq_work() will still
be needed for the wakeup functions.

Sergey, do you agree and want to update your patch accordingly?

Best Regards,
Petr

  reply	other threads:[~2020-03-02  9:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 11:09 Regression in v4.19.106 breaking waking up of readers of /proc/kmsg and /dev/kmsg Lech Perczak
2020-02-27 12:36 ` Greg Kroah-Hartman
2020-02-27 12:39   ` Lech Perczak
2020-02-27 14:08     ` Lech Perczak
2020-02-28  3:13       ` Sergey Senozhatsky
2020-02-28  9:11         ` John Ogness
2020-02-28 12:02           ` Sergey Senozhatsky
2020-02-28 10:04         ` Petr Mladek
2020-02-28 10:58           ` Greg Kroah-Hartman
2020-02-28 11:32             ` Petr Mladek
2020-02-28 11:39               ` Greg Kroah-Hartman
2020-02-28 13:02               ` Petr Mladek
2020-02-28 13:41                 ` Greg Kroah-Hartman
2020-02-28 20:53                 ` Theodore Y. Ts'o
2020-02-29  3:32                   ` Sergey Senozhatsky
2020-02-29  4:08                     ` Sergey Senozhatsky
2020-02-29 23:47                     ` Steven Rostedt
2020-03-01  5:22                       ` Sergey Senozhatsky
2020-03-02  9:49                         ` Petr Mladek [this message]
2020-03-02  9:59                           ` Sergey Senozhatsky
2020-02-28 11:49           ` Sergey Senozhatsky

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20200302094907.qdbhe6iobegah56t@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=k.drobinski@camlintechnologies.com \
    --cc=l.perczak@camlintechnologies.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.lenkow@camlintechnologies.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tj@kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).