From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAmg6-0003Xf-QC for qemu-devel@nongnu.org; Mon, 03 Oct 2011 13:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RAmg5-0006IT-LF for qemu-devel@nongnu.org; Mon, 03 Oct 2011 13:51:46 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:41205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAmg5-0006IL-6q for qemu-devel@nongnu.org; Mon, 03 Oct 2011 13:51:45 -0400 Message-ID: <4E89F62E.1020804@web.de> Date: Mon, 03 Oct 2011 19:51:42 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20111003163352.GA22822@davesworkthinkpad> In-Reply-To: <20111003163352.GA22822@davesworkthinkpad> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0E18179F4E768A34F1CF5C9A" Sender: jan.kiszka@web.de Subject: Re: [Qemu-devel] [PATCH] Make cpu_single_env thread local (Linux only for now) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: peter.maydell@linaro.org, patches@linaro.org, qemu-devel@nongnu.org, agraf@suse.de This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0E18179F4E768A34F1CF5C9A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-10-03 18:33, Dr. David Alan Gilbert wrote: > Make cpu_single_env thread local (Linux only for now) > * Fixes some user space threading issues (esp those triggered > by bug 823902) >=20 > Against rev d11cf8cc..., tested on ARM user mode, and ARM Vexpress > system mode (with Blue Swirl's fix from yesterday) - only > tested on Linux host. Lets me run ARM userspace firefox. >=20 > Signed-off-by: Dr. David Alan Gilbert >=20 > diff --git a/cpu-all.h b/cpu-all.h > index 42a5fa0..d895ee6 100644 > --- a/cpu-all.h > +++ b/cpu-all.h > @@ -334,7 +334,13 @@ void cpu_dump_statistics(CPUState *env, FILE *f, f= printf_function cpu_fprintf, > void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...) > GCC_FMT_ATTR(2, 3); > extern CPUState *first_cpu; > + > +#ifdef __linux__ > +/* DAG: Only tested thread local on Linux, feel free to add others */ > +extern __thread CPUState *cpu_single_env; > +#else > extern CPUState *cpu_single_env; > +#endif We need this for all platforms in order to skip qemu_global_mutex while manipulating some CPUState. And leaving some platforms with non-TLS will eventually break them when code is added that assumes TLS. However, it's not unlikely that some weird platforms / ancient toolchains still have problems with __thread - even on Linux. We may want to play safe and use pthread_key on POSIX. Jan --------------enig0E18179F4E768A34F1CF5C9A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6J9i4ACgkQitSsb3rl5xSl2gCg15Fju/5OxERR6MB8bhK/yOEm /FwAn3AOTQSq2d85Ilx7NV+IF9leOKAO =MjVx -----END PGP SIGNATURE----- --------------enig0E18179F4E768A34F1CF5C9A--