From owner-p4-projects@FreeBSD.ORG Sat Oct 14 15:01:37 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7500716A492; Sat, 14 Oct 2006 15:01:37 +0000 (UTC) X-Original-To: perforce@FreeBSD.org 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 30FB016A412 for ; Sat, 14 Oct 2006 15:01:37 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 18BD643D7B for ; Sat, 14 Oct 2006 15:01:36 +0000 (GMT) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9EF1ZKY028452 for ; Sat, 14 Oct 2006 15:01:35 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9EF1ZeI028447 for perforce@freebsd.org; Sat, 14 Oct 2006 15:01:35 GMT (envelope-from gonzo@FreeBSD.org) Date: Sat, 14 Oct 2006 15:01:35 GMT Message-Id: <200610141501.k9EF1ZeI028447@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 107895 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Oct 2006 15:01:37 -0000 http://perforce.freebsd.org/chv.cgi?CH=107895 Change 107895 by gonzo@gonzo_hq on 2006/10/14 15:00:40 o Increase size of pteobject. We should take into account segtab itself, not only segment maps. o Create segment maps for userland VM on request. Affected files ... .. //depot/projects/mips2/src/sys/mips/include/pmap.h#6 edit .. //depot/projects/mips2/src/sys/mips/mips/pmap.c#13 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/include/pmap.h#6 (text+ko) ==== @@ -134,6 +134,9 @@ #define MIPS_PMAP_SEGTABSIZE 512 #define MIPS_PMAP_SEGSIZE 1024 +#define pmap_segmap(m, v) \ + ((m)->pm_private.pm_segtab->seg_tab[((v) >> SEGSHIFT)]) + struct segtab { pt_entry_t *seg_tab[MIPS_PMAP_SEGTABSIZE]; }; ==== //depot/projects/mips2/src/sys/mips/mips/pmap.c#13 (text+ko) ==== @@ -216,18 +216,11 @@ pt_entry_t *pte = NULL; if (va < MIPS_KSEG0_START) { - /* XXX Try to avoid TLB refills */ -#if 0 - unsigned long lev1; - lev1 = (unsigned long)pmap->pm_lev1; - lev1 = (unsigned long)tlb_pte_find(kptmap, lev1); - lev1 = (unsigned long)MIPS_PTE_TO_PA(*(pt_entry_t *)lev1); - pte = tlb_pte_find( - (pt_entry_t *)MIPS_PHYS_TO_KSEG0((pt_entry_t *)lev1), va); -#endif - panic("XXXMIPS: %s to implement", __func__); + pte = pmap_segmap(pmap, va); + pte += (va >> PAGE_SHIFT) & (NPTEPG - 1); } else pte = tlb_kern_pte_find(kptmap, va); + return pte; } @@ -731,7 +724,8 @@ */ if (pmap->pm_pteobj == NULL) pmap->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, - MIPS_PMAP_SEGTABSIZE * MIPS_PMAP_SEGSIZE + 1); + MIPS_PMAP_SEGTABSIZE * MIPS_PMAP_SEGSIZE + + + MIPS_PMAP_SEGTABSIZE * sizeof(pt_entry_t *) + 1); VM_OBJECT_LOCK(pmap->pm_pteobj); lev1pg = vm_page_grab(pmap->pm_pteobj, @@ -1143,7 +1137,7 @@ vm_offset_t pa; pt_entry_t *pte; vm_offset_t opa; - vm_page_t mpte; + vm_page_t mpte, mem; if (pmap == NULL) return; @@ -1161,6 +1155,24 @@ * resident, we are creating it here. */ if (va < VM_MAXUSER_ADDRESS) { + if(pmap_segmap(pmap, va) == NULL) + { + VM_OBJECT_LOCK(pmap->pm_pteobj); + + mem = vm_page_grab(pmap->pm_pteobj, + MIPS_PMAP_SEGSIZE, + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | \ + VM_ALLOC_WIRED | VM_ALLOC_ZERO); + + vm_page_lock_queues(); + vm_page_flag_clear(mem, PG_BUSY); + mem->valid = VM_PAGE_BITS_ALL; + vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(pmap->pm_pteobj); + + pmap_segmap(pmap, va) = + (pt_entry_t *)MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem)); + } } pte = pmap_pte(pmap, va);