Source-Changes-HG archive

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

[src/trunk]: src/libexec/ld.elf_so rtld: Convert membar_exit/enter to membar_...



details:   https://anonhg.NetBSD.org/src/rev/f3923dd32c2a
branches:  trunk
changeset: 365152:f3923dd32c2a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 09 23:39:07 2022 +0000

description:
rtld: Convert membar_exit/enter to membar_release/acquire.

These are basic CAS-based locking primitives needing release and
acquire semantics, nothing fancy here -- except the membar_sync parts
which are questionable but not relevant to the present audit.

diffstat:

 libexec/ld.elf_so/rtld.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r d7b4fae333f7 -r f3923dd32c2a libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Sat Apr 09 23:38:57 2022 +0000
+++ b/libexec/ld.elf_so/rtld.c  Sat Apr 09 23:39:07 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.210 2021/12/04 14:39:08 skrll Exp $  */
+/*     $NetBSD: rtld.c,v 1.211 2022/04/09 23:39:07 riastradh Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.210 2021/12/04 14:39:08 skrll Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.211 2022/04/09 23:39:07 riastradh Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -1682,7 +1682,7 @@
                        /* Yes, so increment use counter */
                        if (atomic_cas_uint(&_rtld_mutex, cur, cur + 1) != cur)
                                continue;
-                       membar_enter();
+                       membar_acquire();
                        return;
                }
                /*
@@ -1728,7 +1728,7 @@
         * Wakeup LWPs waiting for an exclusive lock if this is the last
         * LWP on the shared lock.
         */
-       membar_exit();
+       membar_release();
        if (atomic_dec_uint_nv(&_rtld_mutex))
                return;
        membar_sync();
@@ -1750,7 +1750,7 @@
 
        for (;;) {
                if (atomic_cas_uint(&_rtld_mutex, 0, locked_value) == 0) {
-                       membar_enter();
+                       membar_acquire();
                        break;
                }
                waiter = atomic_swap_uint(&_rtld_waiter_exclusive, self);
@@ -1774,7 +1774,7 @@
 {
        lwpid_t waiter;
 
-       membar_exit();
+       membar_release();
        _rtld_mutex = 0;
        membar_sync();
        if ((waiter = _rtld_waiter_exclusive) != 0)



Home | Main Index | Thread Index | Old Index