From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org, "Andy Lutomirski" <luto@kernel.org>,
"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Sultan Alsawaf" <sultan@kerneltoast.com>
Subject: Re: [PATCH v3 1/2] random: remove batched entropy locking
Date: Tue, 8 Feb 2022 15:44:23 -0800 [thread overview]
Message-ID: <YgMAV2Ps/k80w48M@sol.localdomain> (raw)
In-Reply-To: <20220207153914.365931-2-Jason@zx2c4.com>
On Mon, Feb 07, 2022 at 04:39:13PM +0100, Jason A. Donenfeld wrote:
> Rather than use spinlocks to protect batched entropy, we can instead
> disable interrupts locally, since we're dealing with per-cpu data, and
> manage resets with a basic generation counter. At the same time, we
> can't quite do this on PREEMPT_RT, where we still want spinlocks-as-
> mutexes semantics. So we use a local_lock_t, which provides the right
> behavior for each. Because this is a per-cpu lock, that generation
> counter is still doing the necessary CPU-to-CPU communication.
>
> This should improve performance a bit. It will also fix the linked splat
> that Jonathan received with a PROVE_RAW_LOCK_NESTING=y.
>
> Suggested-by: Andy Lutomirski <luto@kernel.org>
> Reported-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> Tested-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> Link: https://lore.kernel.org/lkml/YfMa0QgsjCVdRAvJ@latitude/
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Sultan Alsawaf <sultan@kerneltoast.com>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> drivers/char/random.c | 51 ++++++++++++++++++++++---------------------
> 1 file changed, 26 insertions(+), 25 deletions(-)
Looks good. The comment above invalidate_batched_entropy() needs to be updated,
though.
Also, please Cc patches for random.c to linux-crypto.
- Eric
next prev parent reply other threads:[~2022-02-08 23:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 15:39 [PATCH v3 0/2] random: PREEMPT_RT fixes Jason A. Donenfeld
2022-02-07 15:39 ` [PATCH v3 1/2] random: remove batched entropy locking Jason A. Donenfeld
2022-02-08 23:44 ` Eric Biggers [this message]
2022-02-09 0:24 ` Jason A. Donenfeld
2022-02-07 15:39 ` [PATCH v3 2/2] random: defer fast pool mixing to worker Jason A. Donenfeld
2022-02-09 0:12 ` Eric Biggers
2022-02-09 0:36 ` Jason A. Donenfeld
2022-02-09 12:49 ` Jason A. Donenfeld
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=YgMAV2Ps/k80w48M@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=bigeasy@linutronix.de \
--cc=j.neuschaefer@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=sultan@kerneltoast.com \
/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®