On Sun, Jul 19, 2015 at 06:33:29PM +0200, Mark Kettenis wrote:
> So my "unlocking the reaper" diff that was committed the other day
> breaks the MP architectures that don't have an "mpsafe" pmap yet (see
> my commit message).  Is seems hppa's pmap is actually safe enough, but
> alpha, m88k, mips64 and powerpc aren't.  The diff below fixes alpha
> and powerpc with a big hammer.  Theo is currently building snapshots
> with this diff.
> 
> visa@, you'll probably want to add something similar.
> 
> miod@, mpi@, do you want me to move ahead and commit this temporary fix?

Here is a fix for mips64 pmap_remove(). There is a stat_count() (debug
only) outside the kernel lock so the increment should be done as an
atomic operation. Tested on MP octeon.

ok?


Index: arch/mips64/mips64/pmap.c
===================================================================
RCS file: src/sys/arch/mips64/mips64/pmap.c,v
retrieving revision 1.79
diff -u -p -r1.79 pmap.c
--- arch/mips64/mips64/pmap.c   2 May 2015 14:33:19 -0000       1.79
+++ arch/mips64/mips64/pmap.c   22 Jul 2015 13:20:21 -0000
@@ -123,7 +123,7 @@ struct {
        if (pmapdebug & (flag))         \
                printf printdata;
 
-#define stat_count(what)       (what)++
+#define stat_count(what)       atomic_inc_int(&(what))
 int pmapdebug = PDB_ENTER|PDB_FOLLOW;
 
 #else
@@ -649,6 +649,7 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
        if (pmap == NULL)
                return;
 
+       KERNEL_LOCK();
        if (pmap == pmap_kernel()) {
                /* remove entries from kernel pmap */
 #ifdef DIAGNOSTIC
@@ -676,6 +677,7 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
                        pmap_invalidate_kernel_page(sva);
                        stat_count(remove_stats.flushes);
                }
+               KERNEL_UNLOCK();
                return;
        }
 
@@ -718,6 +720,7 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
                        stat_count(remove_stats.flushes);
                }
        }
+       KERNEL_UNLOCK();
 }
 
 /*

Reply via email to