Skip to content

Commit

Permalink
powerpc: Fix tabort usage in syscalls
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Paul E. Murphy authored and Tulio Magno Quites Machado Filho committed Aug 25, 2015
1 parent fe7faec commit 1817355
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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.

2015-08-25 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>

* sysdeps/powerpc/powerpc64/power7/strstr.S: Handle worst case.
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/powerpc/powerpc32/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/powerpc/powerpc64/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,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
Expand Down
1 change: 1 addition & 0 deletions sysdeps/unix/sysv/linux/powerpc/syscall.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <sysdep.h>

ENTRY (syscall)
ABORT_TRANSACTION
mr r0,r3
mr r3,r4
mr r4,r5
Expand Down

0 comments on commit 1817355

Please sign in to comment.