locking/ww_mutex/test: Use prng instead of rng to avoid hangs at bootup
authorJohn Stultz <jstultz@google.com>
Fri, 22 Sep 2023 04:35:59 +0000 (04:35 +0000)
committerIngo Molnar <mingo@kernel.org>
Fri, 22 Sep 2023 07:43:40 +0000 (09:43 +0200)
commit4812c54dc0498c4b757cbc7f41c1999b5a1c9f67
tree224042a8312d473a7d31ba30dc36b2b04036ed27
parent0f4b5f972216782a4acb1ae00dcb55173847c2ff
locking/ww_mutex/test: Use prng instead of rng to avoid hangs at bootup

Booting w/ qemu without kvm, and with 64 cpus, I noticed we'd
sometimes hung task watchdog splats in get_random_u32_below()
when using the test-ww_mutex stress test.

While entropy exhaustion is no longer an issue, the RNG may be
slower early in boot. The test-ww_mutex code will spawn off
128 threads (2x cpus) and each thread will call
get_random_u32_below() a number of times to generate a random
order of the 16 locks.

This intense use takes time and without kvm, qemu can be slow
enough that we trip the hung task watchdogs.

For this test, we don't need true randomness, just mixed up
orders for testing ww_mutex lock acquisitions, so it changes
the logic to use the prng instead, which takes less time
and avoids the watchdgos.

Feedback would be appreciated!

Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230922043616.19282-2-jstultz@google.com
kernel/locking/test-ww_mutex.c