Skip to content

Commit 719c681

Browse files
stefanhaRHkevmw
authored andcommitted
Revert "monitor: use aio_co_reschedule_self()"
Commit 1f25c17 ("monitor: use aio_co_reschedule_self()") was a code cleanup that uses aio_co_reschedule_self() instead of open coding coroutine rescheduling. Bug RHEL-34618 was reported and Kevin Wolf <[email protected]> identified the root cause. I missed that aio_co_reschedule_self() -> qemu_get_current_aio_context() only knows about qemu_aio_context/IOThread AioContexts and not about iohandler_ctx. It does not function correctly when going back from the iohandler_ctx to qemu_aio_context. Go back to open coding the AioContext transitions to avoid this bug. This reverts commit 1f25c17. Cc: [email protected] Buglink: https://issues.redhat.com/browse/RHEL-34618 Signed-off-by: Stefan Hajnoczi <[email protected]> Message-ID: <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent b67e353 commit 719c681

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

qapi/qmp-dispatch.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ QDict *coroutine_mixed_fn qmp_dispatch(const QmpCommandList *cmds, QObject *requ
212212
* executing the command handler so that it can make progress if it
213213
* involves an AIO_WAIT_WHILE().
214214
*/
215-
aio_co_reschedule_self(qemu_get_aio_context());
215+
aio_co_schedule(qemu_get_aio_context(), qemu_coroutine_self());
216+
qemu_coroutine_yield();
216217
}
217218

218219
monitor_set_cur(qemu_coroutine_self(), cur_mon);
@@ -226,7 +227,9 @@ QDict *coroutine_mixed_fn qmp_dispatch(const QmpCommandList *cmds, QObject *requ
226227
* Move back to iohandler_ctx so that nested event loops for
227228
* qemu_aio_context don't start new monitor commands.
228229
*/
229-
aio_co_reschedule_self(iohandler_get_aio_context());
230+
aio_co_schedule(iohandler_get_aio_context(),
231+
qemu_coroutine_self());
232+
qemu_coroutine_yield();
230233
}
231234
} else {
232235
/*

0 commit comments

Comments
 (0)