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] powerpc: Only enable TLE with PPC_FEATURE2_HTM_NOSC


Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h
> index f88fed5..8db970d 100644
> --- a/sysdeps/powerpc/nptl/tls.h
> +++ b/sysdeps/powerpc/nptl/tls.h
> @@ -67,8 +67,7 @@ typedef struct
>    uint32_t padding;
>    uint32_t at_platform;
>  #endif
> -  /* Indicate if HTM capable (ISA 2.07).  */
> -  uint32_t tm_capable;
> +  uint32_t __unused1;

Is the TCB part of the library ABI?

> diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
> index 906882a..508b917 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
> +++ b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
> @@ -127,6 +127,30 @@ elision_init (int argc __attribute__ ((unused)),
>  	       TUNABLE_CALLBACK (set_elision_skip_trylock_internal_abort));
>  #endif
>  
> +  /* Linux from 3.9 through 4.2 does not abort HTM transaction on syscalls,
> +     instead it suspend and resume it when leaving the kernel.  The
> +     side-effects of the syscall will always remain visible, even if the
> +     transaction is aborted.  This is an issue when transaction is used along
> +     with futex syscall, on pthread_cond_wait for instance, where the futex
> +     call might succeed but the transaction is rolled back leading the
> +     pthread_cond object in an inconsistent state.
> +
> +     GLIBC used to prevent it by always aborting a transaction before issuing
> +     a syscall.  Linux 4.2 also decided to abort active transaction in
> +     syscalls which makes the GLIBC workaround superflours.  Worse, GLIBC
> +     transaction abortion leads to a performance issue on recent kernels
> +     where the HTM state is saved/restore lazily.  By aborting a transaction
> +     on every syscalls, regardless whether a transaction has being initiated
> +     before, glibc make the kernel always save/restore HTM state (it can not
> +     even lazily disable it after a certain number of syscall iterations).
> +
> +     Because of this shortcoming, Lock Elision is just enabled when it has
> +     been explictly set (either by tunables of by a configure switch) and if
> +     kernel aborts HTM transactions on syscalls (PPC_FEATURE2_HTM_NOSC)  */
> +
> +  __pthread_force_elision = __pthread_force_elision &&
> +			    GLRO (dl_hwcap2) & PPC_FEATURE2_HTM_NOSC;

In other words: this patch is requiring Linux 4.3 for TLE.

Can't ABORT_TRANSACTION check for PPC_FEATURE2_HTM_NOSC in tcbhead_t.hwcap and
continue to support older Linux versions?

-- 
Tulio Magno


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