Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1250771 Details for
Bug 1383986
Fedora - Enable lock elision through an environment variable on Fedora for Linux on z Systems (glibc)
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
elision-upstream-wip.diff
elision-upstream-wip.diff (text/plain), 10.24 KB, created by
Carlos O'Donell
on 2017-02-16 03:18:55 UTC
(
hide
)
Description:
elision-upstream-wip.diff
Filename:
MIME Type:
Creator:
Carlos O'Donell
Created:
2017-02-16 03:18:55 UTC
Size:
10.24 KB
patch
obsolete
>diff --git a/config.h.in b/config.h.in >index 7bfe923..a4d0d95 100644 >--- a/config.h.in >+++ b/config.h.in >@@ -153,9 +153,6 @@ > /* 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 eecd0ac..7fc2269 100755 >--- a/configure >+++ b/configure >@@ -676,7 +676,6 @@ enable_werror > all_warnings > force_install > bindnow >-enable_lock_elision > hardcoded_path_in_tests > enable_timezone_tools > use_default_link >@@ -765,7 +764,6 @@ enable_profile > enable_timezone_tools > enable_hardcoded_path_in_tests > enable_stackguard_randomization >-enable_lock_elision > enable_add_ons > enable_hidden_plt > enable_bind_now >@@ -1425,8 +1423,6 @@ 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 by default > --enable-add-ons[=DIRS...] > configure and build add-ons in DIR1,DIR2,... search > for add-ons if no parameter given >@@ -3391,19 +3387,6 @@ 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.ac b/configure.ac >index 4a77411..e8e7a20 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -199,16 +199,6 @@ 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 by default]), >- [enable_lock_elision=$enableval], >- [enable_lock_elision=no]) >-AC_SUBST(enable_lock_elision) >-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/elf/dl-tunables.h b/elf/dl-tunables.h >index f33adfb..3dad518 100644 >--- a/elf/dl-tunables.h >+++ b/elf/dl-tunables.h >@@ -18,8 +18,8 @@ > License along with the GNU C Library; if not, see > <http://www.gnu.org/licenses/>. */ > >-#ifndef _TUNABLES_H_ >-#define _TUNABLES_H_ >+#ifndef _DL_TUNABLES_H_ >+#define _DL_TUNABLES_H_ > > #if !HAVE_TUNABLES > static inline void >diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list >index cb9e8f1..32efcc7 100644 >--- a/elf/dl-tunables.list >+++ b/elf/dl-tunables.list >@@ -77,4 +77,12 @@ glibc { > security_level: SXID_IGNORE > } > } >+ elision { >+ enable { >+ type: INT_32 >+ minval: 0 >+ maxval: 1 >+ is_secure: false >+ } >+ } > } >diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c >index dc9ca4c..99e002a 100644 >--- a/nptl/pthread_mutex_lock.c >+++ b/nptl/pthread_mutex_lock.c >@@ -80,7 +80,6 @@ __pthread_mutex_lock (pthread_mutex_t *mutex) > LLL_MUTEX_LOCK (mutex); > assert (mutex->__data.__owner == 0); > } >-#ifdef HAVE_ELISION > else if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_ELISION_NP)) > { > elision: __attribute__((unused)) >@@ -91,7 +90,6 @@ __pthread_mutex_lock (pthread_mutex_t *mutex) > tail call. */ > return LLL_MUTEX_LOCK_ELISION (mutex); > } >-#endif > else if (__builtin_expect (PTHREAD_MUTEX_TYPE (mutex) > == PTHREAD_MUTEX_RECURSIVE_NP, 1)) > { >diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk >index e7bfc22..5893bb1 100644 >--- a/scripts/gen-tunables.awk >+++ b/scripts/gen-tunables.awk >@@ -122,9 +122,9 @@ END { > } > > print "/* AUTOGENERATED by gen-tunables.awk. */" >- print "#ifndef _TUNABLES_H_" >+ print "#ifndef _DL_TUNABLES_H_" > print "# error \"Do not include this file directly.\"" >- print "# error \"Include tunables.h instead.\"" >+ print "# error \"Include dl-tunables.h instead.\"" > print "#endif" > > # Now, the enum names >diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c >index f631f0a..92b03a7 100644 >--- a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c >+++ b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c >@@ -54,18 +54,47 @@ int __pthread_force_elision attribute_hidden; > > /* Initialize elision. */ > >+static inline void >+do_set_elision_enable (bool elision_enable) >+{ >+ /* If elision is not enabled, or we are in a secure mode, >+ make sure elision is never used... */ >+ if (!elision_enable || __libc_enable_secure) >+ { >+ __pthread_force_elision = 0; >+ return; >+ } >+ >+ /* ... otherwise enable elision based on hardare availability. */ >+ __pthread_force_elision = (GLRO (dl_hwcap2) >+ & PPC_FEATURE2_HAS_HTM) ? 1 : 0; >+} >+ >+#if HAVE_TUNABLES >+/* The elision->enable tunable is either 0 or 1 to indicate that >+ elision should be disabled or enabled respectively. Availability at >+ the hardware level will still dictate if the feature is used. */ >+void >+DL_TUNABLE_CALLBACK (set_elision_enable) (void *elision_enable) >+{ >+ int32_t elision_enable = *(int32_t *) valp; >+ do_set_elision_enable (elision_enable ? true : false); >+} >+#endif >+ > static void > elision_init (int argc __attribute__ ((unused)), > char **argv __attribute__ ((unused)), > char **environ) > { >-#ifdef ENABLE_LOCK_ELISION >- int elision_available = (GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_HTM) ? 1 : 0; >- __pthread_force_elision = __libc_enable_secure ? 0 : elision_available; >+#if HAVE_TUNABLES >+ /* Elision depends on tunables to enable and tune elision at runtime. */ >+# define TUNABLE_NAMESPACE elision >+ TUNABLE_SET_VAL_WITH_CALLBACK (enable, NULL, set_elision_enable); >+#else >+ /* Disable elision when built without tunables. */ >+ do_set_elision_enable (false); > #endif >- if (!__pthread_force_elision) >- /* Disable elision on rwlocks. */ >- __elision_aconf.try_tbegin = 0; > } > > #ifdef SHARED >diff --git a/sysdeps/unix/sysv/linux/s390/elision-conf.c b/sysdeps/unix/sysv/linux/s390/elision-conf.c >index cc0fdef..ee315ba 100644 >--- a/sysdeps/unix/sysv/linux/s390/elision-conf.c >+++ b/sysdeps/unix/sysv/linux/s390/elision-conf.c >@@ -55,16 +55,46 @@ int __pthread_force_elision attribute_hidden = 0; > > /* Initialize elison. */ > >+static inline void >+do_set_elision_enable (bool elision_enable) >+{ >+ /* If elision is not enabled, or we are in a secure mode, >+ make sure elision is never used... */ >+ if (!elision_enable || __libc_enable_secure) >+ { >+ __pthread_force_elision = 0; >+ return; >+ } >+ >+ /* ... otherwise enable elision based on hardare availability. */ >+ __pthread_force_elision = (GLRO (dl_hwcap) & HWCAP_S390_TE) ? 1 : 0; >+} >+ >+#if HAVE_TUNABLES >+/* The elision->enable tunable is either 0 or 1 to indicate that >+ elision should be disabled or enabled respectively. Availability at >+ the hardware level will still dictate if the feature is used. */ >+void >+DL_TUNABLE_CALLBACK (set_elision_enable) (void *elision_enable) >+{ >+ int32_t elision_enable = *(int32_t *) valp; >+ do_set_elision_enable (elision_enable ? true : false); >+} >+#endif >+ > static void > elision_init (int argc __attribute__ ((unused)), > char **argv __attribute__ ((unused)), > char **environ) > { >- /* Set when the CPU and the kernel supports transactional execution. >- When false elision is never attempted. */ >- int elision_available = (GLRO (dl_hwcap) & HWCAP_S390_TE) ? 1 : 0; >- >- __pthread_force_elision = __libc_enable_secure ? 0 : elision_available; >+#if HAVE_TUNABLES >+ /* Elision depends on tunables to enable and tune elision at runtime. */ >+# define TUNABLE_NAMESPACE elision >+ TUNABLE_SET_VAL_WITH_CALLBACK (enable, NULL, set_elision_enable); >+#else >+ /* Disable elision when built without tunables. */ >+ do_set_elision_enable (false); >+#endif > } > > #ifdef SHARED >diff --git a/sysdeps/unix/sysv/linux/x86/elision-conf.c b/sysdeps/unix/sysv/linux/x86/elision-conf.c >index 673b000..b27b971 100644 >--- a/sysdeps/unix/sysv/linux/x86/elision-conf.c >+++ b/sysdeps/unix/sysv/linux/x86/elision-conf.c >@@ -21,6 +21,7 @@ > #include <init-arch.h> > #include <elision-conf.h> > #include <unistd.h> >+#include <elf/dl-tunables.h> > > /* Reasonable initial tuning values, may be revised in the future. > This is a conservative initial value. */ >@@ -52,17 +53,46 @@ int __pthread_force_elision attribute_hidden; > > /* Initialize elison. */ > >+static inline void >+do_set_elision_enable (bool elision_enable) >+{ >+ /* If elision is not enabled, or we are in a secure mode, >+ make sure elision is never used... */ >+ if (!elision_enable || __libc_enable_secure) >+ { >+ __pthread_force_elision = 0; >+ return; >+ } >+ >+ /* ... otherwise enable elision based on hardare availability. */ >+ __pthread_force_elision = HAS_CPU_FEATURE (RTM); >+} >+ >+#if HAVE_TUNABLES >+/* The elision->enable tunable is either 0 or 1 to indicate that >+ elision should be disabled or enabled respectively. Availability at >+ the hardware level will still dictate if the feature is used. */ >+void >+DL_TUNABLE_CALLBACK (set_elision_enable) (void *valp) >+{ >+ int32_t elision_enable = *(int32_t *) valp; >+ do_set_elision_enable (elision_enable ? true : false); >+} >+#endif >+ > static void > elision_init (int argc __attribute__ ((unused)), > char **argv __attribute__ ((unused)), > char **environ) > { >- int elision_available = HAS_CPU_FEATURE (RTM); >-#ifdef ENABLE_LOCK_ELISION >- __pthread_force_elision = __libc_enable_secure ? 0 : elision_available; >+#if HAVE_TUNABLES >+ /* Elision depends on tunables to enable and tune elision at runtime. */ >+# define TUNABLE_NAMESPACE elision >+ TUNABLE_SET_VAL_WITH_CALLBACK (enable, NULL, set_elision_enable); >+#else >+ /* Disable elision when built without tunables. */ >+ do_set_elision_enable (false); > #endif >- if (!elision_available) >- __elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks */ > } > > #ifdef SHARED
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1383986
:
1209526
| 1250771 |
1267814