svn commit: r292334 - head/sys/arm/arm

Svatopluk Kraus skra at FreeBSD.org
Wed Dec 16 13:44:40 UTC 2015


Author: skra
Date: Wed Dec 16 10:55:19 2015
New Revision: 292334
URL: https://svnweb.freebsd.org/changeset/base/292334

Log:
  Adopt assert from amd64 in pmap_remove_pages().
  
  Suggested by:	kib
  Approved by:	kib (mentor)

Modified:
  head/sys/arm/arm/pmap-v6-new.c

Modified: head/sys/arm/arm/pmap-v6-new.c
==============================================================================
--- head/sys/arm/arm/pmap-v6-new.c	Wed Dec 16 10:14:16 2015	(r292333)
+++ head/sys/arm/arm/pmap-v6-new.c	Wed Dec 16 10:55:19 2015	(r292334)
@@ -4153,10 +4153,25 @@ pmap_remove_pages(pmap_t pmap)
 	uint32_t inuse, bitmask;
 	boolean_t allfree;
 
-	if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
-		printf("warning: %s called with non-current pmap\n", __func__);
-		return;
+	/*
+	 * Assert that the given pmap is only active on the current
+	 * CPU.  Unfortunately, we cannot block another CPU from
+	 * activating the pmap while this function is executing.
+	 */
+	KASSERT(pmap == vmspace_pmap(curthread->td_proc->p_vmspace),
+	    ("%s: non-current pmap %p", __func__, pmap));
+#if defined(SMP) && defined(INVARIANTS)
+	{
+		cpuset_t other_cpus;
+
+		sched_pin();
+		other_cpus = pmap->pm_active;
+		CPU_CLR(PCPU_GET(cpuid), &other_cpus);
+		sched_unpin();
+		KASSERT(CPU_EMPTY(&other_cpus),
+		    ("%s: pmap %p active on other cpus", __func__, pmap));
 	}
+#endif
 	SLIST_INIT(&free);
 	rw_wlock(&pvh_global_lock);
 	PMAP_LOCK(pmap);


More information about the svn-src-head mailing list