[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/35] AioContext: run bottom halves after polling
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 15/35] AioContext: run bottom halves after polling |
Date: |
Fri, 29 Aug 2014 17:29:43 +0100 |
From: Paolo Bonzini <address@hidden>
Make the dispatching phase the same before blocking and afterwards.
The next patch will make aio_dispatch public and use it directly
for the GSource case, instead of aio_poll. aio_poll can then be
simplified heavily.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
aio-posix.c | 4 ++++
aio-win32.c | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/aio-posix.c b/aio-posix.c
index 55706f8..798a3ff 100644
--- a/aio-posix.c
+++ b/aio-posix.c
@@ -264,6 +264,10 @@ bool aio_poll(AioContext *ctx, bool blocking)
/* Run dispatch even if there were no readable fds to run timers */
aio_set_dispatching(ctx, true);
+ if (aio_bh_poll(ctx)) {
+ progress = true;
+ }
+
if (aio_dispatch(ctx)) {
progress = true;
}
diff --git a/aio-win32.c b/aio-win32.c
index 5e37b42..2ac38a8 100644
--- a/aio-win32.c
+++ b/aio-win32.c
@@ -143,7 +143,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
{
AioHandler *node;
HANDLE events[MAXIMUM_WAIT_OBJECTS + 1];
- bool progress;
+ bool progress, first;
int count;
int timeout;
@@ -177,6 +177,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
}
ctx->walking_handlers--;
+ first = true;
/* wait until next event */
while (count > 0) {
@@ -186,6 +187,11 @@ bool aio_poll(AioContext *ctx, bool blocking)
? qemu_timeout_ns_to_ms(aio_compute_timeout(ctx)) : 0;
ret = WaitForMultipleObjects(count, events, FALSE, timeout);
+ if (first && aio_bh_poll(ctx)) {
+ progress = true;
+ }
+ first = false;
+
/* if we have any signaled events, dispatch event */
if ((DWORD) (ret - WAIT_OBJECT_0) >= count) {
break;
--
1.9.3
- [Qemu-devel] [PULL 05/35] qemu-img: always goto out in img_snapshot() error paths, (continued)
- [Qemu-devel] [PULL 05/35] qemu-img: always goto out in img_snapshot() error paths, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 08/35] qapi: add read-pattern enum for quorum, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 10/35] coroutine: Drop co_sleep_ns, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 09/35] block/quorum: add simple read pattern support, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 11/35] blockdev: fix drive-mirror 'granularity' error message, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 12/35] AioContext: take bottom halves into account when computing aio_poll timeout, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 07/35] sheepdog: improve error handling for a case of failed lock, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 13/35] aio-win32: Evaluate timers after handles, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 06/35] sheepdog: adopting protocol update for VDI locking, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 14/35] aio-win32: Factor out duplicate code into aio_dispatch_handlers, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 15/35] AioContext: run bottom halves after polling,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 16/35] AioContext: export and use aio_dispatch, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 17/35] test-aio: test timers on Windows too, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 18/35] aio-win32: add aio_set_dispatching optimization, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 19/35] AioContext: introduce aio_prepare, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 20/35] qemu-coroutine-io: fix for Win32, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 22/35] sheepdog: fix a core dump while do auto-reconnecting, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 21/35] aio-win32: add support for sockets, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 23/35] nbd: Drop nbd_can_read(), Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 24/35] block: Add AIO context notifiers, Stefan Hajnoczi, 2014/08/29
- [Qemu-devel] [PULL 26/35] block: fix overlapping multiwrite requests, Stefan Hajnoczi, 2014/08/29