All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: wu.wubin@huawei.com, famz@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter()
Date: Tue, 10 Feb 2015 12:15:22 +0100	[thread overview]
Message-ID: <54D9E84A.9030204@redhat.com> (raw)
In-Reply-To: <20150210110907.GD5202@noname.str.redhat.com>



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 <pbonzini@redhat.com>

  reply	other threads:[~2015-02-10 11:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 10:41 [Qemu-devel] [PATCH 0/3] coroutine: Fix qemu_coroutine_yield() Kevin Wolf
2015-02-10 10:41 ` [Qemu-devel] [PATCH 1/3] coroutine: Fix use after free with qemu_coroutine_yield() Kevin Wolf
2015-02-20 15:05   ` Kevin Wolf
2015-02-10 10:41 ` [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter() Kevin Wolf
2015-02-10 10:55   ` Paolo Bonzini
2015-02-10 11:09     ` Kevin Wolf
2015-02-10 11:15       ` Paolo Bonzini [this message]
2015-02-18 13:50   ` Stefan Hajnoczi
2015-02-18 14:20     ` Kevin Wolf
2015-02-19 14:33       ` Stefan Hajnoczi
2015-02-10 10:41 ` [Qemu-devel] [PATCH 3/3] test-coroutine: Regression test for yield bug Kevin Wolf
2015-02-16 10:19 ` [Qemu-devel] [PATCH 0/3] coroutine: Fix qemu_coroutine_yield() Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D9E84A.9030204@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wu.wubin@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.