PERFORCE change 31056 for review
Marcel Moolenaar
marcel at FreeBSD.org
Tue May 13 01:13:40 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=31056
Change 31056 by marcel at marcel_nfs on 2003/05/13 01:13:09
Do not lazily allocate region IDs. It creates a race for SMP
kernels and adds needless tests on the critial path. Allocate
all RIDs when the pmap is created.
Affected files ...
.. //depot/projects/ia64_epc/sys/ia64/ia64/pmap.c#11 edit
Differences ...
==== //depot/projects/ia64_epc/sys/ia64/ia64/pmap.c#11 (text+ko) ====
@@ -640,6 +640,7 @@
{
int rid;
+ mtx_lock(&pmap_ridmutex);
if (pmap_ridcount == pmap_ridmax)
panic("pmap_allocate_rid: All Region IDs used");
@@ -648,6 +649,7 @@
} while (pmap_ridbusy[rid / 64] & (1L << (rid & 63)));
pmap_ridbusy[rid / 64] |= (1L << (rid & 63));
pmap_ridcount++;
+ mtx_unlock(&pmap_ridmutex);
return rid;
}
@@ -661,33 +663,6 @@
mtx_unlock(&pmap_ridmutex);
}
-static void
-pmap_ensure_rid(pmap_t pmap, vm_offset_t va)
-{
- int rr;
-
- rr = va >> 61;
-
- /*
- * We get called for virtual addresses that may just as well be
- * kernel addresses (ie region 5, 6 or 7). Since the pm_rid field
- * only holds region IDs for user regions, we have to make sure
- * the region is within bounds.
- */
- if (rr >= 5)
- return;
-
- if (pmap->pm_rid[rr])
- return;
-
- mtx_lock(&pmap_ridmutex);
- pmap->pm_rid[rr] = pmap_allocate_rid();
- if (pmap == PCPU_GET(current_pmap))
- ia64_set_rr(IA64_RR_BASE(rr),
- (pmap->pm_rid[rr] << 8)|(PAGE_SHIFT << 2)|1);
- mtx_unlock(&pmap_ridmutex);
-}
-
/***************************************************
* Low level helper routines.....
***************************************************/
@@ -847,6 +822,10 @@
void
pmap_pinit2(struct pmap *pmap)
{
+ int i;
+
+ for (i = 0; i < 5; i++)
+ pmap->pm_rid[i] = pmap_allocate_rid();
}
/***************************************************
@@ -1642,8 +1621,6 @@
if (pmap == NULL)
return;
- pmap_ensure_rid(pmap, va);
-
oldpmap = pmap_install(pmap);
va &= ~PAGE_MASK;
@@ -1760,8 +1737,6 @@
struct ia64_lpte *pte;
pmap_t oldpmap;
- pmap_ensure_rid(pmap, va);
-
oldpmap = pmap_install(pmap);
pte = pmap_find_pte(va);
More information about the p4-projects
mailing list