This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Disable all lock elision unless --enable-lock-elision=yes
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andi Kleen <andi at firstfloor dot org>, GNU C Library <libc-alpha at sourceware dot org>, Siddhesh Poyarekar <siddhesh at redhat dot com>
- Date: Sat, 27 Sep 2014 00:40:28 -0400
- Subject: Disable all lock elision unless --enable-lock-elision=yes
- Authentication-results: sourceware.org; auth=none
Andi.
The rwlock elision support you added in 2014-06-13
appears to unconditionally enable elision for rwlock's
if the RTM-bit indicates TSX is present. That isn't what
we do for mutexes, and isn't very conservative in that
case.
Did I read the code right?
If I did, could we please put rwlock TSX usage under
the control of the --enable-lock-elision flag? I need
to easily disable TSX for all of glibc, until we can
get early microcode updates worked out, and I had to
hack things up because --enable-lock-elision no longer
controls all of the elision uses in glibc.
For example the following WIP patch does what I'm thinking.
Cheers,
Carlos.
diff -urN glibc-2.20.mod/sysdeps/unix/sysv/linux/x86/elision-conf.c glibc-2.20/sysdeps/unix/sysv/linux/x86/elision-conf.c
--- glibc-2.20.mod/sysdeps/unix/sysv/linux/x86/elision-conf.c 2014-09-27 00:25:46.443462345 -0400
+++ glibc-2.20/sysdeps/unix/sysv/linux/x86/elision-conf.c 2014-09-27 00:29:53.586615813 -0400
@@ -62,12 +62,16 @@
char **argv __attribute__ ((unused)),
char **environ)
{
- __elision_available = HAS_RTM;
#ifdef ENABLE_LOCK_ELISION
+ __elision_available = HAS_RTM;
__pthread_force_elision = __libc_enable_secure ? 0 : __elision_available;
-#endif
if (!HAS_RTM)
__elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks */
+#else
+ __elision_available = 0;
+ __pthread_force_elision = 0;
+ __elision_aconf.retry_try_xbegin = 0;
+#endif
}
#ifdef SHARED
---
I should probably patch configure.ac to change the description
of the enable option to talk about all locks.
Cheers,
Carlos.