summaryrefslogtreecommitdiffstats
path: root/iothread.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2015-06-03 10:15:33 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2015-06-12 13:58:33 +0100
commitda5e1de95bb235330d7724316e7a29239d1359d5 (patch)
tree5b4f1a65fb9d13113d37df0e9cf869356ccdf568 /iothread.c
parentd8e3b729cf452d2689c8669f1ec18158db29fd5a (diff)
downloadhqemu-da5e1de95bb235330d7724316e7a29239d1359d5.zip
hqemu-da5e1de95bb235330d7724316e7a29239d1359d5.tar.gz
Revert "iothread: release iothread around aio_poll"
This reverts commit a0710f7995f914e3044e5899bd8ff6c43c62f916. In qemu-devel email message <556DBF87.2020908@de.ibm.com>, Christian Borntraeger writes: Having many guests all with a kernel/ramdisk (via -kernel) and several null block devices will result in hangs. All hanging guests are in partition detection code waiting for an I/O to return so very early maybe even the first I/O. Reverting that commit "fixes" the hangs. Reverting this commit for the 2.4 release. More time is needed to investigate and correct this patch. Reported-by: Christian Borntraeger <borntraeger@de.ibm.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'iothread.c')
-rw-r--r--iothread.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/iothread.c b/iothread.c
index 0416fc4..878a594 100644
--- a/iothread.c
+++ b/iothread.c
@@ -31,14 +31,21 @@ 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 (!atomic_read(&iothread->stopping)) {
- aio_poll(iothread->ctx, true);
+ 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);
}
return NULL;
}
OpenPOWER on IntegriCloud