Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd drm: Eliminate __HAVE_ATOMIC_AS_MEMBAR cond...



details:   https://anonhg.NetBSD.org/src/rev/73f353e1c9bc
branches:  trunk
changeset: 373678:73f353e1c9bc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Feb 24 11:02:05 2023 +0000

description:
drm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html

diffstat:

 sys/external/bsd/common/include/asm/barrier.h |  14 +++++---------
 sys/external/bsd/common/linux/linux_tasklet.c |  16 ++--------------
 sys/external/bsd/drm2/include/linux/kref.h    |  14 +-------------
 3 files changed, 8 insertions(+), 36 deletions(-)

diffs (179 lines):

diff -r b249a07fcd6e -r 73f353e1c9bc sys/external/bsd/common/include/asm/barrier.h
--- a/sys/external/bsd/common/include/asm/barrier.h     Fri Feb 24 11:01:43 2023 +0000
+++ b/sys/external/bsd/common/include/asm/barrier.h     Fri Feb 24 11:02:05 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: barrier.h,v 1.19 2022/07/19 21:30:40 riastradh Exp $   */
+/*     $NetBSD: barrier.h,v 1.20 2023/02/24 11:02:05 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -100,18 +100,14 @@
 #  define      smp_mb                          membar_sync
 #  define      smp_wmb                         membar_producer
 #  define      smp_rmb                         membar_consumer
+#  define      smp_mb__before_atomic           membar_release
+#  define      smp_mb__after_atomic            membar_acquire
 #else
 #  define      smp_mb()                        __insn_barrier()
 #  define      smp_wmb()                       __insn_barrier()
 #  define      smp_rmb()                       __insn_barrier()
-#endif
-
-#if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR)
-#  define      smp_mb__before_atomic()         membar_release()
-#  define      smp_mb__after_atomic()          membar_acquire()
-#else
-#  define      smp_mb__before_atomic()         __insn_barrier()
-#  define      smp_mb__after_atomic()          __insn_barrier()
+#  define      smp_mb__before_atomic           __nothing
+#  define      smp_mb__after_atomic            __nothing
 #endif
 
 #endif  /* _ASM_BARRIER_H_ */
diff -r b249a07fcd6e -r 73f353e1c9bc sys/external/bsd/common/linux/linux_tasklet.c
--- a/sys/external/bsd/common/linux/linux_tasklet.c     Fri Feb 24 11:01:43 2023 +0000
+++ b/sys/external/bsd/common/linux/linux_tasklet.c     Fri Feb 24 11:02:05 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_tasklet.c,v 1.11 2022/04/09 23:43:31 riastradh Exp $     */
+/*     $NetBSD: linux_tasklet.c,v 1.12 2023/02/24 11:02:05 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2018, 2020, 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.11 2022/04/09 23:43:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.12 2023/02/24 11:02:05 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -395,9 +395,7 @@
        KASSERT(disablecount != 0);
 
        /* Pairs with membar_release in __tasklet_enable.  */
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_acquire();
-#endif
 }
 
 /*
@@ -515,9 +513,7 @@
                state | TASKLET_RUNNING) != state);
 
        /* Pairs with membar_release in tasklet_unlock.  */
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_acquire();
-#endif
 
        return true;
 }
@@ -539,9 +535,7 @@
         * Pairs with membar_acquire in tasklet_trylock and with
         * atomic_load_acquire in tasklet_unlock_wait.
         */
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_release();
-#endif
        atomic_and_uint(&tasklet->tl_state, ~TASKLET_RUNNING);
 }
 
@@ -590,9 +584,7 @@
        KASSERT(disablecount != 0);
 
        /* Pairs with membar_release in __tasklet_enable_sync_once.  */
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_acquire();
-#endif
 
        /*
         * If it was zero, wait for it to finish running.  If it was
@@ -614,9 +606,7 @@
        unsigned int disablecount;
 
        /* Pairs with membar_acquire in __tasklet_disable_sync_once.  */
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_release();
-#endif
 
        /* Decrement the disable count.  */
        disablecount = atomic_dec_uint_nv(&tasklet->tl_disablecount);
@@ -683,9 +673,7 @@
         * Pairs with atomic_load_acquire in tasklet_softintr and with
         * membar_acquire in tasklet_disable.
         */
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_release();
-#endif
 
        /* Decrement the disable count.  */
        disablecount = atomic_dec_uint_nv(&tasklet->tl_disablecount);
diff -r b249a07fcd6e -r 73f353e1c9bc sys/external/bsd/drm2/include/linux/kref.h
--- a/sys/external/bsd/drm2/include/linux/kref.h        Fri Feb 24 11:01:43 2023 +0000
+++ b/sys/external/bsd/drm2/include/linux/kref.h        Fri Feb 24 11:02:05 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kref.h,v 1.13 2022/04/09 23:43:39 riastradh Exp $      */
+/*     $NetBSD: kref.h,v 1.14 2023/02/24 11:02:06 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -80,9 +80,7 @@
 {
        unsigned int old, new;
 
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_release();
-#endif
 
        do {
                old = atomic_load_relaxed(&kref->kr_count);
@@ -92,9 +90,7 @@
        } while (atomic_cas_uint(&kref->kr_count, old, new) != old);
 
        if (new == 0) {
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
                membar_acquire();
-#endif
                (*release)(kref);
                return 1;
        }
@@ -108,9 +104,7 @@
 {
        unsigned int old, new;
 
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_release();
-#endif
 
        do {
                old = atomic_load_relaxed(&kref->kr_count);
@@ -118,9 +112,7 @@
                if (old == 1) {
                        spin_lock(interlock);
                        if (atomic_add_int_nv(&kref->kr_count, -1) == 0) {
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
                                membar_acquire();
-#endif
                                (*release)(kref);
                                return 1;
                        }
@@ -146,9 +138,7 @@
 {
        unsigned int old, new;
 
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
        membar_release();
-#endif
 
        do {
                old = atomic_load_relaxed(&kref->kr_count);
@@ -156,9 +146,7 @@
                if (old == 1) {
                        mutex_lock(interlock);
                        if (atomic_add_int_nv(&kref->kr_count, -1) == 0) {
-#ifndef __HAVE_ATOMIC_AS_MEMBAR
                                membar_acquire();
-#endif
                                (*release)(kref);
                                return 1;
                        }



Home | Main Index | Thread Index | Old Index