Stefan Hajnoczi <stefa...@redhat.com> writes:

> The aio_co_reschedule_self() API is designed to avoid the race
> condition between scheduling the coroutine in another AioContext and
> yielding.
>
> The QMP dispatch code uses the open-coded version that appears
> susceptible to the race condition at first glance:
>
>   aio_co_schedule(qemu_get_aio_context(), qemu_coroutine_self());
>   qemu_coroutine_yield();
>
> The code is actually safe because the iohandler and qemu_aio_context
> AioContext run under the Big QEMU Lock. Nevertheless, set a good example
> and use aio_co_reschedule_self() so it's obvious that there is no race.
>
> Suggested-by: Hanna Reitz <hre...@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>

Acked-by: Markus Armbruster <arm...@redhat.com>

Feel free to merge this together with the remainder of the series.


Reply via email to