Module Name:    src
Committed By:   mrg
Date:           Sun Mar 18 23:48:00 UTC 2012

Modified Files:
        src/sys/arch/sparc64/sparc64: pmap.c

Log Message:
take the pmap_lock in pmap_protect().

hopefully this will avoid a problem in pmap_clear_reference()
detecting a reference remaining at the end.

when we remove most/all pmap_lock uses we probably need to remove
this check entirely, but for now this seems better.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.276 src/sys/arch/sparc64/sparc64/pmap.c:1.277
--- src/sys/arch/sparc64/sparc64/pmap.c:1.276	Mon Feb  6 10:40:26 2012
+++ src/sys/arch/sparc64/sparc64/pmap.c	Sun Mar 18 23:48:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.276 2012/02/06 10:40:26 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.277 2012/03/18 23:48:00 mrg Exp $	*/
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2012/02/06 10:40:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.277 2012/03/18 23:48:00 mrg Exp $");
 
 #undef	NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define	HWREF
@@ -2123,6 +2123,7 @@ pmap_protect(struct pmap *pm, vaddr_t sv
 	}
 
 	sva = trunc_page(sva);
+	mutex_enter(&pmap_lock);
 	for (; sva < eva; sva += PAGE_SIZE) {
 #ifdef DEBUG
 		/*
@@ -2130,6 +2131,7 @@ pmap_protect(struct pmap *pm, vaddr_t sv
 		 */
 		if (pm == pmap_kernel() && sva >= ktext &&
 		    sva < roundup(ekdata, 4 * MEG)) {
+			mutex_exit(&pmap_lock);
 			prom_printf("pmap_protect: va=%08x in locked TLB\n",
 			    sva);
 			prom_abort();
@@ -2181,6 +2183,7 @@ pmap_protect(struct pmap *pm, vaddr_t sv
 		tlb_flush_pte(sva, pm);
 	}
 	pv_check();
+	mutex_exit(&pmap_lock);
 }
 
 /*

Reply via email to