Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd Omit __insn_barrier where implied or subsum...



details:   https://anonhg.NetBSD.org/src/rev/e42351a0dc04
branches:  trunk
changeset: 1028063:e42351a0dc04
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:46:01 2021 +0000

description:
Omit __insn_barrier where implied or subsumed by volatile.

diffstat:

 sys/external/bsd/common/include/linux/rcupdate.h |   8 +++-----
 sys/external/bsd/common/linux/linux_srcu.c       |  15 ++++-----------
 sys/external/bsd/common/linux/linux_tasklet.c    |   6 ++----
 sys/external/bsd/drm2/include/linux/atomic.h     |   6 +-----
 sys/external/bsd/drm2/include/linux/kref.h       |   3 +--
 5 files changed, 11 insertions(+), 27 deletions(-)

diffs (176 lines):

diff -r 9922cec1913d -r e42351a0dc04 sys/external/bsd/common/include/linux/rcupdate.h
--- a/sys/external/bsd/common/include/linux/rcupdate.h  Sun Dec 19 01:45:53 2021 +0000
+++ b/sys/external/bsd/common/include/linux/rcupdate.h  Sun Dec 19 01:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcupdate.h,v 1.1 2021/12/19 01:33:17 riastradh Exp $   */
+/*     $NetBSD: rcupdate.h,v 1.2 2021/12/19 01:46:01 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -94,16 +94,14 @@
 rcu_read_lock(void)
 {
 
-       kpreempt_disable();
-       __insn_barrier();
+       kpreempt_disable();     /* implies __insn_barrier */
 }
 
 static inline void
 rcu_read_unlock(void)
 {
 
-       __insn_barrier();
-       kpreempt_enable();
+       kpreempt_enable();      /* implies __insn_barrier */
 }
 
 #define        kfree_rcu(P, F)                                                       \
diff -r 9922cec1913d -r e42351a0dc04 sys/external/bsd/common/linux/linux_srcu.c
--- a/sys/external/bsd/common/linux/linux_srcu.c        Sun Dec 19 01:45:53 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_srcu.c        Sun Dec 19 01:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_srcu.c,v 1.1 2021/12/19 01:37:27 riastradh Exp $ */
+/*     $NetBSD: linux_srcu.c,v 1.2 2021/12/19 01:46:01 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_srcu.c,v 1.1 2021/12/19 01:37:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_srcu.c,v 1.2 2021/12/19 01:46:01 riastradh Exp $");
 
 /*
  * SRCU: Sleepable RCU
@@ -159,20 +159,14 @@
         */
        kpreempt_disable();
        gen = srcu->srcu_gen;
-       /* Fetch the generation once before incrementing the count.  */
-       __insn_barrier();
        srcu_adjust(srcu, gen, +1);
        kpreempt_enable();
 
        /*
-        * Increment the count in our generation before doing anything
-        * else on this CPU.
-        *
         * No stronger, inter-CPU memory barrier is needed: if there is
         * a concurrent synchronize_srcu, it will issue an xcall that
         * functions as a stronger memory barrier.
         */
-       __insn_barrier();
 
        return gen;
 }
@@ -192,14 +186,13 @@
        unsigned gen = ticket;
 
        /*
-        * Make sure all side effects have completed on this CPU before
-        * decrementing the count.
+        * All side effects have completed on this CPU before we
+        * disable kpreemption.
         *
         * No stronger, inter-CPU memory barrier is needed: if there is
         * a concurrent synchronize_srcu, it will issue an xcall that
         * functions as a stronger memory barrier.
         */
-       __insn_barrier();
 
        /*
         * Prevent xcall while we determine whether we need to notify a
diff -r 9922cec1913d -r e42351a0dc04 sys/external/bsd/common/linux/linux_tasklet.c
--- a/sys/external/bsd/common/linux/linux_tasklet.c     Sun Dec 19 01:45:53 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_tasklet.c     Sun Dec 19 01:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_tasklet.c,v 1.3 2021/12/19 01:17:46 riastradh Exp $      */
+/*     $NetBSD: linux_tasklet.c,v 1.4 2021/12/19 01:46:01 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.3 2021/12/19 01:17:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.4 2021/12/19 01:46:01 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -208,7 +208,6 @@
                 */
                do {
                        state = tasklet->tl_state;
-                       __insn_barrier();
                        /* It had better be scheduled.  */
                        KASSERT(state & TASKLET_SCHEDULED);
                        if (state & TASKLET_RUNNING)
@@ -539,7 +538,6 @@
        unsigned int disablecount;
 
        disablecount = tasklet->tl_disablecount;
-       __insn_barrier();
 
        return (disablecount == 0);
 }
diff -r 9922cec1913d -r e42351a0dc04 sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h      Sun Dec 19 01:45:53 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h      Sun Dec 19 01:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic.h,v 1.28 2021/12/19 01:45:53 riastradh Exp $    */
+/*     $NetBSD: atomic.h,v 1.29 2021/12/19 01:46:01 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -163,7 +163,6 @@
        smp_mb__before_atomic();
        do {
                v = atomic->a_u.au_uint;
-               __insn_barrier();
                if (v <= 0)
                        break;
        } while (atomic_cas_uint(&atomic->a_u.au_uint, v, v - 1) != v);
@@ -194,7 +193,6 @@
        smp_mb__before_atomic();
        do {
                old = atomic->a_u.au_uint;
-               __insn_barrier();
                new = old ^ value;
        } while (atomic_cas_uint(&atomic->a_u.au_uint, old, new) != old);
        smp_mb__after_atomic();
@@ -224,7 +222,6 @@
        smp_mb__before_atomic();
        do {
                value = atomic->a_u.au_int;
-               __insn_barrier();
                if (value == zero)
                        break;
        } while (atomic_cas_uint(&atomic->a_u.au_uint, value, (value + addend))
@@ -407,7 +404,6 @@
        smp_mb__before_atomic();
        do {
                value = (long)a->al_v;
-               __insn_barrier();
                if (value == zero)
                        break;
        } while (atomic_cas_ulong(&a->al_v, (unsigned long)value,
diff -r 9922cec1913d -r e42351a0dc04 sys/external/bsd/drm2/include/linux/kref.h
--- a/sys/external/bsd/drm2/include/linux/kref.h        Sun Dec 19 01:45:53 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/kref.h        Sun Dec 19 01:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kref.h,v 1.8 2021/12/19 00:46:50 riastradh Exp $       */
+/*     $NetBSD: kref.h,v 1.9 2021/12/19 01:46:01 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -146,7 +146,6 @@
        unsigned v;
 
        v = kref->kr_count;
-       __insn_barrier();
 
        return v;
 }



Home | Main Index | Thread Index | Old Index