Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 04:50 PM, Brad wrote: - Original message - On 08/17/2011 10:28 AM, Blue Swirl wrote: GCC may support it but it can't use it on a platform if the other parts are missing (libc etc.). With a new-enough gcc, we provide the support in libgcc. I doubt gcc 4.2.1 fits the bil

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Brad
- Original message - > On 08/17/2011 10:28 AM, Blue Swirl wrote: > > GCC may support it but it can't use it on a platform if the other > > parts are missing (libc etc.). > > With a new-enough gcc, we provide the support in libgcc. I doubt gcc 4.2.1 fits the bill. -- This message has bee

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Brad
- Original message - > On Wed, Aug 17, 2011 at 5:28 PM, Paolo Bonzini > wrote: > > On 08/17/2011 10:26 AM, Stefan Hajnoczi wrote: > > > > > > > > > > > >  Do you know which Windows gcc versions support __thread and > > > > > > > if it would be reasonable to require those versions? > > > >

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Richard Henderson
On 08/17/2011 10:28 AM, Blue Swirl wrote: > GCC may support it but it can't use it on a platform if the other > parts are missing (libc etc.). With a new-enough gcc, we provide the support in libgcc. r~

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread malc
On Wed, 17 Aug 2011, Paolo Bonzini wrote: > On 08/17/2011 10:51 AM, Blue Swirl wrote: > > > Visual C++ supports __declspec(thread). > > > > > > pthread TLS is orders of magnitudes slower than __thread. __thread in an > > > executable is just as fast as a non-TLS variable access, 2 or 3 machine

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 10:51 AM, Blue Swirl wrote: > Visual C++ supports __declspec(thread). > > pthread TLS is orders of magnitudes slower than __thread. __thread in an > executable is just as fast as a non-TLS variable access, 2 or 3 machine > language instructions at most. > > Some pthread_getspe

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Blue Swirl
On Wed, Aug 17, 2011 at 5:45 PM, Paolo Bonzini wrote: > On 08/17/2011 10:37 AM, Blue Swirl wrote: >> >> >  I would agree (just did it for fun and to see how it looks like), but >> >  perhaps we can do something similar to what Windows does for OpenBSD >> > too. >> > >> >  Though I'm quite disappoi

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 10:37 AM, Blue Swirl wrote: > I would agree (just did it for fun and to see how it looks like), but > perhaps we can do something similar to what Windows does for OpenBSD too. > > Though I'm quite disappointed and I must say OpenBSD should enter the 21st > century. I can't just

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 10:34 AM, Blue Swirl wrote: Do you know which Windows gcc versions support __thread and if it would be reasonable to require those versions? It's probably 4.3 and newer, or something like that. No, GCC 3.3.6 manual already mentions it: http://gcc.gnu.org/onlinedocs/gcc-3.3.6/

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Blue Swirl
On Wed, Aug 17, 2011 at 5:28 PM, Paolo Bonzini wrote: > On 08/17/2011 10:26 AM, Stefan Hajnoczi wrote: >>  Do you know which Windows gcc versions support __thread and if it >>  would be reasonable to require those versions? >>> >>> > >>> >  It's probably 4.3 and newer, or something

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 10:28 AM, Blue Swirl wrote: >> The actual use of TLS within QEMU on POSIX systems will be optional >> though, right? > > Actually, TLS is already mandatory for both POSIX and Win32 systems. Not true, we have avoided TLS. > This patch tries to improve the situation on Windows

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Blue Swirl
On Wed, Aug 17, 2011 at 5:13 PM, Paolo Bonzini wrote: > On 08/17/2011 09:51 AM, Stefan Hajnoczi wrote: >> >> Hmm...this is pretty ugly low-level stuff.  glib provides portable TLS >> although I have found __thread significantly faster on Linux. >> >> I think our options are: >> 1. Use __thread and

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Blue Swirl
On Wed, Aug 17, 2011 at 6:55 AM, Paolo Bonzini wrote: > On 08/16/2011 09:36 PM, Brad wrote: >> >>> Win32 emulated TLS is slow and is not available on all versions of GCC. >>> Actually, Win32 does have support for decent TLS, only GCC does not map >>> __thread to it.  The good news is, it's perfect

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 10:26 AM, Stefan Hajnoczi wrote: >> Do you know which Windows gcc versions support __thread and if it >> would be reasonable to require those versions? > > It's probably 4.3 and newer, or something like that. I suggest we simply require that minimum gcc version. I would agree

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Stefan Hajnoczi
On Wed, Aug 17, 2011 at 6:13 PM, Paolo Bonzini wrote: > On 08/17/2011 09:51 AM, Stefan Hajnoczi wrote: >> >> Hmm...this is pretty ugly low-level stuff.  glib provides portable TLS >> although I have found __thread significantly faster on Linux. >> >> I think our options are: >> 1. Use __thread and

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Paolo Bonzini
On 08/17/2011 09:51 AM, Stefan Hajnoczi wrote: Hmm...this is pretty ugly low-level stuff. glib provides portable TLS although I have found __thread significantly faster on Linux. I think our options are: 1. Use __thread and require recent gcc versions on Windows. Not as fast as native Windows

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-17 Thread Stefan Hajnoczi
On Tue, Aug 16, 2011 at 7:51 PM, Paolo Bonzini wrote: > Win32 emulated TLS is slow and is not available on all versions of GCC. > Actually, Win32 does have support for decent TLS, only GCC does not map > __thread to it.  The good news is, it's perfectly possible to declare > TLS variables with sim

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-16 Thread Paolo Bonzini
On 08/16/2011 09:36 PM, Brad wrote: Win32 emulated TLS is slow and is not available on all versions of GCC. Actually, Win32 does have support for decent TLS, only GCC does not map __thread to it. The good news is, it's perfectly possible to declare TLS variables with simple C code! This patch

Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-16 Thread Brad
On 16/08/11 2:51 PM, Paolo Bonzini wrote: Win32 emulated TLS is slow and is not available on all versions of GCC. Actually, Win32 does have support for decent TLS, only GCC does not map __thread to it. The good news is, it's perfectly possible to declare TLS variables with simple C code! This p

[Qemu-devel] [PATCH] qemu-thread: add TLS wrappers

2011-08-16 Thread Paolo Bonzini
Win32 emulated TLS is slow and is not available on all versions of GCC. Actually, Win32 does have support for decent TLS, only GCC does not map __thread to it. The good news is, it's perfectly possible to declare TLS variables with simple C code! This patch adds wrappers to qemu-thread that will