Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Dec 2015 10:55:19 +0000 (UTC)
From:      Svatopluk Kraus <skra@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292334 - head/sys/arm/arm
Message-ID:  <201512161055.tBGAtJI2079809@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512161055.tBGAtJI2079809>