about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--INSTALL3
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure16
-rw-r--r--configure.in9
-rw-r--r--manual/install.texi3
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c3
8 files changed, 50 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b37552bd5..11fbdd2fc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-07-02  Andi Kleen <ak@linux.intel.com>
+
+	* config.h.in (ENABLE_LOCK_ELISION): Add.
+	* configure.in (--enable-lock-elision): Add option.
+	* manual/install.texi: Document --enable lock elision.
+	* configure: Regenerate
+	* INSTALL: Regenerate.
+
 2013-07-02  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/i386/i686/multiarch/strcasecmp.S (__strcasecmp): Enable
diff --git a/INSTALL b/INSTALL
index a74929363c..f1b498a14e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -133,6 +133,9 @@ will be used, and CFLAGS sets optimization options for the compiler.
      library.  This option hardcodes the newly built C library path in
      dynamic tests so that they can be invoked directly.
 
+`--enable-lock-elision=yes'
+     Enable lock elision for pthread mutexes and rwlocks by default.
+
 `--build=BUILD-SYSTEM'
 `--host=HOST-SYSTEM'
      These options are for cross-compiling.  If you specify both
diff --git a/config.h.in b/config.h.in
index b5c6f163a7..6284e2a99b 100644
--- a/config.h.in
+++ b/config.h.in
@@ -164,6 +164,9 @@
 /* Define if __stack_chk_guard canary should be randomized at program startup.  */
 #undef ENABLE_STACKGUARD_RANDOMIZE
 
+/* Define if lock elision should be enabled by default.  */
+#undef ENABLE_LOCK_ELISION
+
 /* Package description.  */
 #undef PKGVERSION
 
diff --git a/configure b/configure
index edde31032c..a873b20617 100755
--- a/configure
+++ b/configure
@@ -742,6 +742,7 @@ enable_versioning
 enable_oldest_abi
 enable_hardcoded_path_in_tests
 enable_stackguard_randomization
+enable_lock_elision
 enable_add_ons
 enable_hidden_plt
 enable_bind_now
@@ -1399,6 +1400,9 @@ Optional Features:
   --enable-stackguard-randomization
                           initialize __stack_chk_guard canary with a random
                           number at program start
+  --enable-lock-elision=yes/no
+                          Enable lock elision for pthread mutexes and rwlocks
+                          by default
   --enable-add-ons[=DIRS...]
                           configure and build add-ons in DIR1,DIR2,... search
                           for add-ons if no parameter given
@@ -3472,6 +3476,18 @@ if test "$enable_stackguard_randomize" = yes; then
 
 fi
 
+# Check whether --enable-lock-elision was given.
+if test "${enable_lock_elision+set}" = set; then :
+  enableval=$enable_lock_elision; enable_lock_elision=$enableval
+else
+  enable_lock_elision=no
+fi
+
+if test "$enable_lock_elision" = yes ; then
+  $as_echo "#define ENABLE_LOCK_ELISION 1" >>confdefs.h
+
+fi
+
 # Check whether --enable-add-ons was given.
 if test "${enable_add_ons+set}" = set; then :
   enableval=$enable_add_ons;
diff --git a/configure.in b/configure.in
index cc065dbfab..cf118f8ffa 100644
--- a/configure.in
+++ b/configure.in
@@ -184,6 +184,15 @@ if test "$enable_stackguard_randomize" = yes; then
   AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
 fi
 
+AC_ARG_ENABLE([lock-elision],
+	      AC_HELP_STRING([--enable-lock-elision[=yes/no]],
+			     [Enable lock elision for pthread mutexes and rwlocks by default]),
+	      [enable_lock_elision=$enableval],
+	      [enable_lock_elision=no])
+if test "$enable_lock_elision" = yes ; then
+  AC_DEFINE(ENABLE_LOCK_ELISION)
+fi
+
 dnl Generic infrastructure for drop-in additions to libc.
 AC_ARG_ENABLE([add-ons],
 	      AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
diff --git a/manual/install.texi b/manual/install.texi
index 96d3bef00d..0c05f51bbb 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -160,6 +160,9 @@ By default, dynamic tests are linked to run with the installed C library.
 This option hardcodes the newly built C library path in dynamic tests
 so that they can be invoked directly.
 
+@item --enable-lock-elision=yes
+Enable lock elision for pthread mutexes by default.
+
 @item --build=@var{build-system}
 @itemx --host=@var{host-system}
 These options are for cross-compiling.  If you specify both options and
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index d32046ee65..46cf30849f 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-02  Andi Kleen <ak@linux.intel.com>
+
+	* sysdeps/unix/sysv/linux/x86/elision-conf.c (elision_init):
+	  Check ENABLE_LOCK_ELISION.
+
 2013-07-02  Andi Kleen  <ak@linux.intel.com>
 
 	* pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
index 6277e48d76..118cfa72f5 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
+++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>. */
 
+#include "config.h"
 #include <pthreadP.h>
 #include <init-arch.h>
 #include <elision-conf.h>
@@ -70,8 +71,10 @@ elision_init (int argc __attribute__ ((unused)),
 	      char **environ)
 {
   __elision_available = HAS_RTM;
+#ifdef ENABLE_LOCK_ELISION
   __pthread_force_elision = __libc_enable_secure ? 0 : __elision_available;
   __rwlock_rtm_enabled = __libc_enable_secure ? 0 : __elision_available;
+#endif
 }
 
 #ifdef SHARED