From: Amit Shah <amit.shah@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Amit Shah <amit.shah@redhat.com>,
thuth@redhat.com, lprosek@redhat.com,
qemu list <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PULL 6/6] virtio-rng: ask for more data if queue is not fully drained
Date: Thu, 3 Mar 2016 18:07:11 +0530 [thread overview]
Message-ID: <f8693c2cd06d0401007b2c168126ab907f6da345.1457008497.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1457008496.git.amit.shah@redhat.com>
In-Reply-To: <cover.1457008496.git.amit.shah@redhat.com>
From: Ladi Prosek <lprosek@redhat.com>
This commit effectively reverts:
commit 4621c1768ef5d12171cca2aa1473595ecb9f1c9e
Author: Amit Shah <amit.shah@redhat.com>
Date: Wed Nov 21 11:21:19 2012 +0530
virtio-rng: remove extra request for entropy
but instead of calling virtio_rng_process unconditionally, it
first checks to see if the queue is empty as a little bit of
optimization.
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-Id: <1456998514-19271-1-git-send-email-lprosek@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/virtio/virtio-rng.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 17da2f8..d713464 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -69,6 +69,13 @@ static void chr_read(void *opaque, const void *buf, size_t size)
g_free(elem);
}
virtio_notify(vdev, vrng->vq);
+
+ if (!virtio_queue_empty(vrng->vq)) {
+ /* If we didn't drain the queue, call virtio_rng_process
+ * to take care of asking for more data as appropriate.
+ */
+ virtio_rng_process(vrng);
+ }
}
static void virtio_rng_process(VirtIORNG *vrng)
--
2.5.0
next prev parent reply other threads:[~2016-03-03 12:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 12:37 [Qemu-devel] [PULL 0/6] virtio-rng Amit Shah
2016-03-03 12:37 ` [Qemu-devel] [PULL 1/6] MAINTAINERS: Add an entry for the include/sysemu/rng*.h files Amit Shah
2016-03-03 12:37 ` [Qemu-devel] [PULL 2/6] rng: remove the unused request cancellation code Amit Shah
2016-03-03 12:37 ` [Qemu-devel] [PULL 3/6] rng: move request queue from RngEgd to RngBackend Amit Shah
2016-03-03 12:37 ` [Qemu-devel] [PULL 4/6] rng: move request queue cleanup " Amit Shah
2016-03-03 12:37 ` [Qemu-devel] [PULL 5/6] rng: add request queue support to rng-random Amit Shah
2016-03-03 12:37 ` Amit Shah [this message]
2016-03-03 13:58 ` [Qemu-devel] [PULL 0/6] virtio-rng Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8693c2cd06d0401007b2c168126ab907f6da345.1457008497.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=lprosek@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).