Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips Fix a logic inversion introduced with the...



details:   https://anonhg.NetBSD.org/src/rev/092f08e48da0
branches:  trunk
changeset: 328905:092f08e48da0
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Apr 23 20:57:15 2014 +0000

description:
Fix a logic inversion introduced with the matt-nb5-mips64 for
pmap_{zero,copy}_page cache alias handing. The check previously used
PG_MD_UNCACHED_P, where it now uses PG_MD_CACHED_P, when considering if
a cache invalidation is required.

Additionally flush the cache for the uarea va to avoid potential (future)
cache aliases in cpu_uarea_free when handing pages back to uvm for later
use.

ok matt@

Hopefully this addresses the instability reported in the following PRs:

PR/44900 - R5000/Rm5200 mips ports are broken
PR/46170 - NetBSD/cobalt 6.0_BETA does not boot
PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable on cobalt qube 2
PR/48628 - cobalt and hpcmips ports are dead

diffstat:

 sys/arch/mips/mips/pmap.c       |  26 ++++++++++++++------------
 sys/arch/mips/mips/vm_machdep.c |   9 +++++++--
 2 files changed, 21 insertions(+), 14 deletions(-)

diffs (77 lines):

diff -r 372ce6d0a7d7 -r 092f08e48da0 sys/arch/mips/mips/pmap.c
--- a/sys/arch/mips/mips/pmap.c Wed Apr 23 17:05:18 2014 +0000
+++ b/sys/arch/mips/mips/pmap.c Wed Apr 23 20:57:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.209 2013/11/10 18:27:15 christos Exp $      */
+/*     $NetBSD: pmap.c,v 1.210 2014/04/23 20:57:15 skrll Exp $ */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.209 2013/11/10 18:27:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.210 2014/04/23 20:57:15 skrll Exp $");
 
 /*
  *     Manages physical address maps.
@@ -454,16 +454,18 @@
        pv_entry_t pv = &md->pvh_first;
        
        (void)PG_MD_PVLIST_LOCK(md, false);
-       if (MIPS_CACHE_VIRTUAL_ALIAS
-           && (PG_MD_UNCACHED_P(md)
-               || (pv->pv_pmap != NULL
-                   && mips_cache_badalias(pv->pv_va, va)))) {
-               /*
-                * If this page was previously uncached or we had to use an
-                * incompatible alias and it has a valid mapping, flush it
-                * from the cache.
-                */
-               mips_dcache_wbinv_range(va, PAGE_SIZE);
+       if (MIPS_CACHE_VIRTUAL_ALIAS) {
+               if (PG_MD_CACHED_P(md)
+                   || (pv->pv_pmap != NULL
+                       && mips_cache_badalias(pv->pv_va, va))) {
+
+                       /*
+                        * If this page was previously cached or we had to use an
+                        * incompatible alias and it has a valid mapping, flush it
+                        * from the cache.
+                        */
+                       mips_dcache_wbinv_range(va, PAGE_SIZE);
+               }
        }
        PG_MD_PVLIST_UNLOCK(md);
 #ifndef _LP64
diff -r 372ce6d0a7d7 -r 092f08e48da0 sys/arch/mips/mips/vm_machdep.c
--- a/sys/arch/mips/mips/vm_machdep.c   Wed Apr 23 17:05:18 2014 +0000
+++ b/sys/arch/mips/mips/vm_machdep.c   Wed Apr 23 20:57:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.142 2012/02/19 21:06:20 rmind Exp $   */
+/*     $NetBSD: vm_machdep.c,v 1.143 2014/04/23 20:57:15 skrll Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.142 2012/02/19 21:06:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.143 2014/04/23 20:57:15 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -230,6 +230,11 @@
        paddr_t pa = MIPS_KSEG0_TO_PHYS(va);
 #endif
 
+#ifdef MIPS3_PLUS
+       if (MIPS_CACHE_VIRTUAL_ALIAS)
+               mips_dcache_inv_range((vaddr_t)va, USPACE);
+#endif
+
        for (const paddr_t epa = pa + USPACE; pa < epa; pa += PAGE_SIZE) {
                struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
                KASSERT(pg != NULL);



Home | Main Index | Thread Index | Old Index