qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, Paolo Bonzini <pbonzini@redhat.com>,
	Karl Rister <krister@redhat.com>, Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v4 05/13] linux-aio: poll ring for completions
Date: Thu,  1 Dec 2016 19:26:44 +0000	[thread overview]
Message-ID: <20161201192652.9509-6-stefanha@redhat.com> (raw)
In-Reply-To: <20161201192652.9509-1-stefanha@redhat.com>

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 <stefanha@redhat.com>
---
 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

  parent reply	other threads:[~2016-12-01 19:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 19:26 [Qemu-devel] [PATCH v4 00/13] aio: experimental virtio-blk polling mode Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 01/13] aio: add flag to skip fds to aio_dispatch() Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 02/13] aio: add AioPollFn and io_poll() interface Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 03/13] aio: add polling mode to AioContext Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers Stefan Hajnoczi
2016-12-05  0:54   ` Fam Zheng
2016-12-05 10:14     ` Stefan Hajnoczi
2016-12-05 10:59       ` Paolo Bonzini
2016-12-05 14:46         ` Stefan Hajnoczi
2016-12-05 15:22           ` Paolo Bonzini
2016-12-06  9:28             ` Stefan Hajnoczi
2016-12-05 11:12       ` Christian Borntraeger
2016-12-01 19:26 ` Stefan Hajnoczi [this message]
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 06/13] iothread: add polling parameters Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 07/13] virtio-blk: suppress virtqueue kick during processing Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 08/13] virtio-scsi: " Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 09/13] virtio: turn vq->notification into a nested counter Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 10/13] aio: add .io_poll_begin/end() callbacks Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 11/13] virtio: disable virtqueue notifications during polling Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 12/13] aio: self-tune polling time Stefan Hajnoczi
2016-12-05 20:06   ` Christian Borntraeger
2016-12-06  9:20     ` Stefan Hajnoczi
2016-12-06 10:12       ` Christian Borntraeger
2016-12-06 17:22         ` Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 13/13] iothread: add poll-grow and poll-shrink parameters Stefan Hajnoczi
2016-12-02  8:27 ` [Qemu-devel] [PATCH v4 00/13] aio: experimental virtio-blk polling mode Paolo Bonzini
2016-12-02 11:11 ` Stefan Hajnoczi
2016-12-05 10:25 ` Fam Zheng
2016-12-05 14:56   ` Stefan Hajnoczi
2016-12-05 16:40     ` Karl Rister
2016-12-06  9:27       ` Stefan Hajnoczi
2016-12-05 11:19 ` Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201192652.9509-6-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=famz@redhat.com \
    --cc=krister@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).