Module Name: src
Committed By: scw
Date: Sat Nov 28 11:44:45 UTC 2009
Modified Files:
src/sys/arch/arm/arm32: pmap.c
Log Message:
Apply some band-aid to pmap_activate() for PR kern/41058:
There's a corner case here which can leave turds in the cache as
reported in kern/41058. They're probably left over during tear-down and
switching away from an exiting process. Until the root cause is identified
and fixed, zap the cache when switching pmaps. This will result in a few
unnecessary cache flushes, but that's better than silently corrupting data.
Also remove an extraneous return statement in pmap_page_protect() which
crept in during the matt-armv6 merge.
To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 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.202 src/sys/arch/arm/arm32/pmap.c:1.203
--- src/sys/arch/arm/arm32/pmap.c:1.202 Sat Nov 21 20:32:18 2009
+++ src/sys/arch/arm/arm32/pmap.c Sat Nov 28 11:44:45 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.202 2009/11/21 20:32:18 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.203 2009/11/28 11:44:45 scw Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -211,7 +211,7 @@
#include <machine/param.h>
#include <arm/arm32/katelib.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.202 2009/11/21 20:32:18 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.203 2009/11/28 11:44:45 scw Exp $");
#ifdef PMAP_DEBUG
@@ -3703,7 +3703,6 @@
pg, VM_PAGE_TO_PHYS(pg), prot));
switch(prot) {
- return;
case VM_PROT_READ|VM_PROT_WRITE:
#if defined(PMAP_CHECK_VIPT) && defined(PMAP_APX)
pmap_clearbit(pg, PVF_EXEC);
@@ -4124,6 +4123,15 @@
* entire cache.
*/
rpm = pmap_recent_user;
+
+/*
+ * XXXSCW: There's a corner case here which can leave turds in the cache as
+ * reported in kern/41058. They're probably left over during tear-down and
+ * switching away from an exiting process. Until the root cause is identified
+ * and fixed, zap the cache when switching pmaps. This will result in a few
+ * unnecessary cache flushes, but that's better than silently corrupting data.
+ */
+#if 0
if (npm != pmap_kernel() && rpm && npm != rpm &&
rpm->pm_cstate.cs_cache) {
rpm->pm_cstate.cs_cache = 0;
@@ -4131,6 +4139,16 @@
cpu_idcache_wbinv_all();
#endif
}
+#else
+ if (rpm) {
+ rpm->pm_cstate.cs_cache = 0;
+ if (npm == pmap_kernel())
+ pmap_recent_user = NULL;
+#ifdef PMAP_CACHE_VIVT
+ cpu_idcache_wbinv_all();
+#endif
+ }
+#endif
/* No interrupts while we frob the TTB/DACR */
oldirqstate = disable_interrupts(IF32_bits);