|
|
8ae002 |
commit 075b9322c9e091b7e139f4c57e07d78d896c7a62
|
|
|
8ae002 |
Author: Dominik Vogt <vogt@de.ibm.com>
|
|
|
8ae002 |
Date: Fri Jul 19 05:16:28 2013 +0000
|
|
|
8ae002 |
|
|
|
8ae002 |
Clean up whitespace in lock elision patches.
|
|
|
8ae002 |
|
|
|
8ae002 |
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/pthread_mutex_lock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/pthread_mutex_lock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/pthread_mutex_lock.c
|
|
|
8ae002 |
@@ -86,7 +86,7 @@ __pthread_mutex_lock (mutex)
|
|
|
8ae002 |
/* This case can never happen on a system without elision,
|
|
|
8ae002 |
as the mutex type initialization functions will not
|
|
|
8ae002 |
allow to set the elision flags. */
|
|
|
8ae002 |
- /* Don't record owner or users for elision case. This is a
|
|
|
8ae002 |
+ /* Don't record owner or users for elision case. This is a
|
|
|
8ae002 |
tail call. */
|
|
|
8ae002 |
return LLL_MUTEX_LOCK_ELISION (mutex);
|
|
|
8ae002 |
}
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/pthread_mutex_trylock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/pthread_mutex_trylock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/pthread_mutex_trylock.c
|
|
|
8ae002 |
@@ -31,7 +31,7 @@
|
|
|
8ae002 |
#endif
|
|
|
8ae002 |
|
|
|
8ae002 |
/* We don't force elision in trylock, because this can lead to inconsistent
|
|
|
8ae002 |
- lock state if the lock was actually busy. */
|
|
|
8ae002 |
+ lock state if the lock was actually busy. */
|
|
|
8ae002 |
|
|
|
8ae002 |
int
|
|
|
8ae002 |
__pthread_mutex_trylock (mutex)
|
|
|
8ae002 |
@@ -73,7 +73,7 @@ __pthread_mutex_trylock (mutex)
|
|
|
8ae002 |
if (lll_trylock_elision (mutex->__data.__lock,
|
|
|
8ae002 |
mutex->__data.__elision) != 0)
|
|
|
8ae002 |
break;
|
|
|
8ae002 |
- /* Don't record the ownership. */
|
|
|
8ae002 |
+ /* Don't record the ownership. */
|
|
|
8ae002 |
return 0;
|
|
|
8ae002 |
|
|
|
8ae002 |
case PTHREAD_MUTEX_TIMED_NP:
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h
|
|
|
8ae002 |
@@ -112,7 +112,7 @@ typedef union
|
|
|
8ae002 |
{
|
|
|
8ae002 |
struct
|
|
|
8ae002 |
{
|
|
|
8ae002 |
- short __espins;
|
|
|
8ae002 |
+ short __espins;
|
|
|
8ae002 |
short __elision;
|
|
|
8ae002 |
# define __spins d.__espins
|
|
|
8ae002 |
# define __elision d.__elision
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
|
|
|
8ae002 |
@@ -14,7 +14,7 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
|
|
|
8ae002 |
#include "config.h"
|
|
|
8ae002 |
#include <pthreadP.h>
|
|
|
8ae002 |
@@ -32,7 +32,7 @@ struct elision_config __elision_aconf =
|
|
|
8ae002 |
acquisition attempts. */
|
|
|
8ae002 |
.skip_lock_busy = 3,
|
|
|
8ae002 |
/* How often to not attempt to use elision if a transaction aborted due
|
|
|
8ae002 |
- to reasons other than other threads' memory accesses. Expressed in
|
|
|
8ae002 |
+ to reasons other than other threads' memory accesses. Expressed in
|
|
|
8ae002 |
number of lock acquisition attempts. */
|
|
|
8ae002 |
.skip_lock_internal_abort = 3,
|
|
|
8ae002 |
/* How often we retry using elision if there is chance for the transaction
|
|
|
8ae002 |
@@ -52,13 +52,14 @@ int __rwlock_rtm_enabled attribute_hidde
|
|
|
8ae002 |
|
|
|
8ae002 |
int __rwlock_rtm_read_retries attribute_hidden = 3;
|
|
|
8ae002 |
|
|
|
8ae002 |
-/* Set when the CPU supports elision. When false elision is never attempted. */
|
|
|
8ae002 |
+/* Set when the CPU supports elision. When false elision is never attempted.
|
|
|
8ae002 |
+ */
|
|
|
8ae002 |
|
|
|
8ae002 |
int __elision_available attribute_hidden;
|
|
|
8ae002 |
|
|
|
8ae002 |
-/* Force elision for all new locks. This is used to decide whether existing
|
|
|
8ae002 |
+/* Force elision for all new locks. This is used to decide whether existing
|
|
|
8ae002 |
DEFAULT locks should be automatically upgraded to elision in
|
|
|
8ae002 |
- pthread_mutex_lock(). Disabled for suid programs. Only used when elision
|
|
|
8ae002 |
+ pthread_mutex_lock(). Disabled for suid programs. Only used when elision
|
|
|
8ae002 |
is available. */
|
|
|
8ae002 |
|
|
|
8ae002 |
int __pthread_force_elision attribute_hidden;
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.h
|
|
|
8ae002 |
@@ -14,7 +14,7 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
#ifndef _ELISION_CONF_H
|
|
|
8ae002 |
#define _ELISION_CONF_H 1
|
|
|
8ae002 |
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
|
|
|
8ae002 |
@@ -14,7 +14,7 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
|
|
|
8ae002 |
#include <pthread.h>
|
|
|
8ae002 |
#include "pthreadP.h"
|
|
|
8ae002 |
@@ -58,7 +58,7 @@ __lll_lock_elision (int *futex, short *a
|
|
|
8ae002 |
if (*futex == 0)
|
|
|
8ae002 |
return 0;
|
|
|
8ae002 |
|
|
|
8ae002 |
- /* Lock was busy. Fall back to normal locking.
|
|
|
8ae002 |
+ /* Lock was busy. Fall back to normal locking.
|
|
|
8ae002 |
Could also _xend here but xabort with 0xff code
|
|
|
8ae002 |
is more visible in the profiler. */
|
|
|
8ae002 |
_xabort (_ABORT_LOCK_BUSY);
|
|
|
8ae002 |
@@ -69,12 +69,12 @@ __lll_lock_elision (int *futex, short *a
|
|
|
8ae002 |
if ((status & _XABORT_EXPLICIT)
|
|
|
8ae002 |
&& _XABORT_CODE (status) == _ABORT_LOCK_BUSY)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
- /* Right now we skip here. Better would be to wait a bit
|
|
|
8ae002 |
- and retry. This likely needs some spinning. */
|
|
|
8ae002 |
+ /* Right now we skip here. Better would be to wait a bit
|
|
|
8ae002 |
+ and retry. This likely needs some spinning. */
|
|
|
8ae002 |
if (*adapt_count != aconf.skip_lock_busy)
|
|
|
8ae002 |
*adapt_count = aconf.skip_lock_busy;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
- /* Internal abort. There is no chance for retry.
|
|
|
8ae002 |
+ /* Internal abort. There is no chance for retry.
|
|
|
8ae002 |
Use the normal locking and next time use lock.
|
|
|
8ae002 |
Be careful to avoid writing to the lock. */
|
|
|
8ae002 |
else if (*adapt_count != aconf.skip_lock_internal_abort)
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-timed.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/elision-timed.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-timed.c
|
|
|
8ae002 |
@@ -14,7 +14,7 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
|
|
|
8ae002 |
#include <time.h>
|
|
|
8ae002 |
#include <elision-conf.h>
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c
|
|
|
8ae002 |
@@ -14,7 +14,7 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
|
|
|
8ae002 |
#include <pthread.h>
|
|
|
8ae002 |
#include <pthreadP.h>
|
|
|
8ae002 |
@@ -24,14 +24,14 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
#define aconf __elision_aconf
|
|
|
8ae002 |
|
|
|
8ae002 |
-/* Try to elide a futex trylock. FUTEX is the futex variable. ADAPT_COUNT is the
|
|
|
8ae002 |
- adaptation counter in the mutex. */
|
|
|
8ae002 |
+/* Try to elide a futex trylock. FUTEX is the futex variable. ADAPT_COUNT is
|
|
|
8ae002 |
+ the adaptation counter in the mutex. */
|
|
|
8ae002 |
|
|
|
8ae002 |
int
|
|
|
8ae002 |
__lll_trylock_elision (int *futex, short *adapt_count)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
/* Implement POSIX semantics by forbiding nesting
|
|
|
8ae002 |
- trylock. Sorry. After the abort the code is re-executed
|
|
|
8ae002 |
+ trylock. Sorry. After the abort the code is re-executed
|
|
|
8ae002 |
non transactional and if the lock was already locked
|
|
|
8ae002 |
return an error. */
|
|
|
8ae002 |
_xabort (_ABORT_NESTED_TRYLOCK);
|
|
|
8ae002 |
@@ -46,7 +46,7 @@ __lll_trylock_elision (int *futex, short
|
|
|
8ae002 |
if (*futex == 0)
|
|
|
8ae002 |
return 0;
|
|
|
8ae002 |
|
|
|
8ae002 |
- /* Lock was busy. Fall back to normal locking.
|
|
|
8ae002 |
+ /* Lock was busy. Fall back to normal locking.
|
|
|
8ae002 |
Could also _xend here but xabort with 0xff code
|
|
|
8ae002 |
is more visible in the profiler. */
|
|
|
8ae002 |
_xabort (_ABORT_LOCK_BUSY);
|
|
|
8ae002 |
@@ -54,12 +54,12 @@ __lll_trylock_elision (int *futex, short
|
|
|
8ae002 |
|
|
|
8ae002 |
if (!(status & _XABORT_RETRY))
|
|
|
8ae002 |
{
|
|
|
8ae002 |
- /* Internal abort. No chance for retry. For future
|
|
|
8ae002 |
+ /* Internal abort. No chance for retry. For future
|
|
|
8ae002 |
locks don't try speculation for some time. */
|
|
|
8ae002 |
if (*adapt_count != aconf.skip_trylock_internal_abort)
|
|
|
8ae002 |
*adapt_count = aconf.skip_trylock_internal_abort;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
- /* Could do some retries here. */
|
|
|
8ae002 |
+ /* Could do some retries here. */
|
|
|
8ae002 |
}
|
|
|
8ae002 |
else
|
|
|
8ae002 |
{
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
|
|
|
8ae002 |
@@ -14,7 +14,7 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
|
|
|
8ae002 |
/* Check for elision on this lock without upgrading. */
|
|
|
8ae002 |
#define DO_ELISION(m) \
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/hle.h
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/hle.h
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/hle.h
|
|
|
8ae002 |
@@ -1,5 +1,5 @@
|
|
|
8ae002 |
-/* Shared RTM header. Emulate TSX intrinsics for compilers and assemblers
|
|
|
8ae002 |
- that do not support the intrinsics and instructions yet. */
|
|
|
8ae002 |
+/* Shared RTM header. Emulate TSX intrinsics for compilers and assemblers
|
|
|
8ae002 |
+ that do not support the intrinsics and instructions yet. */
|
|
|
8ae002 |
#ifndef _HLE_H
|
|
|
8ae002 |
#define _HLE_H 1
|
|
|
8ae002 |
|
|
|
8ae002 |
@@ -28,7 +28,7 @@
|
|
|
8ae002 |
/* Official RTM intrinsics interface matching gcc/icc, but works
|
|
|
8ae002 |
on older gcc compatible compilers and binutils.
|
|
|
8ae002 |
We should somehow detect if the compiler supports it, because
|
|
|
8ae002 |
- it may be able to generate slightly better code. */
|
|
|
8ae002 |
+ it may be able to generate slightly better code. */
|
|
|
8ae002 |
|
|
|
8ae002 |
#define _XBEGIN_STARTED (~0u)
|
|
|
8ae002 |
#define _XABORT_EXPLICIT (1 << 0)
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_cond_lock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_cond_lock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_cond_lock.c
|
|
|
8ae002 |
@@ -13,9 +13,10 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
|
|
|
8ae002 |
/* The cond lock is not actually elided yet, but we still need to handle
|
|
|
8ae002 |
already elided locks. */
|
|
|
8ae002 |
#include <elision-conf.h>
|
|
|
8ae002 |
+
|
|
|
8ae002 |
#include "sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c"
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_lock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_lock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_lock.c
|
|
|
8ae002 |
@@ -14,7 +14,8 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+
|
|
|
8ae002 |
#include <elision-conf.h>
|
|
|
8ae002 |
#include "force-elision.h"
|
|
|
8ae002 |
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_timedlock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_timedlock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_timedlock.c
|
|
|
8ae002 |
@@ -14,7 +14,9 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+
|
|
|
8ae002 |
#include <elision-conf.h>
|
|
|
8ae002 |
#include "force-elision.h"
|
|
|
8ae002 |
+
|
|
|
8ae002 |
#include "nptl/pthread_mutex_timedlock.c"
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_trylock.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_trylock.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_trylock.c
|
|
|
8ae002 |
@@ -14,7 +14,8 @@
|
|
|
8ae002 |
|
|
|
8ae002 |
You should have received a copy of the GNU Lesser General Public
|
|
|
8ae002 |
License along with the GNU C Library; if not, see
|
|
|
8ae002 |
- <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
8ae002 |
+
|
|
|
8ae002 |
#include <elision-conf.h>
|
|
|
8ae002 |
#include "force-elision.h"
|
|
|
8ae002 |
|