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: [PATCH 09/14] Add a configure option to enable lock elision and disable by default


On 06/28/2013 01:51 AM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Can be enabled with --enable-lock-elision=on at configure time.
> 
> When the option is not specified elision can be still enabled
> by setting the environment variables or by the program setting
> elision lock types directly.
> 
> Later the default could be switched to be on by default.

I went through the glibc configure.in and noticed everything
is using yes/no for the enable options so I think we should
change this to follow suit.

This patch looks good and should go in once patch #5, #6 v2,
and #8 are fixed up and OK.

> 2013-06-18  Andi Kleen <ak@linux.intel.com>
> 
> 	* config.h.in (ENABLE_LOCK_ELISION): Add.
> 	* configure: Regenerate.
> 	* configure.in (--enable-lock-elision): Add option.
> 	* manual/install.texi: Document --enable lock elision.
> 	* nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c (elision_init):
> 	  Check ENABLE_LOCK_ELISION.
> ---
>  config.h.in                                     |  3 +++
>  configure                                       | 16 ++++++++++++++++
>  configure.in                                    |  9 +++++++++
>  manual/install.texi                             |  3 +++
>  nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c |  3 +++
>  5 files changed, 34 insertions(+)
> 
> diff --git a/config.h.in b/config.h.in
> index b5c6f16..6284e2a 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -164,6 +164,9 @@
>  /* 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 14bff72..bfc74eb 100755
> --- a/configure
> +++ b/configure

Don't included generated files in ptach.

> diff --git a/configure.in b/configure.in
> index 56cd61c..a779c49 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -184,6 +184,15 @@ if test "$enable_stackguard_randomize" = yes; then
>    AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
>  fi
>  
> +AC_ARG_ENABLE([lock-elision],
> +	      AC_HELP_STRING([--enable-lock-elision[=on/off]],

Make it yes/no to match all the other glibc flags that use yes/no.

> +			     [Enable lock elision for pthread mutexes and rwlocks by default]),
> +	      [enable_lock_elision=$enableval],
> +	      [enable_lock_elision=no])
> +if test "$enable_lock_elision" = yes -o "$enable_lock_elision" = on ; then

Remove "on" check.

> +  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/manual/install.texi b/manual/install.texi
> index 3608a11..3e5358b 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -160,6 +160,9 @@ By default, dynamic tests are linked to run with the installed C library.
>  This option hardcodes the newly built C library path in dynamic tests
>  so that they can be invoked directly.
>  
> +@item --enable-lock-elision
> +Enable lock elision for pthread mutexes and rwlocks by default.
> +
>  @item --build=@var{build-system}
>  @itemx --host=@var{host-system}
>  These options are for cross-compiling.  If you specify both options and
> diff --git a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
> index bb217f3..c0c40e7 100644
> --- a/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
> +++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-conf.c
> @@ -16,6 +16,7 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>. */
>  
> +#include "config.h"
>  #include <pthreadP.h>
>  #include <init-arch.h>
>  #include <elision-conf.h>
> @@ -70,8 +71,10 @@ elision_init (int argc __attribute__ ((unused)),
>  	      char **environ)
>  {
>    __elision_available = HAS_RTM;
> +#ifdef ENABLE_LOCK_ELISION
>    __pthread_force_elision = __libc_enable_secure ? 0 : __elision_available;
>    __rwlock_rtm_enabled = __libc_enable_secure ? 0 : __elision_available;

OK.

> +#endif
>  }
>  
>  #ifdef SHARED

Cheers,
Carlos.


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