From owner-p4-projects@FreeBSD.ORG Thu May 25 22:52:16 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 8767F16AE3A; Thu, 25 May 2006 22:48:52 +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 EE0E416AE39 for ; Thu, 25 May 2006 22:44:14 +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 9F1C043D48 for ; Thu, 25 May 2006 22:44:14 +0000 (GMT) (envelope-from kmacy@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 k4PMhHjg079343 for ; Thu, 25 May 2006 22:43:17 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4PMhHaU079340 for perforce@freebsd.org; Thu, 25 May 2006 22:43:17 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 25 May 2006 22:43:17 GMT Message-Id: <200605252243.k4PMhHaU079340@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 97835 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: Thu, 25 May 2006 22:52:23 -0000 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 #include #include +#include #include #include #include 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