From: "Alex Bennée" <alex.bennee@linaro.org>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] cpus: make qemu_mutex_iothread_locked() understand co-routines
Date: Wed, 02 Nov 2016 14:55:37 +0000 [thread overview]
Message-ID: <874m3que1i.fsf@linaro.org> (raw)
In-Reply-To: <20161102140653.GH4693@stefanha-x1.localdomain>
Stefan Hajnoczi <stefanha@redhat.com> writes:
> On Tue, Nov 01, 2016 at 04:21:36PM +0000, Alex Bennée wrote:
>>
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>> > On 21/10/2016 13:54, Alex Bennée wrote:
>> >> There is a slight wart when checking for the state of the BQL when using
>> >> GThread base co-routines (which we keep for ThreadSanitizer runs). While
>> >> the main-loop holds the BQL it is suspended until the co-routine
>> >> completes however the co-routines run in a separate thread so checking
>> >> the TLS variable could be wrong.
>> >>
>> >> We fix this by expanding the check to include qemu_in_coroutine() for
>> >> GThread based builds. As it is not used for production builds I'm not
>> >> overly worried about any performance impact which should be negligible
>> >> anyway.
>> >>
>> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> >> Cc: Stefan Hajnoczi <stefanha@redhat.com>
>> >
>> > This is wrong unfortunately. It is possible to run coroutines outside
>> > the BQL (e.g. with -device virtio-blk,iothread=foo).
>> >
>> > Do you know exactly why TSAN has no love for coroutines?
>>
>> The current production stuff is due to missing support for new stacks
>> with setcontext. However I have built the latest tsan support library
>> and that seems happy without the gthread co-routines.
>>
>> Currently I'm dealing with glib's racy gthread support however.
>
> I think Paolo suggested we drop the GThread backend on IRC. I agree
> that we should do that since GThread co-routines break code that uses
> thread-local variables and have never truly worked.
Indeed I have pulled your patch into my current series of sanitizer
fixes. Once I can fix the setcontext/sigjmp confusion for a
__SANITIZER__ builds I'll post the series.
--
Alex Bennée
prev parent reply other threads:[~2016-11-02 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 11:54 [Qemu-devel] [PATCH] cpus: make qemu_mutex_iothread_locked() understand co-routines Alex Bennée
2016-11-01 15:04 ` Paolo Bonzini
2016-11-01 16:21 ` Alex Bennée
2016-11-02 14:06 ` Stefan Hajnoczi
2016-11-02 14:55 ` Alex Bennée [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=874m3que1i.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=crosthwaite.peter@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--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).