This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Disable all lock elision unless --enable-lock-elision=yes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]