From: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
To: Amit Shah <amit.shah@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
Bug 1066055 <1066055@bugs.launchpad.net>
Subject: Re: [Qemu-devel] [PATCH] virtio: limit avail bytes lookahead
Date: Tue, 27 Nov 2012 08:54:26 -0800 (PST) [thread overview]
Message-ID: <1354035266.55841.YahooMailClassic@web163902.mail.gq1.yahoo.com> (raw)
In-Reply-To: <20121127162504.GA6210@redhat.com>
Dear friends,
Please excuse-me for not reporting earlier... I confirm that the patch by Michael really fixes the problem I've reported. The regression has gone away when I used it, so I think it is good to be applied.
Thanks,
Edivaldo de Araújo Pereira
--- Em ter, 27/11/12, Michael S. Tsirkin <mst@redhat.com> escreveu:
> De: Michael S. Tsirkin <mst@redhat.com>
> Assunto: Re: [PATCH] virtio: limit avail bytes lookahead
> Para: "Amit Shah" <amit.shah@redhat.com>
> Cc: "Stefan Hajnoczi" <stefanha@gmail.com>, "Edivaldo de Araujo Pereira" <edivaldoapereira@yahoo.com.br>, qemu-devel@nongnu.org, "Anthony Liguori" <anthony@codemonkey.ws>, "Bug 1066055" <1066055@bugs.launchpad.net>
> Data: Terça-feira, 27 de Novembro de 2012, 8:25
> 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?
>
>
> > ---
> >
> > Edivaldo could you please confirm this fixes
> regression?
> >
> > diff --git a/hw/virtio-serial-bus.c
> b/hw/virtio-serial-bus.c
> > index d20bd8b..a761cdc 100644
> > --- a/hw/virtio-serial-bus.c
> > +++ b/hw/virtio-serial-bus.c
> > @@ -297,7 +297,7 @@ size_t
> virtio_serial_guest_ready(VirtIOSerialPort *port)
> > if (use_multiport(port->vser)
> && !port->guest_connected) {
> > return 0;
> > }
> > - virtqueue_get_avail_bytes(vq,
> &bytes, NULL);
> > + virtqueue_get_avail_bytes(vq,
> &bytes, NULL, UINT_MAX, 0);
> > return bytes;
> > }
> >
> > diff --git a/hw/virtio.c b/hw/virtio.c
> > index ec8b7d8..f40a8c5 100644
> > --- a/hw/virtio.c
> > +++ b/hw/virtio.c
> > @@ -336,7 +336,8 @@ static unsigned
> virtqueue_next_desc(hwaddr desc_pa,
> > }
> >
> > void virtqueue_get_avail_bytes(VirtQueue *vq,
> unsigned int *in_bytes,
> > -
>
> unsigned int *out_bytes)
> > +
>
> unsigned int *out_bytes,
> > +
>
> unsigned max_in_bytes, unsigned
> max_out_bytes)
> > {
> > unsigned int idx;
> > unsigned int total_bufs, in_total,
> out_total;
> > @@ -385,6 +386,9 @@ void
> virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int
> *in_bytes,
> > } else
> {
> >
> out_total += vring_desc_len(desc_pa, i);
> > }
> > + if (in_total
> >= max_in_bytes && out_total >= max_out_bytes)
> {
> > +
> goto done;
> > + }
> > } while ((i =
> virtqueue_next_desc(desc_pa, i, max)) != max);
> >
> > if (!indirect)
> > @@ -392,6 +396,7 @@ void
> virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int
> *in_bytes,
> > else
> >
> total_bufs++;
> > }
> > +done:
> > if (in_bytes) {
> > *in_bytes =
> in_total;
> > }
> > @@ -405,12 +410,8 @@ int
> virtqueue_avail_bytes(VirtQueue *vq, unsigned int in_bytes,
> > {
> > unsigned int in_total, out_total;
> >
> > - virtqueue_get_avail_bytes(vq,
> &in_total, &out_total);
> > - if ((in_bytes && in_bytes <
> in_total)
> > - || (out_bytes &&
> out_bytes < out_total)) {
> > - return 1;
> > - }
> > - return 0;
> > + virtqueue_get_avail_bytes(vq,
> &in_total, &out_total, in_bytes, out_bytes);
> > + return in_bytes <= in_total
> && out_bytes <= out_total;
> > }
> >
> > void virtqueue_map_sg(struct iovec *sg, hwaddr
> *addr,
> > diff --git a/hw/virtio.h b/hw/virtio.h
> > index ac482be..1278328 100644
> > --- a/hw/virtio.h
> > +++ b/hw/virtio.h
> > @@ -150,7 +150,8 @@ int virtqueue_pop(VirtQueue *vq,
> VirtQueueElement *elem);
> > int virtqueue_avail_bytes(VirtQueue *vq, unsigned
> int in_bytes,
> >
> unsigned int
> out_bytes);
> > void virtqueue_get_avail_bytes(VirtQueue *vq,
> unsigned int *in_bytes,
> > -
>
> unsigned int *out_bytes);
> > +
>
> unsigned int *out_bytes,
> > +
>
> unsigned max_in_bytes, unsigned
> max_out_bytes);
> >
> > void virtio_notify(VirtIODevice *vdev, VirtQueue
> *vq);
> >
>
next prev parent reply other threads:[~2012-11-27 16:54 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 [this message]
2012-11-27 19:47 ` Anthony Liguori
2012-11-28 21:53 ` Michael S. Tsirkin
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=1354035266.55841.YahooMailClassic@web163902.mail.gq1.yahoo.com \
--to=edivaldoapereira@yahoo.com.br \
--cc=1066055@bugs.launchpad.net \
--cc=amit.shah@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=mst@redhat.com \
--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 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).