Module Name: src
Committed By: matt
Date: Tue May 4 17:15:36 UTC 2010
Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c
Log Message:
Add code after pmap_remove_all nukes the ASID to reestablish it after the
subsequent pmap_update.
To generate a diff of this commit:
cvs rdiff -u -r1.179.16.23 -r1.179.16.24 src/sys/arch/mips/mips/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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.23 src/sys/arch/mips/mips/pmap.c:1.179.16.24
--- src/sys/arch/mips/mips/pmap.c:1.179.16.23 Thu Apr 8 16:05:31 2010
+++ src/sys/arch/mips/mips/pmap.c Tue May 4 17:15:36 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.179.16.23 2010/04/08 16:05:31 matt Exp $ */
+/* $NetBSD: pmap.c,v 1.179.16.24 2010/05/04 17:15:36 matt 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.179.16.23 2010/04/08 16:05:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.179.16.24 2010/05/04 17:15:36 matt Exp $");
/*
* Manages physical address maps.
@@ -788,11 +788,12 @@
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
printf("pmap_destroy(%p)\n", pmap);
#endif
- if (atomic_add_int_nv(&pmap->pm_count, 1) > 0) {
+ if (atomic_dec_uint_nv(&pmap->pm_count) > 0) {
PMAP_COUNT(dereference);
return;
}
+ KASSERT(pmap->pm_count == 0);
PMAP_COUNT(destroy);
kpreempt_disable();
pmap_tlb_asid_release_all(pmap);
@@ -814,7 +815,7 @@
printf("pmap_reference(%p)\n", pmap);
#endif
if (pmap != NULL) {
- atomic_add_int(&pmap->pm_count, 1);
+ atomic_inc_uint(&pmap->pm_count);
}
PMAP_COUNT(reference);
}
@@ -845,12 +846,10 @@
{
PMAP_COUNT(deactivate);
-#ifdef MULTIPROCESSOR
kpreempt_disable();
curcpu()->ci_pmap_segbase = (void *)(MIPS_KSEG2_START + 0x1eadbeef);
pmap_tlb_asid_deactivate(l->l_proc->p_vmspace->vm_map.pmap);
kpreempt_enable();
-#endif
}
void
@@ -858,13 +857,22 @@
{
PMAP_COUNT(update);
-#ifdef MULTIPROCESSOR
kpreempt_disable();
+#ifdef MULTIPROCESSOR
u_int pending = atomic_swap_uint(&pm->pm_shootdown_pending, 0);
if (pending && pmap_tlb_shootdown_bystanders(pm))
PMAP_COUNT(shootdown_ipis);
- kpreempt_enable();
#endif
+ /*
+ * If pmap_remove_all was called, we deactivated ourselves and nuked
+ * our ASID. Now we have to reactivate ourselves.
+ */
+ if (__predict_false(pm->pm_flags & PMAP_DEFERRED_ACTIVATE)) {
+ pm->pm_flags ^= PMAP_DEFERRED_ACTIVATE;
+ pmap_tlb_asid_acquire(pm, curlwp);
+ pmap_segtab_activate(pm, curlwp);
+ }
+ kpreempt_enable();
}
/*
@@ -1634,6 +1642,7 @@
*/
pmap_tlb_asid_deactivate(pmap);
pmap_tlb_asid_release_all(pmap);
+ pmap->pm_flags |= PMAP_DEFERRED_ACTIVATE;
kpreempt_enable();
}
/*
@@ -2340,7 +2349,7 @@
lock = atomic_cas_ptr(&pg->mdpage.pvh_lock, NULL, new_lock);
if (lock == NULL) {
lock = new_lock;
- atomic_add_int(&pli->pli_lock_refs[lockid], 1);
+ atomic_inc_uint(&pli->pli_lock_refs[lockid]);
}
}