On Wed, Apr 27, 2022 at 03:08:30PM +0200, Paolo Bonzini wrote: > qemu_co_queue_restart_all is basically the same as qemu_co_enter_all > but without a QemuLockable argument. That's perfectly fine, but only as > long as the function is marked coroutine_fn. If used outside coroutine > context, qemu_co_queue_wait will attempt to take the lock and that > is just broken: if you are calling qemu_co_queue_restart_all outside > coroutine context, the lock is going to be a QemuMutex which cannot be > taken twice by the same thread. > > The patch adds the marker to qemu_co_queue_restart_all and to its sole > non-coroutine_fn caller; it then reimplements the function in terms of > qemu_co_enter_all_impl, to remove duplicated code and to clarify that the > latter also works in coroutine context. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > block/io.c | 2 +- > include/qemu/coroutine.h | 7 ++++--- > util/qemu-coroutine-lock.c | 21 ++++++--------------- > 3 files changed, 11 insertions(+), 19 deletions(-) >
Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org