Disable all lock elision unless --enable-lock-elision=yes
Carlos O'Donell
carlos@redhat.com
Sat Sep 27 04:41:00 GMT 2014
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.
More information about the Libc-alpha
mailing list