All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux@dominikbrodowski.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] random: do not take pool spinlock at boot
Date: Sun, 20 Feb 2022 21:34:56 -0800	[thread overview]
Message-ID: <YhMkgL3h6puTZX20@sol.localdomain> (raw)
In-Reply-To: <20220212002859.622233-1-Jason@zx2c4.com>

On Sat, Feb 12, 2022 at 01:28:59AM +0100, Jason A. Donenfeld wrote:
> Since rand_initialize() is run while interrupts are still off and
> nothing else is running, we don't need to repeatedly take and release
> the pool spinlock, especially in the RDSEED loop.
> 
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> Dominik - I'm still a bit unclear about early boot semantics that you
> seem to know well. Is this patch correct?
> 
>  drivers/char/random.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index d4b692c9de68..8088348190e6 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -966,10 +966,10 @@ int __init rand_initialize(void)
>  			rv = random_get_entropy();
>  			arch_init = false;
>  		}
> -		mix_pool_bytes(&rv, sizeof(rv));
> +		_mix_pool_bytes(&rv, sizeof(rv));
>  	}
> -	mix_pool_bytes(&now, sizeof(now));
> -	mix_pool_bytes(utsname(), sizeof(*(utsname())));
> +	_mix_pool_bytes(&now, sizeof(now));
> +	_mix_pool_bytes(utsname(), sizeof(*(utsname())));
>  
>  	extract_entropy(base_crng.key, sizeof(base_crng.key));
>  	++base_crng.generation;
> -- 
> 2.35.0

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

      parent reply	other threads:[~2022-02-21  5:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12  0:28 [PATCH] random: do not take pool spinlock at boot Jason A. Donenfeld
2022-02-12  5:04 ` kernel test robot
2022-02-12  5:35 ` kernel test robot
2022-02-12 10:01   ` Jason A. Donenfeld
2022-02-14  6:40     ` Chen, Rong A
2022-02-13  6:55 ` Dominik Brodowski
2022-02-21  5:34 ` Eric Biggers [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:
  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=YhMkgL3h6puTZX20@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.