From owner-p4-projects@FreeBSD.ORG Tue May 13 01:13:39 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 391D937B404; Tue, 13 May 2003 01:13:39 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDB0937B401 for ; Tue, 13 May 2003 01:13:38 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 69FB243F75 for ; Tue, 13 May 2003 01:13:38 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4D8Dc0U086321 for ; Tue, 13 May 2003 01:13:38 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4D8Dbd4086318 for perforce@freebsd.org; Tue, 13 May 2003 01:13:37 -0700 (PDT) Date: Tue, 13 May 2003 01:13:37 -0700 (PDT) Message-Id: <200305130813.h4D8Dbd4086318@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 31056 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2003 08:13:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=31056 Change 31056 by marcel@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);