about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/alpha/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/arm/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/hppa/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/ia64/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/m68k/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/mips/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/nios2/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/nptl/bits/thread-shared-types.h32
-rw-r--r--sysdeps/nptl/fork.c2
-rw-r--r--sysdeps/nptl/pthread.h2
-rw-r--r--sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/s390/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/sh/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/sparc/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/tile/nptl/bits/pthreadtypes-arch.h2
-rw-r--r--sysdeps/x86/nptl/bits/pthreadtypes-arch.h7
18 files changed, 64 insertions, 7 deletions
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
index d13a75db07..9ab23d0474 100644
--- a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -45,6 +45,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION	0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
+#define __PTHREAD_MUTEX_USE_UNION          0
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
index b6f6cb1347..429df10c0c 100644
--- a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
@@ -33,6 +33,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
+#define __PTHREAD_MUTEX_USE_UNION          0
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
index 3f9eca4645..3911c8183d 100644
--- a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
@@ -34,6 +34,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
index c1585625d1..865a14ee4a 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -48,6 +48,8 @@
    pthread_mutex_t is larger than Linuxthreads.  */
 #define __PTHREAD_COMPAT_PADDING_END  int __reserved[2];
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
 
 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
index 631cb33d09..2a3bc75b20 100644
--- a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
@@ -33,6 +33,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
+#define __PTHREAD_MUTEX_USE_UNION          0
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
index 845b9e6c2b..966cc7569f 100644
--- a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
@@ -35,6 +35,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
 
 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4)))
 #define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4)))
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
index d687e2c076..e44f2dcb6a 100644
--- a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
@@ -35,6 +35,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
index 6aa1bda172..f03389acc6 100644
--- a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
@@ -42,6 +42,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (_MIPS_SIM != _ABI64)
+#define __PTHREAD_MUTEX_USE_UNION          (_MIPS_SIM != _ABI64)
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
index e2732f9771..83f8684604 100644
--- a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
@@ -35,6 +35,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
index 68b82b6bd6..da4358a965 100644
--- a/sysdeps/nptl/bits/thread-shared-types.h
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -42,6 +42,25 @@
 				    the internal structure.
    __PTHREAD_MUTEX_LOCK_ELISION   - 1 if the architecture supports lock
 				    elision or 0 otherwise.
+   __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers.  The
+				       preferred value for new architectures
+				       is 0.
+   __PTHREAD_MUTEX_USE_UNION      - control whether internal __spins and
+				    __list will be place inside a union for
+				    linuxthreads compatibility.
+				    The preferred value for new architectures
+				    is 0.
+
+   For a new port the preferred values for the required defines are:
+
+   #define __PTHREAD_COMPAT_PADDING_MID
+   #define __PTHREAD_COMPAT_PADDING_END
+   #define __PTHREAD_MUTEX_LOCK_ELISION         0
+   #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND    0
+   #define __PTHREAD_MUTEX_USE_UNION            0
+
+   __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to
+   eventually support lock elision using transactional memory.
 
    The additional macro defines any constraint for the lock alignment
    inside the thread structures:
@@ -59,7 +78,7 @@
 
 /* Common definition of pthread_mutex_t. */
 
-#if __WORDSIZE == 64
+#if !__PTHREAD_MUTEX_USE_UNION
 typedef struct __pthread_internal_list
 {
   struct __pthread_internal_list *__prev;
@@ -74,7 +93,7 @@ typedef struct __pthread_internal_slist
 
 /* Lock elision support.  */
 #if __PTHREAD_MUTEX_LOCK_ELISION
-# if __WORDSIZE == 64
+# if !__PTHREAD_MUTEX_USE_UNION
 #  define __PTHREAD_SPINS_DATA	\
   short __spins;		\
   short __elision
@@ -101,24 +120,27 @@ struct __pthread_mutex_s
   int __lock __LOCK_ALIGNMENT;
   unsigned int __count;
   int __owner;
-#if __WORDSIZE == 64
+#if !__PTHREAD_MUTEX_NUSERS_AFTER_KIND
   unsigned int __nusers;
 #endif
   /* KIND must stay at this position in the structure to maintain
      binary compatibility with static initializers.  */
   int __kind;
   __PTHREAD_COMPAT_PADDING_MID
-#if __WORDSIZE == 64
+#if __PTHREAD_MUTEX_NUSERS_AFTER_KIND
+  unsigned int __nusers;
+#endif
+#if !__PTHREAD_MUTEX_USE_UNION
   __PTHREAD_SPINS_DATA;
   __pthread_list_t __list;
 # define __PTHREAD_MUTEX_HAVE_PREV      1
 #else
-  unsigned int __nusers;
   __extension__ union
   {
     __PTHREAD_SPINS_DATA;
     __pthread_slist_t __list;
   };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
 #endif
   __PTHREAD_COMPAT_PADDING_END
 };
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index 4bb87e2331..48676c2f48 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -166,7 +166,7 @@ __libc_fork (void)
 	 inherit the correct value from the parent.  We do not need to clear
 	 the pending operation because it must have been zero when fork was
 	 called.  */
-# ifdef __PTHREAD_MUTEX_HAVE_PREV
+# if __PTHREAD_MUTEX_HAVE_PREV
       self->robust_prev = &self->robust_head;
 # endif
       self->robust_head.list = &self->robust_head;
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index 632ea7bc36..2b2b386ab3 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -83,7 +83,7 @@ enum
 #endif
 
 
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
+#if __PTHREAD_MUTEX_HAVE_PREV
 # define PTHREAD_MUTEX_INITIALIZER \
   { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } }
 # ifdef __USE_GNU
diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
index f29119b794..8158cb5abd 100644
--- a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
@@ -42,6 +42,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    1
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
index 3a9ac57625..1ae277367d 100644
--- a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
@@ -45,6 +45,8 @@
 #else
 #define __PTHREAD_MUTEX_LOCK_ELISION	0
 #endif
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
index b2615fe314..e707751aa6 100644
--- a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
@@ -34,6 +34,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
index 1e188cf91f..0f96f3711e 100644
--- a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
@@ -43,6 +43,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
index 145ee42ddb..054474f770 100644
--- a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
@@ -43,6 +43,8 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
index fd86806800..74d5f6d6e8 100644
--- a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
@@ -51,6 +51,13 @@
 #define __PTHREAD_COMPAT_PADDING_MID
 #define __PTHREAD_COMPAT_PADDING_END
 #define __PTHREAD_MUTEX_LOCK_ELISION    1
+#ifdef __x86_64__
+# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
+# define __PTHREAD_MUTEX_USE_UNION          0
+#else
+# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+# define __PTHREAD_MUTEX_USE_UNION          1
+#endif
 
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT