Date: Mon, 13 Mar 2006 05:47:46 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 93229 for review Message-ID: <200603130547.k2D5lkbd087101@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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++; + } + + + } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603130547.k2D5lkbd087101>