Subject: [PATCH 0/2 v2] virtio-rng: Avoid uncessary timer trigger to bump up quota value
Timer was added in virtio-rng to rate limit the entropy. It used to trigger at regular intervals to bump up the quota value. The value of quota and timer is used to ensure single guest should not use up all the entropy from the host. This resulted in triggering of timer even when quota is not exhausted at all and resulting in extra processing. This series has two patches: patch1 : Bump up quota value only when guest requests entropy. patch2 : Serve pending request if any after timer bumps up quota. Changes from v1: Amit Shah : Serve pending request if any after timer bumps up quota. Add testing details. I tested this with '/dev/urandom' at host side. Below are the details: * Quota+timer specified on command line, Ran in Guest 'dd if=/dev/hwrng of=/dev/null' - Quota (4096 bytes), Time slice (1000 ms) 48152 bytes (49 KB) copied, 12.0005 s, 4.1 kB/s 48640 bytes (49 KB) copied, 12.0014 s, 4.1 kB/s - Quota (8192), Time slice (1000 ms) 65536 bytes (66 KB) copied, 8.00088 s, 8.2 kB/s 146944 bytes (147 KB)copied, 18.0021 s, 8.2 kB/s - No quota/timer specified on command line, takes default values. Quota (INT64_MAX), Time slice(65536 ms) 8050688 bytes (8.1 MB) copied, 93.1198 s, 86.5 kB/s 35568128 bytes (36 MB) copied, 408.823 s, 87.0 kB/s hw/virtio/virtio-rng.c | 51 +++++++++++++++++++++++++---------------- include/hw/virtio/virtio-rng.h | 1 2 files changed, 33 insertions(+), 19 deletions(-)