Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha - Remove redundant memory barriers. Fo...



details:   https://anonhg.NetBSD.org/src/rev/f7ddde242bd0
branches:  trunk
changeset: 943421:f7ddde242bd0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Sep 03 02:05:03 2020 +0000

description:
- Remove redundant memory barriers.  For the ones that remain,
  use the membar_ops(3) names to make it clear how they pair up (even
  though most of them expand to the MB instruction anyway).

diffstat:

 sys/arch/alpha/alpha/pmap.c |  17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diffs (94 lines):

diff -r 73edb0b94374 -r f7ddde242bd0 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Thu Sep 03 02:03:14 2020 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Thu Sep 03 02:05:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.269 2020/08/29 20:06:59 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.270 2020/09/03 02:05:03 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.269 2020/08/29 20:06:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.270 2020/09/03 02:05:03 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -951,7 +951,6 @@
                TLB_COUNT(shootnow_remote);
                tlb_context = tlbctx;
                tlb_pending = remote_cpus;
-               alpha_wmb();
                alpha_multicast_ipi(remote_cpus, ALPHA_IPI_SHOOTDOWN);
        }
 #endif /* MULTIPROCESSOR */
@@ -983,7 +982,6 @@
                while (atomic_load_relaxed(&tlb_context) != NULL) {
                        SPINLOCK_BACKOFF(backoff);
                        if (spins++ > 0x0fffffff) {
-                               alpha_mb();
                                printf("TLB LOCAL MASK  = 0x%016lx\n",
                                    this_cpu);
                                printf("TLB REMOTE MASK = 0x%016lx\n",
@@ -996,6 +994,7 @@
                                panic("pmap_tlb_shootnow");
                        }
                }
+               membar_consumer();
        }
        KASSERT(tlb_context == NULL);
 #endif /* MULTIPROCESSOR */
@@ -1026,7 +1025,7 @@
        KASSERT(tlb_context != NULL);
        pmap_tlb_invalidate(tlb_context, ci);
        if (atomic_and_ulong_nv(&tlb_pending, ~(1UL << ci->ci_cpuid)) == 0) {
-               alpha_wmb();
+               membar_producer();
                atomic_store_relaxed(&tlb_context, NULL);
        }
 }
@@ -1614,7 +1613,7 @@
                printf("pmap_destroy(%p)\n", pmap);
 #endif
 
-       PMAP_MP(alpha_mb());
+       PMAP_MP(membar_exit());
        if (atomic_dec_ulong_nv(&pmap->pm_count) > 0)
                return;
 
@@ -1650,7 +1649,7 @@
 #endif
 
        atomic_inc_ulong(&pmap->pm_count);
-       PMAP_MP(alpha_mb());
+       PMAP_MP(membar_enter());
 }
 
 /*
@@ -2306,7 +2305,7 @@
        /* Set the new PTE. */
        const pt_entry_t opte = atomic_load_relaxed(pte);
        atomic_store_relaxed(pte, npte);
-       PMAP_MP(alpha_mb());
+       PMAP_MP(membar_enter());
 
        PMAP_STAT_INCR(pmap->pm_stats.resident_count, 1);
        PMAP_STAT_INCR(pmap->pm_stats.wired_count, 1);
@@ -2369,7 +2368,6 @@
                        PMAP_STAT_DECR(pmap->pm_stats.wired_count, 1);
                }
        }
-       PMAP_MP(alpha_wmb());
 
        pmap_tlb_shootnow(&tlbctx);
        TLB_COUNT(reason_kremove);
@@ -2614,7 +2612,6 @@
         * the kernel pmap.
         */
        ci->ci_pmap = pmap_kernel();
-       PMAP_MP(alpha_mb());
        KASSERT(atomic_load_relaxed(&pmap->pm_count) > 1);
        pmap_destroy(pmap);
 }



Home | Main Index | Thread Index | Old Index