From patchwork Fri Nov 9 13:27:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 198059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B055B2C00A3 for ; Sat, 10 Nov 2012 00:28:44 +1100 (EST) Received: from localhost ([::1]:48878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWodW-0000zJ-Rx for incoming@patchwork.ozlabs.org; Fri, 09 Nov 2012 08:28:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWocj-0007Bs-6t for qemu-devel@nongnu.org; Fri, 09 Nov 2012 08:27:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWocf-0002lq-7j for qemu-devel@nongnu.org; Fri, 09 Nov 2012 08:27:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWoce-0002lj-Vf for qemu-devel@nongnu.org; Fri, 09 Nov 2012 08:27:49 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA9DRlOO032594 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 9 Nov 2012 08:27:47 -0500 Received: from localhost (ovpn-113-126.phx2.redhat.com [10.3.113.126]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qA9DRkrf012399; Fri, 9 Nov 2012 08:27:46 -0500 From: Amit Shah To: Anthony Liguori Date: Fri, 9 Nov 2012 14:27:30 +0100 Message-Id: <9b8faccff994b2eb608fe7a7a9785a7e2d736db4.1352466944.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Amit Shah , pbonzini@redhat.com, hpa@zytor.com, qemu list , afaerber@suse.de Subject: [Qemu-devel] [PATCH 2/3] virtio-rng: remove extra request for entropy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If we just got a few bytes from the backends, but the guest is ready to accept more, don't poke the backends once more for more bytes; it already knows (from the request in handle_input()). Signed-off-by: Amit Shah --- hw/virtio-rng.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-) diff --git a/hw/virtio-rng.c b/hw/virtio-rng.c index 42ac30b..bb19cfa 100644 --- a/hw/virtio-rng.c +++ b/hw/virtio-rng.c @@ -70,16 +70,6 @@ static void chr_read(void *opaque, const void *buf, size_t size) virtqueue_push(vrng->vq, &elem, len); } virtio_notify(&vrng->vdev, vrng->vq); - - /* - * Lastly, if we had multiple elems queued by the guest, and we - * didn't have enough data to fill them all, indicate we want more - * data. - */ - len = pop_an_elem(vrng); - if (len) { - rng_backend_request_entropy(vrng->rng, size, chr_read, vrng); - } } static void handle_input(VirtIODevice *vdev, VirtQueue *vq)