From: "Halsey Pian" <halsey.pian@gmail.com>
To: 'Paolo Bonzini' <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: halsey.pian@gmail.com
Subject: Re: [Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively"
Date: Fri, 6 Mar 2015 19:10:43 +0800 [thread overview]
Message-ID: <001d01d057fe$3916f560$ab44e020$@gmail.com> (raw)
In-Reply-To: <54F9770A.6030205@redhat.com>
> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonzini@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]
prev parent reply other threads:[~2015-03-06 11:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 7:03 [Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively" Halsey Pian
2015-03-06 7:15 ` Halsey Pian
2015-03-06 9:44 ` Paolo Bonzini
2015-03-06 11:10 ` Halsey Pian [this message]
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='001d01d057fe$3916f560$ab44e020$@gmail.com' \
--to=halsey.pian@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).