From da5e1de95bb235330d7724316e7a29239d1359d5 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 3 Jun 2015 10:15:33 +0100 Subject: 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 Suggested-by: Paolo Bonzini Reviewed-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- iothread.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'iothread.c') 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; } -- cgit v1.1