about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2015-08-21 14:39:01 -0500
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2015-09-01 09:46:05 -0500
commit0d210b124d0211717c392dab3208fc49b0bb0ed6 (patch)
treee0b594eda2babd4d4563a36351741a29fef4a697
parentd8d584d4c38e8fd5d641937aff7fa2303bbee314 (diff)
downloadglibc-0d210b124d0211717c392dab3208fc49b0bb0ed6.tar.gz
glibc-0d210b124d0211717c392dab3208fc49b0bb0ed6.tar.xz
glibc-0d210b124d0211717c392dab3208fc49b0bb0ed6.zip
powerpc: Fix tabort usage in syscalls
Fix usage of tabort in generated syscalls.  r0 has special meaning
when used with this instruction, thus it will not generate
persistent errors, nor return an error code.  This mitigates poor
CPU usage when performing elided critical sections.

Additionally, transactions should be aborted when entering a user
invoked syscall.  Otherwise the results of the transaction may be
undefined.

2015-08-25  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use
	register other than r0 for tabort, it has special meaning.
	* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise
	* sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort
	transaction before starting syscall.

(cherry picked from commit 18173559a23e28055640b152e623d9f0d40ecca8)
-rw-r--r--ChangeLog8
-rw-r--r--sysdeps/powerpc/powerpc32/sysdep.h4
-rw-r--r--sysdeps/powerpc/powerpc64/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscall.S1
4 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8396a46ccf..a3173c6531 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2015-09-01  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
+	* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use
+	register other than r0 for tabort, it has special meaning.
+	* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise
+	* sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort
+	transaction before starting syscall.
+
+2015-09-01  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
 	* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
 	(__arch_compare_and_exchange_val_32_acq): Remove and use common
 	definition.  ISA 2.07B no longer requires full sync.
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index c4b3ca8696..261ca5f86b 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -95,8 +95,8 @@ GOT_LABEL:			;					      \
     lwz      0,TM_CAPABLE(2);	\
     cmpwi    0,0;		\
     beq	     1f;		\
-    li	     0,_ABORT_SYSCALL;	\
-    tabort.  0;			\
+    li       11,_ABORT_SYSCALL;	\
+    tabort.  11;		\
     .align 4;			\
 1:
 #else
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index 78722c6873..1636899c1a 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -290,8 +290,8 @@ LT_LABELSUFFIX(name,_name_end): ; \
     lwz      0,TM_CAPABLE(13);	\
     cmpwi    0,0;		\
     beq	     1f;		\
-    li	     0,_ABORT_SYSCALL;	\
-    tabort.  0;			\
+    li       11,_ABORT_SYSCALL;	\
+    tabort.  11;		\
     .align 4;                   \
 1:
 #else
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S
index 346e962240..d78eee76f1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/syscall.S
+++ b/sysdeps/unix/sysv/linux/powerpc/syscall.S
@@ -18,6 +18,7 @@
 #include <sysdep.h>
 
 ENTRY (syscall)
+	ABORT_TRANSACTION
 	mr   r0,r3
 	mr   r3,r4
 	mr   r4,r5