From patchwork Fri Aug 7 14:31:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 8084 X-Patchwork-Delegate: tuliom@linux.vnet.ibm.com Received: (qmail 45578 invoked by alias); 7 Aug 2015 14:31:55 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 45568 invoked by uid 89); 7 Aug 2015 14:31:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: e18.ny.us.ibm.com X-MailFrom: murphyp@linux.vnet.ibm.com X-RcptTo: libc-alpha@sourceware.org Message-ID: <55C4C152.8030506@linux.vnet.ibm.com> Date: Fri, 07 Aug 2015 09:31:46 -0500 From: "Paul E. Murphy" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: libc-alpha@sourceware.org CC: munroesj@linux.vnet.ibm.com, Tulio Magno Quites Machado Filho Subject: [PATCH] powerpc: Fix tabort usage in syscalls X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15080714-0045-0000-0000-000000F77CD4 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-03 Paul E. Murphy * 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. --- sysdeps/powerpc/powerpc32/sysdep.h | 4 ++-- sysdeps/powerpc/powerpc64/sysdep.h | 4 ++-- sysdeps/unix/sysv/linux/powerpc/syscall.S | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) 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 ENTRY (syscall) + ABORT_TRANSACTION mr r0,r3 mr r3,r4 mr r4,r5 -- 1.7.1