qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] monitor: use aio_co_reschedule_self()


From: Markus Armbruster
Subject: Re: [PATCH 5/5] monitor: use aio_co_reschedule_self()
Date: Wed, 07 Feb 2024 08:04:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Hajnoczi <stefanha@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 <hreitz@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]