qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] dataplane: change vring API to use VirtQueueElement
Date: Fri, 6 Dec 2013 10:02:40 +0100	[thread overview]
Message-ID: <20131206090240.GA2616@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <52A056B4.3000509@redhat.com>

On Thu, Dec 05, 2013 at 11:34:28AM +0100, Paolo Bonzini wrote:
> Il 05/12/2013 10:24, Stefan Hajnoczi ha scritto:
> >> > 
> >> > That's what already happens actually.  vring_push has
> >> > 
> >> > 
> >> > +    g_slice_free(VirtQueueElement, elem);
> >> > +
> >> >      /* Don't touch vring if a fatal error occurred */
> >> >      if (vring->broken) {
> >> >          return;
> >> > 
> >> > in this patch and
> >> > 
> >> > +    for (i = 0; i < elem->out_num; i++) {
> >> > +        vring_unmap(elem->out_sg[i].iov_base, false);
> >> > +    }
> >> > +
> >> > +    for (i = 0; i < elem->in_num; i++) {
> >> > +        vring_unmap(elem->in_sg[i].iov_base, true);
> >> > +    }
> >> > 
> >> >      g_slice_free(VirtQueueElement, elem);
> >> > 
> >> > in the next one.
> >> > 
> >> > Though I admit vring_push isn't such a great name and API.  I can add
> >> > instead a vring_free_element function.  Do you think vring_push should
> >> > call it, or should the caller do that?
> > I think vring_push() should free the VirtQueueElement.
> > 
> > We just need to expose vring_free_element() so that handle_notify() can
> > call it without pushing bogus buffers back to the guest.
> 
> It's not pushing back bogus buffer, see the "if (vring->broken)" above.
>  But if you prefer handle_notify() to call vring_free_element(), I can
> of course do that.

Ah, I missed that :).  It would be clearer to call vring_free_element()
explicitly.

Stefan

  reply	other threads:[~2013-12-06  9:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 15:07 [Qemu-devel] [PATCH 0/4] dataplane: use more of the generic virtio data structures, drop hostmem Paolo Bonzini
2013-10-10 15:07 ` [Qemu-devel] [PATCH 1/4] vring: create a common function to parse descriptors Paolo Bonzini
2013-10-10 15:07 ` [Qemu-devel] [PATCH 2/4] vring: factor common code for error exits Paolo Bonzini
2013-10-10 20:53   ` Richard Henderson
2013-10-11  9:19     ` Paolo Bonzini
2013-10-10 15:07 ` [Qemu-devel] [PATCH 3/4] dataplane: change vring API to use VirtQueueElement Paolo Bonzini
2013-12-04 14:06   ` Stefan Hajnoczi
2013-12-04 17:40     ` Paolo Bonzini
2013-12-05  9:24       ` Stefan Hajnoczi
2013-12-05 10:34         ` Paolo Bonzini
2013-12-06  9:02           ` Stefan Hajnoczi [this message]
2013-10-10 15:07 ` [Qemu-devel] [PATCH 4/4] dataplane: replace hostmem with memory_region_find Paolo Bonzini
2013-12-04 14:12 ` [Qemu-devel] [PATCH 0/4] dataplane: use more of the generic virtio data structures, drop hostmem Stefan Hajnoczi

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