File powerpc-elision-improvements.patch of Package glibc.i686
2016-02-22 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
(__lll_trylock_elision): Fix setting of adapt_count.
* sysdeps/unix/sysv/linux/powerpc/htm.h
(_ABORT_PERSISTENT): Define to clarify persistent aborts.
(_ABORT_NESTED_TRYLOCK): Renumber, and make persistent.
(_ABORT_SYSCALL): Renumber, and clarify definition.
(_ABORT_LOCK_BUSY): Renumber, make non-persistent.
Index: glibc-2.22/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
+++ glibc-2.22/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
@@ -45,8 +45,12 @@ __lll_trylock_elision (int *futex, short
if (*futex == 0)
return 0;
- /* Lock was busy. Fall back to normal locking. */
- __builtin_tabort (_ABORT_LOCK_BUSY);
+ /* Lock was busy. This is never a nested transaction.
+ End it, and set the adapt count. */
+ __builtin_tend (0);
+
+ if (aconf.skip_lock_busy > 0)
+ *adapt_count = aconf.skip_lock_busy;
}
else
{
@@ -58,9 +62,6 @@ __lll_trylock_elision (int *futex, short
if (aconf.skip_trylock_internal_abort > 0)
*adapt_count = aconf.skip_trylock_internal_abort;
}
-
- if (aconf.skip_lock_busy > 0)
- *adapt_count = aconf.skip_lock_busy;
}
use_lock:
Index: glibc-2.22/sysdeps/unix/sysv/linux/powerpc/htm.h
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/powerpc/htm.h
+++ glibc-2.22/sysdeps/unix/sysv/linux/powerpc/htm.h
@@ -129,10 +129,12 @@
#endif /* __ASSEMBLER__ */
-/* Definitions used for TEXASR Failure code (bits 0:6), they need to be even
- because tabort. always sets the first bit. */
-#define _ABORT_LOCK_BUSY 0x3f /* Lock already used. */
-#define _ABORT_NESTED_TRYLOCK 0x3e /* Write operation in trylock. */
-#define _ABORT_SYSCALL 0x3d /* Syscall issued. */
+/* Definitions used for TEXASR Failure code (bits 0:7). If the failure
+ should be persistent, the abort code must be odd. 0xd0 through 0xff
+ are reserved for the kernel and potential hypervisor. */
+#define _ABORT_PERSISTENT 0x01 /* An unspecified persistent abort. */
+#define _ABORT_LOCK_BUSY 0x34 /* Busy lock, not persistent. */
+#define _ABORT_NESTED_TRYLOCK (0x32 | _ABORT_PERSISTENT)
+#define _ABORT_SYSCALL (0x30 | _ABORT_PERSISTENT)
#endif