Module Name:    src
Committed By:   skrll
Date:           Thu Jul 14 15:51:41 UTC 2016

Modified Files:
        src/sys/arch/arm/arm32: pmap.c

Log Message:
Adapt this to the recent sys/uvm/pmap/pmap_tlb.c changes.  MP kernels
now don't trigger KASSERTs


To generate a diff of this commit:
cvs rdiff -u -r1.334 -r1.335 src/sys/arch/arm/arm32/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.334 src/sys/arch/arm/arm32/pmap.c:1.335
--- src/sys/arch/arm/arm32/pmap.c:1.334	Thu Jul 14 05:00:51 2016
+++ src/sys/arch/arm/arm32/pmap.c	Thu Jul 14 15:51:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.334 2016/07/14 05:00:51 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.335 2016/07/14 15:51:41 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,7 @@
 
 #include <arm/locore.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334 2016/07/14 05:00:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.335 2016/07/14 15:51:41 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -5013,11 +5013,34 @@ pmap_update(pmap_t pm)
 		    "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.
 		 */
-		pmap_tlb_asid_release_all(pm);
+		// 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);
+
 #else
 		/*
 		 * Finish up the pmap_remove_all() optimisation by flushing

Reply via email to