[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/5] coroutine-lock: make qemu_co_enter_next thr
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 4/5] coroutine-lock: make qemu_co_enter_next thread-safe |
Date: |
Sat, 3 Feb 2018 12:57:28 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 02/03/2018 07:39 AM, Paolo Bonzini wrote:
> qemu_co_queue_next does not need to release and re-acquire the mutex,
> because the queued coroutine does not run immediately. However, this
> does not hold for qemu_co_enter_next. Now that qemu_co_queue_wait
> can synchronize (via QemuLockable) with code that is not running in
> coroutine context, it's important that code using qemu_co_enter_next
> can easily use a standardized locking idiom.
>
> First of all, qemu_co_enter_next must use aio_co_wake to restart the
> coroutine. Second, the function gains a second argument, a QemuLockable*,
> and the comments of qemu_co_queue_next and qemu_co_queue_restart_all
> are adjusted to clarify the difference.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> fsdev/qemu-fsdev-throttle.c | 4 ++--
> include/qemu/coroutine.h | 19 +++++++++++++------
> util/qemu-coroutine-lock.c | 10 ++++++++--
> 3 files changed, 23 insertions(+), 10 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
r~
- [Qemu-devel] [PATCH 1/5] test-coroutine: add simple CoMutex test, (continued)
- [Qemu-devel] [PATCH 1/5] test-coroutine: add simple CoMutex test, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 3/5] coroutine-lock: convert CoQueue to use QemuLockable, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 5/5] curl: convert to CoQueue, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 4/5] coroutine-lock: make qemu_co_enter_next thread-safe, Paolo Bonzini, 2018/02/03
- Re: [Qemu-devel] [PATCH 4/5] coroutine-lock: make qemu_co_enter_next thread-safe,
Richard Henderson <=
- Re: [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue, Stefan Hajnoczi, 2018/02/05
- Re: [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue, Fam Zheng, 2018/02/07