This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Disable all lock elision unless --enable-lock-elision=yes
- From: Andi Kleen <andi at firstfloor dot org>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: 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 20:10:01 +0200
- Subject: Re: Disable all lock elision unless --enable-lock-elision=yes
- Authentication-results: sourceware.org; auth=none
- References: <54263FBC dot 5050200 at redhat dot com>
Hi Carlos,
On Sat, Sep 27, 2014 at 12:40:28AM -0400, Carlos O'Donell wrote:
> 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?
You're right. It should have been disabled in this case.
Patch looks good to me.
-Andi
>
> 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