This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC 0/2] Use address spaces for x86 tls
- From: Richard Henderson <rth at twiddle dot net>
- To: libc-alpha at sourceware dot org
- Date: Thu, 8 Oct 2015 14:58:23 +1100
- Subject: [RFC 0/2] Use address spaces for x86 tls
- Authentication-results: sourceware.org; auth=none
There's a companion patch for the compiler side. But it seemed the
easiest testsuite to come up with in a hurry was glibc itself.
There's an intentional change, in that we eschew %fs:self (0x10) in
favor of the abi-defined conversion between the __seg_tls subspace
and the generic address space (aka the flat address space), which
is %fs:0. These values are currently the same, with the comment
_head->tcb = _thrdescr;
/* For now the thread descriptor is at the same address. */
_head->self = _thrdescr;
But apart from that, there are a (small) number of places where the
compiler is able to better optimize. Primarily via CSE, where two
THREAD_GETMEM are combined where they weren't before. But there is
also one case where the compiler is able to fold a sign-extension
into the THREAD_GETMEM.
Otherwise the code is practically identical. Which, I suppose is
good in that glibc is currently doing a fair job with its macros.
So the change is perhaps only of interest in terms of (very) long term
maintenance (i.e. once gcc6 is the minimal require build compiler).
r~
Richard Henderson (2):
Introduce pthread_self_t
x86_64: Use __seg_tls for thread access when available
csu/libc-start.c | 2 +-
nptl/allocatestack.c | 4 +--
nptl/cancellation.c | 4 +--
nptl/cleanup.c | 2 +-
nptl/cleanup_compat.c | 4 +--
nptl/cleanup_defer.c | 4 +--
nptl/cleanup_defer_compat.c | 4 +--
nptl/nptl-init.c | 6 ++--
nptl/pt-cleanup.c | 2 +-
nptl/pthreadP.h | 2 +-
nptl/pthread_create.c | 4 +--
nptl/pthread_join.c | 2 +-
nptl/pthread_setcancelstate.c | 4 +--
nptl/pthread_setcanceltype.c | 2 +-
nptl/pthread_setspecific.c | 4 +--
nptl/pthread_timedjoin.c | 3 +-
nptl/pthread_tryjoin.c | 3 +-
nptl/tpp.c | 4 +--
nptl/unwind.c | 4 +--
sysdeps/aarch64/nptl/tls.h | 2 ++
sysdeps/alpha/nptl/tls.h | 2 ++
sysdeps/arm/nptl/tls.h | 2 ++
sysdeps/hppa/nptl/tls.h | 2 ++
sysdeps/i386/nptl/tls.h | 2 ++
sysdeps/ia64/nptl/tls.h | 3 +-
sysdeps/m68k/nptl/tls.h | 2 ++
sysdeps/mach/hurd/i386/tls.h | 3 ++
sysdeps/microblaze/nptl/tls.h | 2 ++
sysdeps/mips/nptl/tls.h | 2 ++
sysdeps/nacl/exit-thread.h | 2 +-
sysdeps/nios2/nptl/tls.h | 2 ++
sysdeps/nptl/fork.c | 2 +-
sysdeps/powerpc/nptl/tls.h | 2 ++
sysdeps/s390/nptl/tls.h | 2 ++
sysdeps/sh/nptl/tls.h | 2 ++
sysdeps/sparc/nptl/tls.h | 2 ++
sysdeps/tile/nptl/tls.h | 2 ++
sysdeps/unix/sysv/linux/raise.c | 2 +-
sysdeps/unix/sysv/linux/x86_64/arch-fork.h | 2 +-
sysdeps/x86_64/nptl/tls.h | 46 +++++++++++++++++++++++-------
40 files changed, 101 insertions(+), 51 deletions(-)
--
2.4.3