qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter()
Date: Tue, 10 Feb 2015 12:15:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0


On 10/02/2015 12:09, Kevin Wolf wrote:
>> > 
>> > 4 mutex->locked = false;
>> >   qemu_co_queue_next(&mutex->queue);
>> >    '--> qemu_co_queue_do_restart(queue, true);
>> >         '--> QTAILQ_REMOVE(&queue->entries, next, co_queue_next);
>> >              QTAILQ_INSERT_TAIL(&self->co_queue_wakeup, next, 
>> > co_queue_next);
>> > 
>> > 5 coroutine_swap(co1, leader, COROUTINE_YIELD);
>> > 
>> > And co2 is never reentered until co1 terminates.  Right?
> No, co2 will be reentered during the yield in line 5. However, it's not
> the yielding coroutine that reenters it but the parent, which is resumed
> at exactly the line of code that you quoted above.

So:

5 coroutine_swap(co1, leader, COROUTINE_YIELD);
  '--> jumps back to qemu_coroutine_switch
       '--> returns to qemu_coroutine_enter

  qemu_co_queue_run_restart(co);
  '--> QTAILQ_REMOVE(&co->co_queue_wakeup, next, co_queue_next);
       qemu_coroutine_enter(next, NULL);


Thanks for the explanation.  Series:

Reviewed-by: Paolo Bonzini <address@hidden>



reply via email to

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