This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 5/6] Do not use explicit abort code definitions.


Using explicit abort code definitions is problematic because they are thrown at
the creator of the outermost transaction who may misinterpret the user
specified abort code because he does not know where it comes from.

The lock elision implementation should refrain from using explicit abort code
definitions and rather only interpret the flags of the abort code (as should
other pieces of software that have abort handlers).

On s390, the lowest bit of the explicit abort code specifies whether the abort
is temporary or persistent.  With TSX, bit 1 of eax is used as the retry bit;
if it's set, a retry may be worthwhile.  Is there a way to specify this bit in
the XABORT instruction?  I cannot find anything in the Haswell documentation
and simply assumed that the retry bit is never set when the user abort code 0
is used.  This assumption may be wrong.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany
>From 0b014b843d87dc2eedaa0cc86e40898a4ec2f53b Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@de.ibm.com>
Date: Mon, 2 Sep 2013 07:29:35 +0000
Subject: [PATCH 5/7] x86: Do not use explicit abort code definitions.

Just use a zero as the explicit abort code and not define any constants that
might be misinterpreted by the creator of the outermost transaction.
Rationale: Lacking an ABI for the use of explicit abort codes, we should not
try to determine code flow by the abort code or interpret the explicit abort
code.  We should rather only interpret the flags in the abort code that are set
automatically.
---
 nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c | 2 +-
 nptl/sysdeps/unix/sysv/linux/x86/hle.h             | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c b/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c
index 0b9c686..40d0726 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c
+++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-trylock.c
@@ -34,7 +34,7 @@ __lll_trylock_elision (int *futex, short *adapt_count)
      trylock.  Sorry.  After the abort the code is re-executed
      non transactional and if the lock was already locked
      return an error.  */
-  _xabort (_ABORT_NESTED_TRYLOCK);
+  _xabort (0);
 
   /* Only try a transaction if it's worth it.  */
   if (*adapt_count == 0)
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/hle.h b/nptl/sysdeps/unix/sysv/linux/x86/hle.h
index 4a7b9e3..84ed3eb 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86/hle.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86/hle.h
@@ -39,10 +39,6 @@
 #define _XABORT_NESTED		(1 << 5)
 #define _XABORT_CODE(x)		(((x) >> 24) & 0xff)
 
-#define _ABORT_LOCK_BUSY 	0xff
-#define _ABORT_LOCK_IS_LOCKED	0xfe
-#define _ABORT_NESTED_TRYLOCK	0xfd
-
 #ifndef __ASSEMBLER__
 
 #define __force_inline __attribute__((__always_inline__)) inline
-- 
1.7.11.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]