From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoWGX-0003DM-Rr for qemu-devel@nongnu.org; Thu, 05 Dec 2013 05:34:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoWGO-00039z-Uv for qemu-devel@nongnu.org; Thu, 05 Dec 2013 05:34:41 -0500 Received: from mail-qe0-x236.google.com ([2607:f8b0:400d:c02::236]:44057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoWGO-00039Q-J4 for qemu-devel@nongnu.org; Thu, 05 Dec 2013 05:34:32 -0500 Received: by mail-qe0-f54.google.com with SMTP id cy11so15675417qeb.27 for ; Thu, 05 Dec 2013 02:34:32 -0800 (PST) Sender: Paolo Bonzini Message-ID: <52A056B4.3000509@redhat.com> Date: Thu, 05 Dec 2013 11:34:28 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1381417639-22547-1-git-send-email-pbonzini@redhat.com> <1381417639-22547-4-git-send-email-pbonzini@redhat.com> <20131204140649.GA27759@stefanha-thinkpad.redhat.com> <529F690E.9020802@redhat.com> <20131205092406.GA9629@stefanha-thinkpad.redhat.com> In-Reply-To: <20131205092406.GA9629@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/4] dataplane: change vring API to use VirtQueueElement List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Stefan Hajnoczi , qemu-devel@nongnu.org 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. Paolo