From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
Bug 1066055 <1066055@bugs.launchpad.net>,
qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
Subject: Re: [Qemu-devel] [PATCH] virtio: limit avail bytes lookahead
Date: Wed, 28 Nov 2012 23:53:08 +0200 [thread overview]
Message-ID: <20121128215308.GA23360@redhat.com> (raw)
In-Reply-To: <20121127162504.GA6210@redhat.com>
On Tue, Nov 27, 2012 at 06:25:04PM +0200, Michael S. Tsirkin wrote:
> On Thu, Nov 01, 2012 at 06:07:21PM +0200, Michael S. Tsirkin wrote:
> > Commit 0d8d7690850eb0cf2b2b60933cf47669a6b6f18f introduced
> > a regression in virtio-net performance because it looks
> > into the ring aggressively while we really only care
> > about a single packet worth of buffers.
> > To fix, add parameters limiting lookahead, and
> > use in virtqueue_avail_bytes.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
>
> Ping.
> Anthony - going to apply this?
virtio rng was added since so naturally build broke.
Here's a patch on top to fix it up. I never used virtio rng before so
could not test at this hour, but it does fix the build.
I'll take a look at how to test it tomorrow but any
info would be appreciated.
Amit could you pls review?
--
diff --git a/hw/virtio-rng.c b/hw/virtio-rng.c
index df329f2..a73ef8e 100644
--- a/hw/virtio-rng.c
+++ b/hw/virtio-rng.c
@@ -43,11 +43,11 @@ static bool is_guest_ready(VirtIORNG *vrng)
return false;
}
-static size_t get_request_size(VirtQueue *vq)
+static size_t get_request_size(VirtQueue *vq, unsigned quota)
{
unsigned int in, out;
- virtqueue_get_avail_bytes(vq, &in, &out);
+ virtqueue_get_avail_bytes(vq, &in, &out, quota, 0);
return in;
}
@@ -84,12 +84,18 @@ static void chr_read(void *opaque, const void *buf, size_t size)
static void virtio_rng_process(VirtIORNG *vrng)
{
size_t size;
+ unsigned quota;
if (!is_guest_ready(vrng)) {
return;
}
- size = get_request_size(vrng->vq);
+ if (vrng->quota_remaining < 0) {
+ quota = 0;
+ } else {
+ quota = MIN((uint64_t)vrng->quota_remaining, (uint64_t)UINT32_MAX);
+ }
+ size = get_request_size(vrng->vq, quota);
size = MIN(vrng->quota_remaining, size);
if (size) {
rng_backend_request_entropy(vrng->rng, size, chr_read, vrng);
next prev parent reply other threads:[~2012-11-28 21:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 17:34 [Qemu-devel] [Bug 1066055] [NEW] Network performance regression with vde_switch Edivaldo de Araujo Pereira
2012-10-15 8:58 ` Stefan Hajnoczi
2012-10-15 21:46 ` [Qemu-devel] [Bug 1066055] " Edivaldo de Araujo Pereira
2012-10-16 7:48 ` Stefan Hajnoczi
2012-10-22 11:18 ` Amit Shah
2012-10-22 13:50 ` Edivaldo de Araujo Pereira
2012-10-23 12:55 ` Stefan Hajnoczi
2012-11-01 9:19 ` Amit Shah
2012-11-01 12:04 ` Michael S. Tsirkin
2012-11-01 15:12 ` Amit Shah
2012-11-01 15:50 ` Michael S. Tsirkin
2012-11-01 16:07 ` [Qemu-devel] [PATCH] virtio: limit avail bytes lookahead Michael S. Tsirkin
2012-11-02 9:56 ` Amit Shah
2012-11-02 10:18 ` Stefan Hajnoczi
2012-11-02 14:48 ` Michael S. Tsirkin
2012-11-02 19:44 ` Stefan Hajnoczi
2012-11-27 16:25 ` Michael S. Tsirkin
2012-11-27 16:54 ` Edivaldo de Araujo Pereira
2012-11-27 19:47 ` Anthony Liguori
2012-11-28 21:53 ` Michael S. Tsirkin [this message]
2012-11-29 13:04 ` Amit Shah
2012-11-29 14:10 ` Michael S. Tsirkin
2012-11-29 19:02 ` Anthony Liguori
2012-11-29 22:39 ` Michael S. Tsirkin
2012-11-01 11:42 ` [Qemu-devel] [Bug 1066055] Re: Network performance regression with vde_switch Michael S. Tsirkin
2012-10-16 12:23 ` Edivaldo de Araujo Pereira
2012-10-17 13:51 ` Stefan Hajnoczi
2018-01-10 21:28 ` Thomas Huth
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=20121128215308.GA23360@redhat.com \
--to=mst@redhat.com \
--cc=1066055@bugs.launchpad.net \
--cc=amit.shah@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=edivaldoapereira@yahoo.com.br \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.