[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/14] linux-aio: poll ring for completions
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 06/14] linux-aio: poll ring for completions |
Date: |
Wed, 4 Jan 2017 13:34:06 +0000 |
The Linux AIO userspace ABI includes a ring that is shared with the
kernel. This allows userspace programs to process completions without
system calls.
Add an AioContext poll handler to check for completions in the ring.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/linux-aio.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/block/linux-aio.c b/block/linux-aio.c
index 69c4ed5..03ab741 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -255,6 +255,20 @@ static void qemu_laio_completion_cb(EventNotifier *e)
}
}
+static bool qemu_laio_poll_cb(void *opaque)
+{
+ EventNotifier *e = opaque;
+ LinuxAioState *s = container_of(e, LinuxAioState, e);
+ struct io_event *events;
+
+ if (!io_getevents_peek(s->ctx, &events)) {
+ return false;
+ }
+
+ qemu_laio_process_completions_and_submit(s);
+ return true;
+}
+
static void laio_cancel(BlockAIOCB *blockacb)
{
struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;
@@ -448,7 +462,8 @@ void laio_attach_aio_context(LinuxAioState *s, AioContext
*new_context)
s->aio_context = new_context;
s->completion_bh = aio_bh_new(new_context, qemu_laio_completion_bh, s);
aio_set_event_notifier(new_context, &s->e, false,
- qemu_laio_completion_cb, NULL);
+ qemu_laio_completion_cb,
+ qemu_laio_poll_cb);
}
LinuxAioState *laio_init(void)
--
2.9.3
- [Qemu-devel] [PULL 00/14] Block patches, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 02/14] aio: add flag to skip fds to aio_dispatch(), Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 01/14] HACKING: document #include order, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 04/14] aio: add polling mode to AioContext, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 06/14] linux-aio: poll ring for completions,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 07/14] iothread: add polling parameters, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 05/14] virtio: poll virtqueues for new buffers, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 03/14] aio: add AioPollFn and io_poll() interface, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 08/14] virtio-blk: suppress virtqueue kick during processing, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 09/14] virtio-scsi: suppress virtqueue kick during processing, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 10/14] virtio: turn vq->notification into a nested counter, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 12/14] virtio: disable virtqueue notifications during polling, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 11/14] aio: add .io_poll_begin/end() callbacks, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 13/14] aio: self-tune polling time, Stefan Hajnoczi, 2017/01/04
- [Qemu-devel] [PULL 14/14] iothread: add poll-grow and poll-shrink parameters, Stefan Hajnoczi, 2017/01/04