diff options
Diffstat (limited to 'sysdeps/hppa/nptl')
-rw-r--r-- | sysdeps/hppa/nptl/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/bits/pthreadtypes.h | 2 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/bits/semaphore.h | 2 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/jmpbuf-unwind.h | 2 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/pthread_spin_init.c | 26 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/pthread_spin_lock.c | 2 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/pthread_spin_unlock.c | 26 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/pthreaddef.h | 2 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/tls.h | 5 | ||||
-rw-r--r-- | sysdeps/hppa/nptl/tst-oddstacklimit.c | 2 |
10 files changed, 50 insertions, 21 deletions
diff --git a/sysdeps/hppa/nptl/Makefile b/sysdeps/hppa/nptl/Makefile index f4412c3a3b..2dea713081 100644 --- a/sysdeps/hppa/nptl/Makefile +++ b/sysdeps/hppa/nptl/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2005-2015 Free Software Foundation, Inc. +# Copyright (C) 2005-2016 Free Software Foundation, Inc. # This file is part of the GNU C Library. # # The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h index a361ecf2ae..540802a70c 100644 --- a/sysdeps/hppa/nptl/bits/pthreadtypes.h +++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/hppa/nptl/bits/semaphore.h b/sysdeps/hppa/nptl/bits/semaphore.h index 92694aab4f..4cdac957fb 100644 --- a/sysdeps/hppa/nptl/bits/semaphore.h +++ b/sysdeps/hppa/nptl/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/hppa/nptl/jmpbuf-unwind.h b/sysdeps/hppa/nptl/jmpbuf-unwind.h index 50a3746ce0..27c4f6f116 100644 --- a/sysdeps/hppa/nptl/jmpbuf-unwind.h +++ b/sysdeps/hppa/nptl/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2015 Free Software Foundation, Inc. +/* Copyright (C) 2003-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/hppa/nptl/pthread_spin_init.c b/sysdeps/hppa/nptl/pthread_spin_init.c index 865ef2bfac..2df0376d8b 100644 --- a/sysdeps/hppa/nptl/pthread_spin_init.c +++ b/sysdeps/hppa/nptl/pthread_spin_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2015 Free Software Foundation, Inc. +/* Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,9 +20,25 @@ int pthread_spin_init (pthread_spinlock_t *lock, int pshared) { - int tmp = 0; - /* This should be a memory barrier to newer compilers */ - __asm__ __volatile__ ("stw,ma %1,0(%0)" - : : "r" (lock), "r" (tmp) : "memory"); + /* CONCURRENCTY NOTES: + + The atomic_exchange_rel synchronizes-with the atomic_exhange_acq in + pthread_spin_lock. + + On hppa we must not use a plain `stw` to reset the guard lock. This + has to do with the kernel compare-and-swap helper that is used to + implement all of the atomic operations. + + The kernel CAS helper uses its own internal locks and that means that + to create a true happens-before relationship between any two threads, + the second thread must observe the internal lock having a value of 0 + (it must attempt to take the lock with ldcw). This creates the + ordering required for a second thread to observe the effects of the + RMW of the kernel CAS helper in any other thread. + + Therefore if a variable is used in an atomic macro it must always be + manipulated with atomic macros in order for memory ordering rules to + be preserved. */ + atomic_exchange_rel (lock, 0); return 0; } diff --git a/sysdeps/hppa/nptl/pthread_spin_lock.c b/sysdeps/hppa/nptl/pthread_spin_lock.c index 3ea253851b..2dea818315 100644 --- a/sysdeps/hppa/nptl/pthread_spin_lock.c +++ b/sysdeps/hppa/nptl/pthread_spin_lock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/hppa/nptl/pthread_spin_unlock.c b/sysdeps/hppa/nptl/pthread_spin_unlock.c index a183fed35e..6e4d71ecf1 100644 --- a/sysdeps/hppa/nptl/pthread_spin_unlock.c +++ b/sysdeps/hppa/nptl/pthread_spin_unlock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,9 +20,25 @@ int pthread_spin_unlock (pthread_spinlock_t *lock) { - int tmp = 0; - /* This should be a memory barrier to newer compilers */ - __asm__ __volatile__ ("stw,ma %1,0(%0)" - : : "r" (lock), "r" (tmp) : "memory"); + /* CONCURRENCTY NOTES: + + The atomic_exchange_rel synchronizes-with the atomic_exhange_acq in + pthread_spin_lock. + + On hppa we must not use a plain `stw` to reset the guard lock. This + has to do with the kernel compare-and-swap helper that is used to + implement all of the atomic operations. + + The kernel CAS helper uses its own internal locks and that means that + to create a true happens-before relationship between any two threads, + the second thread must observe the internal lock having a value of 0 + (it must attempt to take the lock with ldcw). This creates the + ordering required for a second thread to observe the effects of the + RMW of the kernel CAS helper in any other thread. + + Therefore if a variable is used in an atomic macro it must always be + manipulated with atomic macros in order for memory ordering rules to + be preserved. */ + atomic_exchange_rel (lock, 0); return 0; } diff --git a/sysdeps/hppa/nptl/pthreaddef.h b/sysdeps/hppa/nptl/pthreaddef.h index c5ce188c5c..fa1ab4c697 100644 --- a/sysdeps/hppa/nptl/pthreaddef.h +++ b/sysdeps/hppa/nptl/pthreaddef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h index ab271cf241..2e0c861e09 100644 --- a/sysdeps/hppa/nptl/tls.h +++ b/sysdeps/hppa/nptl/tls.h @@ -1,5 +1,5 @@ /* Definition for thread-local data handling. NPTL/hppa version. - Copyright (C) 2005-2015 Free Software Foundation, Inc. + Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -41,9 +41,6 @@ typedef union dtv # include <tcb-offsets.h> #endif /* __ASSEMBLER__ */ -/* Signal that TLS support is available. */ -#define USE_TLS 1 - #ifndef __ASSEMBLER__ /* Get system call information. */ diff --git a/sysdeps/hppa/nptl/tst-oddstacklimit.c b/sysdeps/hppa/nptl/tst-oddstacklimit.c index 49f88a9da3..7579235957 100644 --- a/sysdeps/hppa/nptl/tst-oddstacklimit.c +++ b/sysdeps/hppa/nptl/tst-oddstacklimit.c @@ -1,6 +1,6 @@ /* Test NPTL with stack limit that is not a multiple of the page size. HPPA version. - Copyright (C) 2012-2015 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or |