diff options
author | 2024-02-06 14:06:10 -0500 | |
---|---|---|
committer | 2024-02-07 14:44:21 +0100 | |
commit | 1f25c172f83704e350c0829438d832384084a74d (patch) | |
tree | 4fa82d83400f8fe6a367bbf580048fe250794a3f /docs/conf.py | |
parent | virtio-blk: declare VirtIOBlock::rq with a type (diff) | |
download | qemu-1f25c172f83704e350c0829438d832384084a74d.tar.xz qemu-1f25c172f83704e350c0829438d832384084a74d.zip |
monitor: use aio_co_reschedule_self()
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>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240206190610.107963-6-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'docs/conf.py')
0 files changed, 0 insertions, 0 deletions