public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: libc-stable@sourceware.org
Cc: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
Subject: [COMMITTED 2.22] powerpc: Fix tabort usage in syscalls
Date: Fri, 01 Jan 2016 00:00:00 -0000	[thread overview]
Message-ID: <1460151342-19736-1-git-send-email-aurelien@aurel32.net> (raw)

From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>

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)
---
 ChangeLog                                 | 8 ++++++++
 sysdeps/powerpc/powerpc32/sysdep.h        | 4 ++--
 sysdeps/powerpc/powerpc64/sysdep.h        | 4 ++--
 sysdeps/unix/sysv/linux/powerpc/syscall.S | 1 +
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6c8f1ad..0b6deab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
+
 2016-04-04  Stefan Liebler  <stli@linux.vnet.ibm.com>
 
 	* sysdeps/s390/bits/link.h: (La_s390_vr) New typedef.
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index e16fe3e..ecb492a 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 bf2a884..a9d37ad 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -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
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S
index 157e3e3..4477303 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
-- 
2.8.0.rc3

                 reply	other threads:[~2016-04-08 21:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460151342-19736-1-git-send-email-aurelien@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=libc-stable@sourceware.org \
    --cc=murphyp@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).