On Mon, Aug 10, 2020 at 10:52:44PM +0800, Zhenyu Ye wrote: > Before doing qmp actions, we need to lock the qemu_global_mutex, > so the qmp actions should not take too long time. > > Unfortunately, some qmp actions need to acquire aio context and > this may take a long time. The vm will soft lockup if this time > is too long. > > So add a timeout mechanism while doing qmp actions. aio_context_acquire_timeout() is a workaround for code that blocks the event loop. Ideally there should be no code that blocks the event loop. Which cases have you found where the event loop is blocked? I think they should be investigated and fixed (if possible) before introducing an API like aio_context_acquire_timeout(). Stefan