mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: John Ogness <john.ogness@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: defer_console_output: do not assume interrupts disabled
Date: Thu, 3 Feb 2022 12:33:35 +0100	[thread overview]
Message-ID: <Yfu9j1VN/YP8cqza@linutronix.de> (raw)
In-Reply-To: <20220203112915.1350753-1-john.ogness@linutronix.de>

On 2022-02-03 12:35:15 [+0106], John Ogness wrote:
> With commit 458df9fd4815 ("printk: remove separate printk_sched
> buffers and use printk buf instead") defer_console_output() was
> changed to no longer disable interrupts. However, it used the
> function __this_cpu_or(), which assumes interrupts disabled. That
> also should have been changed to this_cpu_or().
> 
> Although defer_console_output() is mostly used when interrupts are
> disabled, this is not always the case. One example is
> get_random_bytes(), which is often called with interrupts enabled.

It is okay for __this_cpu_or() to be invoked with disabled preemption if
that is true for all callers. Disabled interrupts or not is not
important as long as there are no callers in_irq(). I believe that there
are callers in_irq() and therefore this_cpu_or() is correct.

>   get_random_bytes()
>     warn_unseeded_randomness()
>       printk_deferred()
> 
> Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>

Sebastian

  reply	other threads:[~2022-02-03 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 11:29 John Ogness
2022-02-03 11:33 ` Sebastian Andrzej Siewior [this message]
2022-02-04  7:04 ` Sergey Senozhatsky
2022-02-07  9:46   ` [PATCH v2] printk: defer_console_output: use atomic update John Ogness
2022-02-10 15:47     ` Petr Mladek
2022-02-11 11:22       ` John Ogness
2022-02-11 11:23         ` [PATCH v3] printk: use atomic updates for klogd work John Ogness
2022-02-14  5:35           ` Sergey Senozhatsky
2022-02-15 15:26           ` Petr Mladek
2022-02-14  5:32         ` [PATCH v2] printk: defer_console_output: use atomic update Sergey Senozhatsky
2022-02-14  5:35           ` 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=Yfu9j1VN/YP8cqza@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /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

all inboxes | Powered by JetHome®