Skip to content
Snippets Groups Projects
Commit 73bac492 authored by Avi Kivity's avatar Avi Kivity Committed by Pekka Enberg
Browse files

virtio-rng: fix excessive serialization with multiple consumers


Suppose N threads try to acquire a byte of entropy from an empty pool.  They
will all serialize on the mutex, waiting for the pool to refill.  However,
when the pool is eventually refilled, only one consumer will be awakened;
the rest will continue sleeping even though there is entropy available in the
pool.  They will eventually be awakened when the worker refills the pool,
but that's unneeded latency.

Fix by using wake_all() to wake all consumers.

Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent df4bb086
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment