]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: More elision improvements
authorPaul Murphy <murphyp@linux.vnet.ibm.com>
Wed, 28 Oct 2015 22:34:31 +0000 (17:34 -0500)
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Mon, 22 Feb 2016 20:04:36 +0000 (17:04 -0300)
__lll_trylock_elision sets the adapt_count variable too
aggressively, and incorrectly on persistent aborts.  Taking
a cue from s390, adapt_count is only updated if the lock
is locked, or a persistent failure occurs.

In addition, the abort codes have been renumbered and
refactored for clarity.  As it stands, glibc only cares
if the abort is persistent or not.

All aborts are now persistent, excepting a busy lock.  This
includes changing _ABORT_NESTED_TRYLOCK into a persistent
abort.

* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
(__lll_trylock_elision): Fix setting of adapt_count.
* sysdeps/unix/sysv/linux/powerpc/htm.h
(_ABORT_PERSISTENT): Define to clarify persistent aborts.
(_ABORT_NESTED_TRYLOCK): Renumber, and make persistent.
(_ABORT_SYSCALL): Renumber, and clarify definition.
(_ABORT_LOCK_BUSY): Renumber, make non-persistent.

(cherry picked from commit 86b4939846caf2bb072bba6057e1dc3ad187c2c2)

Conflicts:
sysdeps/unix/sysv/linux/powerpc/elision-trylock.c

ChangeLog
sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
sysdeps/unix/sysv/linux/powerpc/htm.h

index d960bc264e559c0ced1a9ac300512d0d9ed37ed0..e2a9a4a9587dffc5db7ad82b4a5eff10f490874d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-02-22  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
+       * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
+       (__lll_trylock_elision): Fix setting of adapt_count.
+       * sysdeps/unix/sysv/linux/powerpc/htm.h
+       (_ABORT_PERSISTENT): Define to clarify persistent aborts.
+       (_ABORT_NESTED_TRYLOCK): Renumber, and make persistent.
+       (_ABORT_SYSCALL): Renumber, and clarify definition.
+       (_ABORT_LOCK_BUSY): Renumber, make non-persistent.
+
 2016-02-22  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
        * sysdeps/unix/sysv/linux/powerpc/htm.h (__libc_tbegin): Remove
index edec155058d1b43e60fc6737f57ca8734f2962b4..5995e77ad6cad8706a543d59019f7fcadc96cf7d 100644 (file)
@@ -45,8 +45,12 @@ __lll_trylock_elision (int *futex, short *adapt_count)
       if (*futex == 0)
        return 0;
 
-      /* Lock was busy.  Fall back to normal locking.  */
-      __libc_tabort (_ABORT_LOCK_BUSY);
+      /* Lock was busy.  This is never a nested transaction.
+         End it, and set the adapt count.  */
+      __libc_tend (0);
+
+      if (aconf.skip_lock_busy > 0)
+       *adapt_count = aconf.skip_lock_busy;
     }
   else
     {
@@ -58,9 +62,6 @@ __lll_trylock_elision (int *futex, short *adapt_count)
          if (aconf.skip_trylock_internal_abort > 0)
            *adapt_count = aconf.skip_trylock_internal_abort;
        }
-
-       if (aconf.skip_lock_busy > 0)
-         *adapt_count = aconf.skip_lock_busy;
     }
 
 use_lock:
index 7b4981771099a213edf89c77954cc1650b8f2f6a..75c99c236be4e283ac727c613c09dde6eba81a71 100644 (file)
 
 #endif /* __ASSEMBLER__ */
 
-/* Definitions used for TEXASR Failure code (bits 0:6), they need to be even
-   because tabort. always sets the first bit.  */
-#define _ABORT_LOCK_BUSY       0x3f   /* Lock already used.  */
-#define _ABORT_NESTED_TRYLOCK  0x3e   /* Write operation in trylock.  */
-#define _ABORT_SYSCALL         0x3d   /* Syscall issued.  */
+/* Definitions used for TEXASR Failure code (bits 0:7).  If the failure
+   should be persistent, the abort code must be odd.  0xd0 through 0xff
+   are reserved for the kernel and potential hypervisor.  */
+#define _ABORT_PERSISTENT      0x01   /* An unspecified persistent abort.  */
+#define _ABORT_LOCK_BUSY       0x34   /* Busy lock, not persistent.  */
+#define _ABORT_NESTED_TRYLOCK  (0x32 | _ABORT_PERSISTENT)
+#define _ABORT_SYSCALL         (0x30 | _ABORT_PERSISTENT)
 
 #endif