[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers |
Date: |
Thu, 1 Dec 2016 19:26:43 +0000 |
Add an AioContext poll handler to detect new virtqueue buffers without
waiting for a guest->host notification.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/virtio/virtio.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6f8ca25..3870411 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2047,13 +2047,27 @@ static void
virtio_queue_host_notifier_aio_read(EventNotifier *n)
}
}
+static bool virtio_queue_host_notifier_aio_poll(void *opaque)
+{
+ EventNotifier *n = opaque;
+ VirtQueue *vq = container_of(n, VirtQueue, host_notifier);
+
+ if (virtio_queue_empty(vq)) {
+ return false;
+ }
+
+ virtio_queue_notify_aio_vq(vq);
+ return true;
+}
+
void virtio_queue_aio_set_host_notifier_handler(VirtQueue *vq, AioContext *ctx,
VirtIOHandleOutput
handle_output)
{
if (handle_output) {
vq->handle_aio_output = handle_output;
aio_set_event_notifier(ctx, &vq->host_notifier, true,
- virtio_queue_host_notifier_aio_read, NULL);
+ virtio_queue_host_notifier_aio_read,
+ virtio_queue_host_notifier_aio_poll);
} else {
aio_set_event_notifier(ctx, &vq->host_notifier, true, NULL, NULL);
/* Test and clear notifier before after disabling event,
--
2.9.3
- [Qemu-devel] [PATCH v4 00/13] aio: experimental virtio-blk polling mode, Stefan Hajnoczi, 2016/12/01
- [Qemu-devel] [PATCH v4 01/13] aio: add flag to skip fds to aio_dispatch(), Stefan Hajnoczi, 2016/12/01
- [Qemu-devel] [PATCH v4 02/13] aio: add AioPollFn and io_poll() interface, Stefan Hajnoczi, 2016/12/01
- [Qemu-devel] [PATCH v4 03/13] aio: add polling mode to AioContext, Stefan Hajnoczi, 2016/12/01
- [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers,
Stefan Hajnoczi <=
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Fam Zheng, 2016/12/04
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Stefan Hajnoczi, 2016/12/05
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Paolo Bonzini, 2016/12/05
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Stefan Hajnoczi, 2016/12/05
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Paolo Bonzini, 2016/12/05
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Stefan Hajnoczi, 2016/12/06
- Re: [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers, Christian Borntraeger, 2016/12/05
[Qemu-devel] [PATCH v4 06/13] iothread: add polling parameters, Stefan Hajnoczi, 2016/12/01
[Qemu-devel] [PATCH v4 07/13] virtio-blk: suppress virtqueue kick during processing, Stefan Hajnoczi, 2016/12/01
[Qemu-devel] [PATCH v4 05/13] linux-aio: poll ring for completions, Stefan Hajnoczi, 2016/12/01