qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-r


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively"
Date: Fri, 06 Mar 2015 10:44:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


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



reply via email to

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