Date: Thu, 25 May 2006 22:43:17 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97835 for review Message-ID: <200605252243.k4PMhHaU079340@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97835 Change 97835 by kmacy@kmacy_storage:sun4v_work on 2006/05/25 22:43:10 change initial TSB size to be the same as the initial hash table size Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tsb.c#16 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tsb.c#16 (text+ko) ==== @@ -50,13 +50,17 @@ #include <machine/smp.h> #include <machine/mmu.h> #include <machine/tte.h> +#include <machine/tte_hash.h> #include <machine/tsb.h> #include <machine/vmparam.h> #include <machine/tlb.h> CTASSERT(sizeof(tte_t) == sizeof(uint64_t)); #define TSB_MASK(tsb) ((tsb->hvtsb_ntte) - 1) +/* make TSB start off at the same size as the hash */ +#define TSB_SIZE (1 << HASH_ENTRY_SHIFT) + #ifdef DEBUG_TSB #define DPRINTF printf #else @@ -67,24 +71,21 @@ tsb_init(hv_tsb_info_t *hvtsb, uint64_t *scratchval) { vm_page_t m; - int granted; + int i; uint64_t tsb_pages; - static int color; - granted = 0; - - while (granted == 0) { - m = vm_page_alloc(NULL, color++, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (m == NULL) + m = NULL; + while (m == NULL) { + m = vm_page_alloc_contig(TSB_SIZE, phys_avail[0], + phys_avail[1], TSB_SIZE*PAGE_SIZE, (1UL<<34)); + if (m == NULL) { + printf("vm_page_alloc_contig failed - waiting to retry\n"); VM_WAIT; - else - granted = 1; + } } hvtsb->hvtsb_idxpgsz = TTE8K; hvtsb->hvtsb_assoc = 1; - hvtsb->hvtsb_ntte = (PAGE_SIZE >> TTE_SHIFT); + hvtsb->hvtsb_ntte = (TSB_SIZE*PAGE_SIZE >> TTE_SHIFT); hvtsb->hvtsb_ctx_index = -1; /* TSBs aren't shared so if we don't * set the context in the TTEs we can * simplify miss handling slightly @@ -93,6 +94,10 @@ hvtsb->hvtsb_rsvd = 0; hvtsb->hvtsb_pa = VM_PAGE_TO_PHYS(m); + for (i = 0; i < TSB_SIZE; i++, m++) + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + tsb_pages = hvtsb->hvtsb_ntte >> (PAGE_SHIFT - TTE_SHIFT); *scratchval = TLB_PHYS_TO_DIRECT(hvtsb->hvtsb_pa) | tsb_pages; @@ -102,12 +107,16 @@ void tsb_deinit(hv_tsb_info_t *hvtsb) { - vm_page_t m; + vm_page_t m, tm; + int i; + m = PHYS_TO_VM_PAGE((vm_paddr_t)hvtsb->hvtsb_pa); - m->wire_count--; - atomic_subtract_int(&cnt.v_wire_count, 1); - vm_page_free_zero(m); + for (i = 0, tm = m; i < TSB_SIZE; i++, m++) { + tm->wire_count--; + atomic_subtract_int(&cnt.v_wire_count, 1); + } + vm_page_release_contig(m, TSB_SIZE); } @@ -180,7 +189,7 @@ void tsb_clear(hv_tsb_info_t *tsb) { - pmap_scrub_pages(tsb->hvtsb_pa, tsb->hvtsb_ntte << TTE_SHIFT); + hwblkclr((void *)TLB_PHYS_TO_DIRECT(tsb->hvtsb_pa), tsb->hvtsb_ntte << TTE_SHIFT); } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605252243.k4PMhHaU079340>