From 4b45943a6f62cfc239e79ad8902f5c7f71fd13ec Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 7 Nov 2014 12:30:56 -0500 Subject: powerpc: Add adaptive elision to rwlocks This patch adds support for lock elision using ISA 2.07 hardware transactional memory for rwlocks. The logic is similar to the one presented in pthread_mutex lock elision. --- sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h | 8 +++++--- sysdeps/unix/sysv/linux/powerpc/elision-conf.c | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h index 0f971cd..7cbdb2c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h @@ -172,11 +172,13 @@ typedef union unsigned int __nr_writers_queued; int __writer; int __shared; - unsigned long int __pad1; + unsigned char __rwelision; + unsigned char __pad1[7]; unsigned long int __pad2; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned int __flags; +# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 } } __data; # else struct @@ -187,20 +189,20 @@ typedef union unsigned int __writer_wakeup; unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; - unsigned char __pad1; + unsigned char __rwelision; unsigned char __pad2; unsigned char __shared; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned char __flags; int __writer; +#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 } __data; # endif char __size[__SIZEOF_PTHREAD_RWLOCK_T]; long int __align; } pthread_rwlock_t; -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 typedef union { diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c index 1d962e1..70fbbb2 100644 --- a/sysdeps/unix/sysv/linux/powerpc/elision-conf.c +++ b/sysdeps/unix/sysv/linux/powerpc/elision-conf.c @@ -63,6 +63,9 @@ elision_init (int argc __attribute__ ((unused)), int elision_available = (GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_HTM) ? 1 : 0; __pthread_force_elision = __libc_enable_secure ? 0 : elision_available; #endif + if (!__pthread_force_elision) + /* Disable elision on rwlocks. */ + __elision_aconf.try_tbegin = 0; } #ifdef SHARED -- cgit v1.1