summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-10-29 20:51:30 +0000
committermarius <marius@FreeBSD.org>2010-10-29 20:51:30 +0000
commit92a0242e8e121f39231e6ad11d3d9c033df5812b (patch)
tree672758bb7843fcf7df7074524f02c2666f9446a4
parent430f89aef8d51435e4e5d275c23fd58116bf94ef (diff)
downloadFreeBSD-src-92a0242e8e121f39231e6ad11d3d9c033df5812b.zip
FreeBSD-src-92a0242e8e121f39231e6ad11d3d9c033df5812b.tar.gz
- When resetting pm_active and pm_context of a pmap in pmap_pinit() we
need locking as otherwise we may race against the other parts of the MD code which expects a consistent state of these. While at it move the resetting of the pmap before entering it in the TSB. - Spell a 0 as TLB_CTX_KERNEL.
-rw-r--r--sys/sparc64/sparc64/pmap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c
index b34a07f..d12e110 100644
--- a/sys/sparc64/sparc64/pmap.c
+++ b/sys/sparc64/sparc64/pmap.c
@@ -1065,7 +1065,7 @@ pmap_pinit0(pmap_t pm)
PMAP_LOCK_INIT(pm);
for (i = 0; i < MAXCPU; i++)
- pm->pm_context[i] = 0;
+ pm->pm_context[i] = TLB_CTX_KERNEL;
pm->pm_active = 0;
pm->pm_tsb = NULL;
pm->pm_tsb_obj = NULL;
@@ -1103,6 +1103,12 @@ pmap_pinit(pmap_t pm)
if (pm->pm_tsb_obj == NULL)
pm->pm_tsb_obj = vm_object_allocate(OBJT_PHYS, TSB_PAGES);
+ mtx_lock_spin(&sched_lock);
+ for (i = 0; i < MAXCPU; i++)
+ pm->pm_context[i] = -1;
+ pm->pm_active = 0;
+ mtx_unlock_spin(&sched_lock);
+
VM_OBJECT_LOCK(pm->pm_tsb_obj);
for (i = 0; i < TSB_PAGES; i++) {
m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY |
@@ -1114,9 +1120,6 @@ pmap_pinit(pmap_t pm)
VM_OBJECT_UNLOCK(pm->pm_tsb_obj);
pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES);
- for (i = 0; i < MAXCPU; i++)
- pm->pm_context[i] = -1;
- pm->pm_active = 0;
bzero(&pm->pm_stats, sizeof(pm->pm_stats));
return (1);
}
OpenPOWER on IntegriCloud