qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] dataplane: change vring API to use VirtQueueElement
Date: Mon, 13 May 2013 13:48:50 +0200	[thread overview]
Message-ID: <20130513114850.GA21733@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1368188849-5647-3-git-send-email-pbonzini@redhat.com>

On Fri, May 10, 2013 at 02:27:29PM +0200, Paolo Bonzini wrote:
> @@ -305,29 +285,28 @@ static void handle_notify(EventNotifier *e)
>          vring_disable_notification(s->vdev, &s->vring);
>  
>          for (;;) {
> -            head = vring_pop(s->vdev, &s->vring, iov, end, &out_num, &in_num);
> -            if (head < 0) {
> +            ret = vring_pop(s->vdev, &s->vring, &elem);
> +            if (ret < 0) {
>                  break; /* no more requests */

elem is leaked - we don't vring_push(elem)!

>              }
>  
> -            trace_virtio_blk_data_plane_process_request(s, out_num, in_num,
> -                                                        head);
> +            trace_virtio_blk_data_plane_process_request(s, elem->out_num,
> +                                                        elem->in_num, elem->index);
>  
> -            if (process_request(&s->ioqueue, iov, out_num, in_num, head) < 0) {
> +            if (process_request(&s->ioqueue, elem) < 0) {
>                  vring_set_broken(&s->vring);
>                  break;

elem is leaked on -EFAULT.

> @@ -268,6 +270,10 @@ int vring_pop(VirtIODevice *vdev, Vring *vring,
>       * the index we've seen. */
>      head = vring->vr.avail->ring[last_avail_idx % num];
>  
> +    elem = *p_elem = g_slice_new(VirtQueueElement);
> +    memset(elem, 0, sizeof(*elem));

VirtQueueElement is 48 KB.  We cannot affort to memset, see
de6c8042ec55da18702fa51f09072fcaa315edc3.  At that time dd if=/dev/vda
of=/dev/null iflag=direct bs=8k resulted in 10% host CPU utilization in
memset.

      reply	other threads:[~2013-05-13 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 12:27 [Qemu-devel] [PATCH 0/3] dataplane: change vring API to use VirtQueueElement Paolo Bonzini
2013-05-10 12:27 ` [Qemu-devel] [PATCH 1/2] vring: create a common function to parse descriptors Paolo Bonzini
2013-05-10 12:27 ` [Qemu-devel] [PATCH 2/2] dataplane: change vring API to use VirtQueueElement Paolo Bonzini
2013-05-13 11:48   ` Stefan Hajnoczi [this message]

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=20130513114850.GA21733@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).