Received: from eggs.gnu.org ([2001:4830:134:3::10]:47585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1wBv-0005Pp-Js for qemu-devel@nongnu.org; Wed, 02 Nov 2016 10:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1wBr-00046H-Jy for qemu-devel@nongnu.org; Wed, 02 Nov 2016 10:06:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c1wBr-00046D-Eq for qemu-devel@nongnu.org; Wed, 02 Nov 2016 10:06:55 -0400 Date: Wed, 2 Nov 2016 14:06:53 +0000 From: Stefan Hajnoczi Message-ID: <20161102140653.GH4693@stefanha-x1.localdomain> References: <20161021115442.18420-1-alex.bennee@linaro.org> <1776cd73-bfa5-8af8-5d76-34d9760a1664@redhat.com> <871syvxjan.fsf@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SdvjNjn6lL3tIsv0" Content-Disposition: inline In-Reply-To: <871syvxjan.fsf@linaro.org> Subject: Re: [Qemu-devel] [PATCH] cpus: make qemu_mutex_iothread_locked() understand co-routines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: Paolo Bonzini , qemu-devel@nongnu.org, Peter Crosthwaite , Richard Henderson --SdvjNjn6lL3tIsv0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 01, 2016 at 04:21:36PM +0000, Alex Benn=E9e wrote: >=20 > Paolo Bonzini writes: >=20 > > On 21/10/2016 13:54, Alex Benn=E9e wrote: > >> There is a slight wart when checking for the state of the BQL when usi= ng > >> GThread base co-routines (which we keep for ThreadSanitizer runs). Whi= le > >> 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=E9e > >> Cc: Stefan Hajnoczi > > > > This is wrong unfortunately. It is possible to run coroutines outside > > the BQL (e.g. with -device virtio-blk,iothread=3Dfoo). > > > > Do you know exactly why TSAN has no love for coroutines? >=20 > 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. >=20 > 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. Stefan --SdvjNjn6lL3tIsv0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYGfL9AAoJEJykq7OBq3PIzMgH/2O4Sfoa1ACwSqeT2Oyqfxww 1IRY+mMAUlH0vBlj5EJyZnnbeGz36n+v9L/+75qvEHb1Q07cIlrEIVDGEro+s+Qw LUnZ1xZgWU9qIRfo3TuSslpxvvarpUgXJmCmInUKtUhngo8+/Uo0w2dHvhuxG3Y9 VqW85lYvUQGEzvqPYcC7p2LmrqQWpajWUgTBBChv5SHwuMkBYoLeuPWRBAxLfyLh 9RIDtZ2FWtKPXw1sozqpsF6CN/MwlQmLMdHDxvgs0079WitNT6I801oN4++FRTeX ufB12Bk4kVhHtNGfeL/OAmTEq7uyqYzt9tDoh9N+N+NJoJhy9nxc3IvplC2SnW8= =61OT -----END PGP SIGNATURE----- --SdvjNjn6lL3tIsv0--