From owner-p4-projects@FreeBSD.ORG Mon Mar 13 05:47:47 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 C0DEB16A420; Mon, 13 Mar 2006 05:47:47 +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 9D9E216A400 for ; Mon, 13 Mar 2006 05:47:47 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3DD7C43D46 for ; Mon, 13 Mar 2006 05:47:47 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2D5llUT087104 for ; Mon, 13 Mar 2006 05:47:47 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2D5lkbd087101 for perforce@freebsd.org; Mon, 13 Mar 2006 05:47:46 GMT (envelope-from kmacy@freebsd.org) Date: Mon, 13 Mar 2006 05:47:46 GMT Message-Id: <200603130547.k2D5lkbd087101@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 93229 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: Mon, 13 Mar 2006 05:47:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=93229 Change 93229 by kmacy@kmacy_storage:sun4v_work on 2006/03/13 05:47:37 disgusting pmap_qenter hack to avoid kernel TSB misses quick and dirty pmap_copy_page print warning from pmap_copy Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#23 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#23 (text+ko) ==== @@ -130,6 +130,13 @@ */ struct pmap kernel_pmap_store; +/* + * pmap_copy_page vas NOT mp-safe + */ +vm_offset_t pmap_copy_0, pmap_copy_1; + + + hv_tsb_info_t kernel_td[MAX_TSB_INFO]; /* @@ -165,6 +172,7 @@ */ #define UNIMPLEMENTED panic("%s not implemented", __FUNCTION__) +#define IMPLEMENTME printf("don't forget %s not implemented\n", __FUNCTION__) static void free_pv_entry(pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap); @@ -541,6 +549,13 @@ va = kstack0 + i * PAGE_SIZE; tsb_set_tte(&kernel_td[TSB8K_INDEX], va, pa | TTE_KERNEL | VTD_8K, 0); } + /* short-term MP-unsafe hack for pmap_copy_page + */ + pmap_copy_0 = virtual_avail; + virtual_avail += PAGE_SIZE; + pmap_copy_1 = virtual_avail; + virtual_avail += PAGE_SIZE; + /* * Calculate the last available physical address. @@ -679,13 +694,22 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { - UNIMPLEMENTED; + IMPLEMENTME; } void pmap_copy_page(vm_page_t src, vm_page_t dst) { - UNIMPLEMENTED; + /* XXX NOT mp-safe */ + tsb_set_tte(&kernel_pmap->pm_tsb, pmap_copy_0, + VM_PAGE_TO_PHYS(src) | TTE_KERNEL | VTD_8K, 0); + tsb_set_tte(&kernel_pmap->pm_tsb, pmap_copy_1, + VM_PAGE_TO_PHYS(dst) | TTE_KERNEL | VTD_8K, 0); + + bcopy((char *)pmap_copy_0, (char *)pmap_copy_1, PAGE_SIZE); + + pmap_invalidate_page(kernel_pmap, pmap_copy_0); + pmap_invalidate_page(kernel_pmap, pmap_copy_1); } /* @@ -701,11 +725,10 @@ uint64_t tte_data, otte_data, *otte; vm_page_t om; int invlva; -#if 0 + if (pmap->pm_context) printf("ctx=%d va=%lx prot=%x wired=%x\n", (int)pmap->pm_context, va, prot, wired); -#endif om = NULL; @@ -1271,15 +1294,38 @@ pmap_qenter(vm_offset_t sva, vm_page_t *m, int count) { vm_offset_t va; + int tcount; + vm_page_t *tm; + + tm = m; + tcount = count; va = sva; - while (count-- > 0) { - pmap_kenter(va, VM_PAGE_TO_PHYS(*m)); + while (tcount-- > 0) { + pmap_kenter(va, VM_PAGE_TO_PHYS(*tm)); va += PAGE_SIZE; - m++; + tm++; } pmap_invalidate_range(kernel_pmap, sva, va); + /* disgusting hack to avoid TSB misses on kernel pages + * this will need to be fixed some time soon + */ + + tm = m; + tcount = count; + + va = sva; + while (tcount-- > 0) { + tsb_set_tte(&kernel_pmap->pm_tsb, va, + VM_PAGE_TO_PHYS(*tm) | TTE_KERNEL | VTD_8K, + kernel_pmap->pm_context); + va += PAGE_SIZE; + tm++; + } + + + } /*