Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 pm_remove_all needs handling in pmap_dest...



details:   https://anonhg.NetBSD.org/src/rev/e1806cdf75a1
branches:  trunk
changeset: 816906:e1806cdf75a1
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Aug 01 18:28:38 2016 +0000

description:
pm_remove_all needs handling in pmap_destroy as well as pmap_update

diffstat:

 sys/arch/arm/arm32/pmap.c |  82 +++++++++++++++++++++++++---------------------
 1 files changed, 44 insertions(+), 38 deletions(-)

diffs (117 lines):

diff -r 1daaa62be374 -r e1806cdf75a1 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Mon Aug 01 18:09:50 2016 +0000
+++ b/sys/arch/arm/arm32/pmap.c Mon Aug 01 18:28:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.337 2016/07/29 15:38:05 skrll Exp $ */
+/*     $NetBSD: pmap.c,v 1.338 2016/08/01 18:28:38 skrll Exp $ */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,7 @@
 
 #include <arm/locore.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.337 2016/07/29 15:38:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.338 2016/08/01 18:28:38 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -4996,6 +4996,45 @@
        UVMHIST_LOG(maphist, "  <-- done", 0, 0, 0, 0);
 }
 
+#ifdef ARM_MMU_EXTENDED
+static inline void
+pmap_remove_all_complete(pmap_t pm)
+{
+       KASSERT(pm != pmap_kernel());
+
+       KASSERTMSG(curcpu()->ci_pmap_cur != pm
+           || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur,
+           "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm,
+           pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name,
+           curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur);
+
+       /*
+        * Finish up the pmap_remove_all() optimisation by flushing
+        * all our ASIDs.
+        */
+#ifdef MULTIPROCESSOR
+       // This should be the last CPU with this pmap onproc
+       KASSERT(!kcpuset_isotherset(pm->pm_onproc, cpu_index(curcpu())));
+       if (kcpuset_isset(pm->pm_onproc, cpu_index(curcpu()))) {
+               struct cpu_info * const ci = curcpu();
+               KASSERT(!cpu_intr_p());
+               /*
+                * The bits in pm_onproc that belong to this
+                * TLB can be changed while this TLBs lock is
+                * not held as long as we use atomic ops.
+                */
+               kcpuset_atomic_clear(pm->pm_onproc, cpu_index(ci));
+       }
+       KASSERT(kcpuset_iszero(pm->pm_onproc));
+#endif /* MULTIPROCESSOR */
+
+       struct pmap_asid_info * const pai =
+           PMAP_PAI(pm, cpu_tlb_info(ci));
+
+       tlb_invalidate_asids(pai->pai_asid, pai->pai_asid);
+}
+#endif
+
 void
 pmap_update(pmap_t pm)
 {
@@ -5007,41 +5046,7 @@
 
        if (pm->pm_remove_all) {
 #ifdef ARM_MMU_EXTENDED
-               KASSERT(pm != pmap_kernel());
-
-               KASSERTMSG(curcpu()->ci_pmap_cur != pm
-                   || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur,
-                   "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm,
-                   pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name,
-                   curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur);
-
-#ifdef MULTIPROCESSOR
-               /*
-                * Finish up the pmap_remove_all() optimisation by flushing
-                * all our ASIDs.
-                */
-               // This should be the last CPU with this pmap onproc
-               KASSERT(!kcpuset_isotherset(pm->pm_onproc, cpu_index(curcpu())));
-               if (kcpuset_isset(pm->pm_onproc, cpu_index(curcpu()))) {
-                       if (pm != pmap_kernel()) {
-                               struct cpu_info * const ci = curcpu();
-                               KASSERT(!cpu_intr_p());
-                               /*
-                                * The bits in pm_onproc that belong to this
-                                * TLB can be changed while this TLBs lock is
-                                * not held as long as we use atomic ops.
-                                */
-                               kcpuset_atomic_clear(pm->pm_onproc,
-                                   cpu_index(ci));
-                       }
-               }
-               KASSERT(kcpuset_iszero(pm->pm_onproc));
-#endif
-               struct pmap_asid_info * const pai =
-                   PMAP_PAI(pm, cpu_tlb_info(ci));
-
-               tlb_invalidate_asids(pai->pai_asid, pai->pai_asid);
-
+               pmap_remove_all_complete(pm);
 #else
                /*
                 * Finish up the pmap_remove_all() optimisation by flushing
@@ -5133,7 +5138,8 @@
 
        if (pm->pm_remove_all) {
 #ifdef ARM_MMU_EXTENDED
-               pmap_tlb_asid_release_all(pm);
+               pmap_remove_all_complete(pm);
+               pmap_tlb_asid_release_all(pm);
 #else
                pmap_tlb_flushID(pm);
 #endif



Home | Main Index | Thread Index | Old Index