Am 22.01.2020 um 07:32 hat Markus Armbruster geschrieben: > Kevin Wolf <kw...@redhat.com> writes: > > > This patch adds a new 'coroutine' flag to QMP command definitions that > > tells the QMP dispatcher that the command handler is safe to be run in a > > coroutine. > > I'm afraid I missed this question in my review of v3: when is a handler > *not* safe to be run in a coroutine?
That's a hard one to answer fully. Basically, I think the biggest problem is with calling functions that change their behaviour if run in a coroutine compared to running them outside of coroutine context. In most cases the differences like having a nested event loop instead of yielding are just fine, but they are still subtly different. I know this is vague, but I can assure you that problematic cases exist. I hit one of them with my initial hack that just moved everything into a coroutine. It was related to graph modifications and bdrv_drain and resulted in a hang. For the specifics, I would have to try and reproduce the problem again. Kevin