qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: stefanha@redhat.com
Subject: Re: [Qemu-devel] AioContext of block jobs
Date: Wed, 25 Mar 2015 12:25:58 +0100	[thread overview]
Message-ID: <55129B46.2060003@redhat.com> (raw)
In-Reply-To: <20150325083139.GB14724@ad.nay.redhat.com>



On 25/03/2015 09:31, Fam Zheng wrote:
> I was looking at block jobs' AioContext and realized that the block job
> coroutines are actually started in main loop.
> 
> I'm confused because 5a7e7a0bad17c96e03f55ed7019e2d7545e21a96 and friends in
> the series [1] seem to move the coroutines to the BDS's iothreads, but it
> didn't do that.
> 
> (Although after the first block_job_yield or sleep, the coroutines ARE resumed
> in the right AioContext.)
> 
> Why is it safe to start the jobs from the main thread where QMP command is
> handled? I see no guarantee that the jobs won't access BDS before first yield
> but after releasing the AioContext.
> 
> Is this a bug?

It's okay because the coroutine is started while the main thread is
holding the AioContext.  So the first "stint" of the coroutine, until
the first yield, is done in the main thread but still with the
AioContext held.

After the first yield, the main thread releases the AioContext, the
dataplane thread gets it back and the coroutine is moved to the
dataplane thread.

Paolo

  reply	other threads:[~2015-03-25 11:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25  8:31 [Qemu-devel] AioContext of block jobs Fam Zheng
2015-03-25 11:25 ` Paolo Bonzini [this message]
2015-03-25 12:06   ` Fam Zheng
2015-03-25 13:31 ` Stefan Hajnoczi
2015-03-26  3:45   ` Fam Zheng

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=55129B46.2060003@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).