Module Name:src
Committed By: sborrill
Date: Thu Dec 3 09:27:00 UTC 2009
Modified Files:
src/sys/arch/arm/arm32 [netbsd-5]: pmap.c
Log Message:
Pull up the following revisions(s) (requested by scw in ticket #1168):
sys/arch/arm/arm32/pmap.c: revision 1.203
Work-around a possible process exit corner case which can leave stale
data in the cache after a context-switch. Addresses kern/41058.
To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.187.4.1 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.187 src/sys/arch/arm/arm32/pmap.c:1.187.4.1
--- src/sys/arch/arm/arm32/pmap.c:1.187 Sun Sep 28 21:27:11 2008
+++ src/sys/arch/arm/arm32/pmap.c Thu Dec 3 09:26:59 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.187 2008/09/28 21:27:11 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.187.4.1 2009/12/03 09:26:59 sborrill Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
#include machine/param.h
#include arm/arm32/katelib.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.187 2008/09/28 21:27:11 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.187.4.1 2009/12/03 09:26:59 sborrill Exp $);
#ifdef PMAP_DEBUG
@@ -3645,7 +3645,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);
@@ -4076,6 +4075,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;
@@ -4083,6 +4091,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);