> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo 
> Bonzini
> Sent: 2015年3月6日 17:45
> To: Halsey Pian; qemu-devel@nongnu.org
> Subject: Re: [Bug] qemu_coroutine_enter abort and report error "Co-routine 
> re-entered recursively"
> 
> 
> 
> On 06/03/2015 08:03, Halsey Pian wrote:
> > I have two threads to write two seperate qcow2 files,  but after a
> > while,  the writing would be aborted in qemu_coroutine_enter, and
> > report error “"Co-routine re-entered recursively” .
> >
> > Qemu should be thread safe, right? It seems that there are some
> > variables is not thread safe? Could you have a chance to look it? Thanks!
> 
> QEMU is thread safe but you need to add explicit locking or use separate 
> event loops in each thread.  If you want to write from
> separate thread, you need to do one of the following:
> 
> 1) use one AioContext per file, and add an AioContext-based event loop to 
> each thread (see backends/iothread.c);
> 
> 2) use one AioContext per file, add it (as a GSource) to a GMainContext and 
> use a GMainLoop-based event loop to each thread;
> 
> 3) use aio_context_acquire and aio_context_release around each blk_* or
> bdrv_* call.
> 
> Paolo

Hi Paolo,

Thanks for your immediate reply. 

I checked relevant source code, and I'm trying changing AioContext.  Would keep 
changing based on your comments.  Thank you!

[Halsey] 



Reply via email to