svn commit: r205454 - head/sys/ia64/ia64

Marcel Moolenaar marcel at FreeBSD.org
Mon Mar 22 18:24:43 UTC 2010


Author: marcel
Date: Mon Mar 22 18:24:42 2010
New Revision: 205454
URL: http://svn.freebsd.org/changeset/base/205454

Log:
  o   Remove the pmap argument to pmap_invalidate_all() as it's not used
      other than in a potentially dangerous KASSERT.
  o   Hand-inline pmap_remove_page() as it's only called from 1 place and
      the abstraction that pmap_remove_page() provides is not enough to
      warrant the obfuscation. Eliminate the dangerous KASSERT in the
      process.
  o   In pmap_remove_pte(), remove the KASSERT for pmap being the current
      one as it's not safe in the face of CPU migration.

Modified:
  head/sys/ia64/ia64/pmap.c

Modified: head/sys/ia64/ia64/pmap.c
==============================================================================
--- head/sys/ia64/ia64/pmap.c	Mon Mar 22 17:57:00 2010	(r205453)
+++ head/sys/ia64/ia64/pmap.c	Mon Mar 22 18:24:42 2010	(r205454)
@@ -238,7 +238,7 @@ static pv_entry_t get_pv_entry(pmap_t lo
 static void	pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
 		    vm_page_t m, vm_prot_t prot);
 static void	pmap_free_pte(struct ia64_lpte *pte, vm_offset_t va);
-static void	pmap_invalidate_all(pmap_t pmap);
+static void	pmap_invalidate_all(void);
 static int	pmap_remove_pte(pmap_t pmap, struct ia64_lpte *pte,
 		    vm_offset_t va, pv_entry_t pv, int freepte);
 static int	pmap_remove_vhpt(vm_offset_t va);
@@ -475,7 +475,7 @@ pmap_bootstrap()
 	/*
 	 * Clear out any random TLB entries left over from booting.
 	 */
-	pmap_invalidate_all(kernel_pmap);
+	pmap_invalidate_all();
 
 	map_gateway_page();
 }
@@ -575,16 +575,14 @@ pmap_invalidate_all_1(void *arg)
 }
 
 static void
-pmap_invalidate_all(pmap_t pmap)
+pmap_invalidate_all(void)
 {
 
-	KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)),
-		("invalidating TLB for non-current pmap"));
-
 #ifdef SMP
-	if (mp_ncpus > 1)
+	if (mp_ncpus > 1) {
 		smp_rendezvous(NULL, pmap_invalidate_all_1, NULL, NULL);
-	else
+		return;
+	}
 #endif
 	pmap_invalidate_all_1(NULL);
 }
@@ -1158,9 +1156,6 @@ pmap_remove_pte(pmap_t pmap, struct ia64
 	int error;
 	vm_page_t m;
 
-	KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)),
-		("removing pte for non-current pmap"));
-
 	/*
 	 * First remove from the VHPT.
 	 */
@@ -1319,23 +1314,6 @@ pmap_map(vm_offset_t *virt, vm_offset_t 
 }
 
 /*
- * Remove a single page from a process address space
- */
-static void
-pmap_remove_page(pmap_t pmap, vm_offset_t va)
-{
-	struct ia64_lpte *pte;
-
-	KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)),
-		("removing page for non-current pmap"));
-
-	pte = pmap_find_vhpt(va);
-	if (pte != NULL)
-		pmap_remove_pte(pmap, pte, va, 0, 1);
-	return;
-}
-
-/*
  *	Remove the given range of addresses from the specified map.
  *
  *	It is assumed that the start and end are properly
@@ -1362,7 +1340,9 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 	 * code.
 	 */
 	if (sva + PAGE_SIZE == eva) {
-		pmap_remove_page(pmap, sva);
+		pte = pmap_find_vhpt(sva);
+		if (pte != NULL)
+			pmap_remove_pte(pmap, pte, sva, 0, 1);
 		goto out;
 	}
 
@@ -1927,7 +1907,8 @@ pmap_remove_pages(pmap_t pmap)
 	pv_entry_t pv, npv;
 
 	if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
-		printf("warning: pmap_remove_pages called with non-current pmap\n");
+		printf("warning: %s called with non-current pmap\n",
+		    __func__);
 		return;
 	}
 


More information about the svn-src-head mailing list