Received: from eggs.gnu.org ([2001:4830:134:3::10]:56145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNG8Q-0006ck-S0 for qemu-devel@nongnu.org; Wed, 13 Jul 2016 05:07:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNG8K-0003BK-Ns for qemu-devel@nongnu.org; Wed, 13 Jul 2016 05:07:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55993 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNG8K-0003BG-IH for qemu-devel@nongnu.org; Wed, 13 Jul 2016 05:07:08 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6D93c1H109790 for ; Wed, 13 Jul 2016 05:07:08 -0400 Received: from e06smtp16.uk.ibm.com (e06smtp16.uk.ibm.com [195.75.94.112]) by mx0a-001b2d01.pphosted.com with ESMTP id 245hgaamy3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 13 Jul 2016 05:07:07 -0400 Received: from localhost by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Jul 2016 10:07:06 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3F2BC17D8042 for ; Wed, 13 Jul 2016 10:08:29 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6D972RA63504574 for ; Wed, 13 Jul 2016 09:07:02 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u6D972gc022911 for ; Wed, 13 Jul 2016 03:07:02 -0600 Date: Wed, 13 Jul 2016 11:07:00 +0200 From: Cornelia Huck In-Reply-To: <1468386588-26584-3-git-send-email-famz@redhat.com> References: <1468386588-26584-1-git-send-email-famz@redhat.com> <1468386588-26584-3-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20160713110700.7febc627.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH v4 2/6] virtio: Introduce virtio_add_queue_aio List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, mst@redhat.com On Wed, 13 Jul 2016 13:09:44 +0800 Fam Zheng wrote: > Using this function instead of virtio_add_queue marks the vq as aio > based. This differentiation will be useful in later patches. > > Distinguish between virtqueue processing in the iohandler context and main loop > AioContext. iohandler context is isolated from AioContexts and therefore does > not run during aio_poll(). > > Signed-off-by: Fam Zheng > --- > hw/virtio/virtio.c | 38 ++++++++++++++++++++++++++++++++++---- > include/hw/virtio/virtio.h | 3 +++ > 2 files changed, 37 insertions(+), 4 deletions(-) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 2cc68d24..2fbed0c 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -97,6 +97,7 @@ struct VirtQueue > uint16_t vector; > VirtIOHandleOutput handle_output; > VirtIOHandleOutput handle_aio_output; > + bool use_aio; After some thought: We don't need to migrate that, so your patch is fine. > VirtIODevice *vdev; > EventNotifier guest_notifier; > EventNotifier host_notifier; (...) > +/* Add a virt queue and mark AIO. > + * An AIO queue will use the AioContext based event interface instead of the > + * default IOHandler and EventNotifier interface. > + */ > +VirtQueue *virtio_add_queue_aio(VirtIODevice *vdev, int queue_size, > + VirtIOHandleOutput handle_output) > +{ > + return virtio_add_queue_internal(vdev, queue_size, handle_output, true); > +} > + > +/* Add a normal virt queue (on the contrary to the AIO version above. */ /* Add a normal (non-AIO) virtqueue. */ ? > +VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, > + VirtIOHandleOutput handle_output) > +{ > + return virtio_add_queue_internal(vdev, queue_size, handle_output, false); > +} > + > void virtio_del_queue(VirtIODevice *vdev, int n) > { > if (n < 0 || n >= VIRTIO_QUEUE_MAX) { > @@ -1830,11 +1850,21 @@ static void virtio_queue_host_notifier_read(EventNotifier *n) > void virtio_queue_set_host_notifier_fd_handler(VirtQueue *vq, bool assign, > bool set_handler) > { > + AioContext *ctx = qemu_get_aio_context(); Add a blank line. > if (assign && set_handler) { (...) Other than the nits above: Reviewed-by: Cornelia Huck