[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule(
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule() on direct entry |
Date: |
Tue, 28 Nov 2017 18:14:54 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 28/11/2017 18:09, Jeff Cody wrote:
>> Yes, terminating a scheduled coroutine is a bug; same for scheduling a
>> terminated coroutine, both orders are wrong. However, "unscheduling" is
>> not the solution; you would just be papering over the issue.
>
> Maybe we should at least add an abort on coroutine termination if there are
> still outstanding schedules, as that is preferable to operating in the
> weeds.
Sure, why not. I'm all for adding more assertions (not less :)).
>> aio_co_schedule() on a running coroutine can only happen when the
>> coroutine is going to yield soon.
>>
> That is a bit vague. What is "soon", and how does an external caller know
> if a coroutine is going to yield in this timeframe?
Soon really means "eventually"; basically if you do
f();
qemu_coroutine_yield();
then f() can call aio_co_wake() or aio_co_schedule() and knows that it
will be entirely thread-safe.
However, remember that only one aio_co_schedule() can be pending at a
single time; so if you have
f();
g();
qemu_coroutine_yield();
either f() or g() can wake you up but not both.
Thanks,
Paolo
- Re: [Qemu-devel] [PATCH for-2.11 1/4] Revert "coroutine: abort if we try to schedule or enter a pending coroutine", (continued)
[Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule() on direct entry, Kevin Wolf, 2017/11/28
Re: [Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule() on direct entry, Kevin Wolf, 2017/11/28
Re: [Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule() on direct entry, Paolo Bonzini, 2017/11/28
Re: [Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule() on direct entry, Fam Zheng, 2017/11/28
Re: [Qemu-devel] [PATCH for-2.11 3/4] coroutine: Cancel aio_co_schedule() on direct entry, Eric Blake, 2017/11/28
[Qemu-devel] [PATCH for-2.11 2/4] Revert "blockjob: do not allow coroutine double entry or entry-after-completion", Kevin Wolf, 2017/11/28
[Qemu-devel] [PATCH for-2.11 4/4] block: Expect graph changes in bdrv_parent_drained_begin/end, Kevin Wolf, 2017/11/28
Re: [Qemu-devel] [PATCH for-2.11 0/4] Fix qemu-iotests failures, Jeff Cody, 2017/11/28
Re: [Qemu-devel] [PATCH for-2.11 0/4] Fix qemu-iotests failures, Stefan Hajnoczi, 2017/11/28