Received: from eggs.gnu.org ([2001:4830:134:3::10]:38340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGQOH-0005nr-Ij for qemu-devel@nongnu.org; Fri, 24 Jun 2016 08:39:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGQOD-00044y-Eg for qemu-devel@nongnu.org; Fri, 24 Jun 2016 08:39:20 -0400 From: Fam Zheng Date: Fri, 24 Jun 2016 20:39:31 +0800 Message-Id: <20160624123934.10821-5-famz@redhat.com> In-Reply-To: <20160624123934.10821-1-famz@redhat.com> References: <20160624123934.10821-1-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2 4/7] virtio: Use aio_set_event_notifier for aio vq List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jeff Cody , Kevin Wolf , Max Reitz , Stefan Hajnoczi , "Michael S. Tsirkin" , Paolo Bonzini , qemu-block@nongnu.org Signed-off-by: Fam Zheng --- hw/virtio/virtio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1ea6f66..a586529 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1835,11 +1835,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(); if (assign && set_handler) { - event_notifier_set_handler(&vq->host_notifier, true, + if (vq->use_aio) { + aio_set_event_notifier(ctx, &vq->host_notifier, true, virtio_queue_host_notifier_read); + } else { + event_notifier_set_handler(&vq->host_notifier, true, + virtio_queue_host_notifier_read); + } } else { - event_notifier_set_handler(&vq->host_notifier, true, NULL); + if (vq->use_aio) { + aio_set_event_notifier(ctx, &vq->host_notifier, true, NULL); + } else { + event_notifier_set_handler(&vq->host_notifier, true, NULL); + } } if (!assign) { /* Test and clear notifier before after disabling event, -- 2.8.3