qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] AioContext of block jobs


From: Paolo Bonzini
Subject: Re: [Qemu-devel] AioContext of block jobs
Date: Wed, 25 Mar 2015 12:25:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


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 via email to

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