From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoD6U-00088B-2A for qemu-devel@nongnu.org; Wed, 04 Dec 2013 09:07:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoD6L-0001Ls-Kd for qemu-devel@nongnu.org; Wed, 04 Dec 2013 09:07:02 -0500 Received: from mail-ee0-x229.google.com ([2a00:1450:4013:c00::229]:37161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoD6L-0001Lm-Dc for qemu-devel@nongnu.org; Wed, 04 Dec 2013 09:06:53 -0500 Received: by mail-ee0-f41.google.com with SMTP id t10so2438885eei.0 for ; Wed, 04 Dec 2013 06:06:52 -0800 (PST) Date: Wed, 4 Dec 2013 15:06:49 +0100 From: Stefan Hajnoczi Message-ID: <20131204140649.GA27759@stefanha-thinkpad.redhat.com> References: <1381417639-22547-1-git-send-email-pbonzini@redhat.com> <1381417639-22547-4-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1381417639-22547-4-git-send-email-pbonzini@redhat.com> 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: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com On Thu, Oct 10, 2013 at 05:07:18PM +0200, Paolo Bonzini wrote: > @@ -298,30 +278,31 @@ 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) { > + assert(elem == NULL); > break; /* no more requests */ > } > > - 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); > + vring_push(&s->vring, elem, 0); If we give up on the vring I don't think we should push the element back. It may cause the guest to panic. I guess what we really need here is to unmap scatter-gather buffers and delete elem. Stefan