aboutsummaryrefslogtreecommitdiff
path: root/iothread.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-02-20 17:26:52 +0100
committerKevin Wolf <kwolf@redhat.com>2015-04-28 15:36:08 +0200
commita0710f7995f914e3044e5899bd8ff6c43c62f916 (patch)
treea6a63bb73444688e7994a4a40eef3a38607f9251 /iothread.c
parent49110174f8835ec3d5ca7fc076ee1f51c18564fe (diff)
iothread: release iothread around aio_poll
This is the first step towards having fine-grained critical sections in dataplane threads, which resolves lock ordering problems between address_space_* functions (which need the BQL when doing MMIO, even after we complete RCU-based dispatch) and the AioContext. Because AioContext does not use contention callbacks anymore, the unit test has to be changed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1424449612-18215-4-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'iothread.c')
-rw-r--r--iothread.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/iothread.c b/iothread.c
index 342a23fcb0..a1f91099bc 100644
--- a/iothread.c
+++ b/iothread.c
@@ -31,21 +31,14 @@ typedef ObjectClass IOThreadClass;
static void *iothread_run(void *opaque)
{
IOThread *iothread = opaque;
- bool blocking;
qemu_mutex_lock(&iothread->init_done_lock);
iothread->thread_id = qemu_get_thread_id();
qemu_cond_signal(&iothread->init_done_cond);
qemu_mutex_unlock(&iothread->init_done_lock);
- while (!iothread->stopping) {
- aio_context_acquire(iothread->ctx);
- blocking = true;
- while (!iothread->stopping && aio_poll(iothread->ctx, blocking)) {
- /* Progress was made, keep going */
- blocking = false;
- }
- aio_context_release(iothread->ctx);
+ while (!atomic_read(&iothread->stopping)) {
+ aio_poll(iothread->ctx, true);
}
return NULL;
}