Skip to content

Commit

Permalink
random: do not take pool spinlock at boot
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zx2c4 authored and intel-lab-lkp committed Feb 12, 2022
1 parent 6d9bd4a commit cac377f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/char/random.c
Expand Up @@ -159,10 +159,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;
Expand Down

0 comments on commit cac377f

Please sign in to comment.