From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEukH-0003Jt-3I for qemu-devel@nongnu.org; Tue, 14 Jul 2015 03:35:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEukB-0001ZL-RA for qemu-devel@nongnu.org; Tue, 14 Jul 2015 03:35:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEukB-0001ZD-MC for qemu-devel@nongnu.org; Tue, 14 Jul 2015 03:35:11 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 4A3F219F25D for ; Tue, 14 Jul 2015 07:35:11 +0000 (UTC) From: Pankaj Gupta Date: Tue, 14 Jul 2015 13:04:54 +0530 Message-Id: <1436859294-20043-1-git-send-email-pagupta@redhat.com> Subject: [Qemu-devel] [PATCH 0/2 v2] virtio-rng: Avoid uncessary timer trigger to bump up quota value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, Pankaj Gupta , mst@redhat.com 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(-)