From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ4xS-0001U3-0L for qemu-devel@nongnu.org; Wed, 26 Oct 2011 10:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJ4xM-0007s7-Ro for qemu-devel@nongnu.org; Wed, 26 Oct 2011 10:59:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ4xM-0007rv-H0 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 10:59:52 -0400 Message-ID: <4EA82062.7010006@redhat.com> Date: Wed, 26 Oct 2011 16:59:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20111003163352.GA22822@davesworkthinkpad> <4E89F62E.1020804@web.de> <87lit0n66z.fsf@ginnungagap.bsc.es> <4E8B41D8.3050502@web.de> <4E8C0275.50107@redhat.com> <4E8C0CA0.2010006@web.de> <4E8C217D.10800@redhat.com> <4EA81BB2.90904@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Peter Maydell Cc: "Dr. David Alan Gilbert" , agraf@suse.de, Jan Kiszka , qemu-devel@nongnu.org, patches@linaro.org On 10/26/2011 04:54 PM, Peter Maydell wrote: > On 26 October 2011 15:39, Paolo Bonzini wrote: >> On 10/26/2011 04:03 PM, Peter Maydell wrote: >>> >>> For the record (since I think we only talked about this on IRC): >>> * the POSIX TLS fallback code doesn't work on Linux hosts for >>> linux-user emulation (the constructor is never called to set up >>> the TLS for the main thread, probably something to do with our >>> custom linker script, since it does work OK for system emulation) >>> * if I recall correctly from IRC it doesn't compile on OpenBSD >>> >>> so for 1.0 perhaps we need to fall back to a simpler set of patches >>> that just avoid the regression in thread support for linux-user ? >> >> I agree. > > I was thinking something like a trivial qemu-tls.h which does > > #ifdef __linux__ > #define DECLARE_TLS(type, x) extern DEFINE_TLS(type, x) > #define DEFINE_TLS(type, x) __thread __typeof__(type) tls__##x > #define get_tls(x) tls__##x > #else > /* Dummy implementations -- we can get away with this because system > * mode is effectively single-threaded for our current limited use of > * TLS, and the only -user mode which supports multiple threads is > * linux-user. > * TODO: proper implementations via Win32 .tls sections and > * POSIX pthread_getspecific. > */ > #define DECLARE_TLS(type, x) extern DEFINE_TLS(type, x) > #define DEFINE_TLS(type, x) __typeof__(type) tls__##x > #define get_tls(x) tls__##x > #endif > > and then we can just use your "Make cpu_single_env thread-local" > patch as-is: > > http://git.linaro.org/gitweb?p=people/pmaydell/qemu-arm.git;a=commitdiff;h=b674559fc8a67ae7d30fe3ab3062d5855ac77d2d > > (for that matter we could apply the "Prepare Windows port for > thread-local cpu_single_env" patch too, but that's not a requirement.) That would be fine. Paolo