[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] cpus: make qemu_mutex_iothread_locked() underst
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH] cpus: make qemu_mutex_iothread_locked() understand co-routines |
Date: |
Wed, 02 Nov 2016 14:55:37 +0000 |
User-agent: |
mu4e 0.9.17; emacs 25.1.50.14 |
Stefan Hajnoczi <address@hidden> writes:
> On Tue, Nov 01, 2016 at 04:21:36PM +0000, Alex Bennée wrote:
>>
>> Paolo Bonzini <address@hidden> 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 <address@hidden>
>> >> Cc: Stefan Hajnoczi <address@hidden>
>> >
>> > 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