diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 9bb1e6a9f4..e3897d5197 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -128,6 +128,16 @@ static void do_qmp_dispatch_bh(void *opaque) data->cmd->fn(data->args, data->ret, data->errp); monitor_set_cur(qemu_coroutine_self(), NULL); aio_co_wake(data->co); + + /* + * If the QMP dispatcher coroutine is waiting to be scheduled + * in iohandler_ctx, we must kick the main loop. This ensures + * that AIO_WAIT_WHILE_UNLOCKED() in monitor_cleanup() doesn't + * block indefinitely waiting for an event in qemu_aio_context, + * but actually gets the chance to poll iohandler_ctx and resume + * the coroutine. + */ + aio_wait_kick(); } /*