mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	John Ogness <john.ogness@linutronix.de>,
	Mike Galbraith <efault@gmx.de>, Petr Mladek <pmladek@suse.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Theodore Ts'o <tytso@mit.edu>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v4] lib/vsprintf: defer filling siphash key on RT
Date: Mon, 1 Aug 2022 15:36:32 +0200	[thread overview]
Message-ID: <YufW4G/A3eQKpdjj@zx2c4.com> (raw)
In-Reply-To: <YufLK6hio/v1gfmq@linutronix.de>

Hi Sebastian,

On Mon, Aug 01, 2022 at 02:46:35PM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-08-01 14:39:46 [+0200], Jason A. Donenfeld wrote:
> > On RT, we can't call get_random_bytes() from inside of the raw locks
> > that callers of vsprintf might take, because get_random_bytes() takes
> > normal spinlocks. So on those RT systems, defer the siphash key
> > generation to a worker.
> > 
> > Also, avoid using a static_branch, as this isn't the fast path.
> > Using static_branch_likely() to signal that ptr_key has been filled is a
> > bit much given that it is not a fast path.
> > 
> > Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > Reported-by: Mike Galbraith <efault@gmx.de>
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> > Sebastian - feel free to take this and tweak it as needed. Sending this
> > mostly as something illustrative of what the "simpler" thing would be
> > that I had in mind. -Jason
> 
> Can have the same behaviour regardless of CONFIG_PREEMPT_RT? Here
> lockdep _may_ yell with !RT because it is broken for RT.
> If we agree that we drop the first %p print here, can we do this on
> both (regardless of CONFIG_PREEMPT_RT)?

"Lockdep may yell" -- but this would be when lockdep is turned on to
catch RT bugs, not to catch non-RT bugs. The actual bug only exists on
RT. This is an RT problem. Stop pretending that this is a real issue
outside of RT. It isn't. This is *only* an RT issue. So why would we
make things worse for an issue that doesn't actually exist on non-RT?

I too generally prefer having only one code path and not two. But the
way this patch is written, the worker function just gets reused with a
straight call on the non-RT case, so it doesn't actually require
duplicating code.

Jason

  reply	other threads:[~2022-08-01 13:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 15:47 [PATCH 0/2 v2] Init the hashed pointer from a worker Sebastian Andrzej Siewior
2022-07-29 15:47 ` [PATCH 1/2 v2] lib/vsprintf: Remove static_branch_likely() from __ptr_to_hashval() Sebastian Andrzej Siewior
2022-08-01 12:11   ` Jason A. Donenfeld
2022-08-01 12:41     ` Sebastian Andrzej Siewior
2022-08-01 12:13   ` Jason A. Donenfeld
2022-08-01 12:42     ` Sebastian Andrzej Siewior
2022-07-29 15:47 ` [PATCH 2/2 v2] lib/vsprintf: Initialize vsprintf's pointer hash once the random core is ready Sebastian Andrzej Siewior
2022-07-29 23:29   ` Jason A. Donenfeld
2022-08-01  7:32     ` Sebastian Andrzej Siewior
2022-08-01  9:34       ` [PATCH 2/2 v3] " Sebastian Andrzej Siewior
2022-08-01 12:36         ` Jason A. Donenfeld
2022-08-01 12:39           ` [PATCH v4] lib/vsprintf: defer filling siphash key on RT Jason A. Donenfeld
2022-08-01 12:46             ` Sebastian Andrzej Siewior
2022-08-01 13:36               ` Jason A. Donenfeld [this message]
2022-08-01 13:44                 ` Jason A. Donenfeld
2022-08-01 14:25                   ` Sebastian Andrzej Siewior
2022-08-01 14:30                     ` Jason A. Donenfeld
2022-08-01 13:47                 ` Sebastian Andrzej Siewior
2022-08-01 13:55                   ` Jason A. Donenfeld
2022-08-01 14:12                     ` [PATCH v5] " Jason A. Donenfeld
2022-08-01 14:26                       ` Sebastian Andrzej Siewior
2022-08-01 12:41           ` [PATCH 2/2 v3] lib/vsprintf: Initialize vsprintf's pointer hash once the random core is ready Sebastian Andrzej Siewior
2022-09-20 15:01         ` Jason A. Donenfeld
2022-09-23 10:36           ` Petr Mladek
2022-09-23 15:28             ` Sebastian Andrzej Siewior

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=YufW4G/A3eQKpdjj@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=efault@gmx.de \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tglx@linutronix.de \
    --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

Powered by JetHome