Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 Use load-acquire exclusive and stor...



details:   https://anonhg.NetBSD.org/src/rev/20d972904e21
branches:  trunk
changeset: 940677:20d972904e21
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Oct 13 21:27:18 2020 +0000

description:
Use load-acquire exclusive and store-release exclusive (and remove the
barrier instructions) as suggested by riastradh a little while ago.

diffstat:

 sys/arch/aarch64/aarch64/lock_stubs.S |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 4f7ad4e5cff5 -r 20d972904e21 sys/arch/aarch64/aarch64/lock_stubs.S
--- a/sys/arch/aarch64/aarch64/lock_stubs.S     Tue Oct 13 21:24:22 2020 +0000
+++ b/sys/arch/aarch64/aarch64/lock_stubs.S     Tue Oct 13 21:27:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock_stubs.S,v 1.2 2020/08/13 07:14:04 skrll Exp $     */
+/*     $NetBSD: lock_stubs.S,v 1.3 2020/10/13 21:27:18 skrll Exp $     */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include "assym.h"
 
-RCSID("$NetBSD: lock_stubs.S,v 1.2 2020/08/13 07:14:04 skrll Exp $")
+RCSID("$NetBSD: lock_stubs.S,v 1.3 2020/10/13 21:27:18 skrll Exp $")
 
 #ifndef LOCKDEBUG
 /*
@@ -45,11 +45,10 @@
 ENTRY(mutex_enter)
        mrs     x1, tpidr_el1           /* x1 = curlwp */
 1:
-       ldxr    x2, [x0]                /* load old value */
+       ldaxr   x2, [x0]                /* load old value */
        cbnz    x2, 3f                  /*   equals zero? */
        stxr    w3, x1, [x0]            /* store curlwp as new value */
        cbnz    w3, 2f                  /*   succeed? nope, try again. */
-       dmb     sy                      /* membar_enter() */
        ret
 2:
        b       1b
@@ -64,13 +63,12 @@
  * so just use ldxr+stxr to achieve the same.
  */
 ENTRY(mutex_exit)
-       dmb     sy                      /* membar_exit() */
        mrs     x1, tpidr_el1           /* x1 = curlwp */
 1:
        ldxr    x2, [x0]                /* load old value */
        cmp     x1, x2                  /*   equals curlwp? */
        b.ne    3f                      /*     slow path if different */
-       stxr    w3, xzr, [x0]           /* store zero as new value */
+       stlxr   w3, xzr, [x0]           /* store zero as new value */
        cbnz    w3, 2f                  /*   succeed? nope, try again. */
        ret
 2:



Home | Main Index | Thread Index | Old Index