From owner-p4-projects@FreeBSD.ORG Sun Jul 16 04:06:21 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 87D0716A4DF; Sun, 16 Jul 2006 04:06:19 +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 DD11E16A4E5 for ; Sun, 16 Jul 2006 04:06:16 +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 883E343D4C for ; Sun, 16 Jul 2006 04:06:16 +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 k6G46Gxt072527 for ; Sun, 16 Jul 2006 04:06:16 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6G46GEg072524 for perforce@freebsd.org; Sun, 16 Jul 2006 04:06:16 GMT (envelope-from kmacy@freebsd.org) Date: Sun, 16 Jul 2006 04:06:16 GMT Message-Id: <200607160406.k6G46GEg072524@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 101679 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: Sun, 16 Jul 2006 04:06:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=101679 Change 101679 by kmacy@kmacy_storage:sun4v_work_stable on 2006/07/16 04:05:43 make sure that a fragment page is allocated for the kernel hash table Affected files ... .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/include/tte_hash.h#2 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/pmap.c#9 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/tte_hash.c#3 edit Differences ... ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/include/tte_hash.h#2 (text+ko) ==== @@ -19,7 +19,7 @@ tte_t tte_hash_clear_bits(tte_hash_t hash, vm_offset_t va, uint64_t flags); -tte_hash_t tte_hash_kernel_create(vm_offset_t, uint64_t); +tte_hash_t tte_hash_kernel_create(vm_offset_t, uint64_t, vm_paddr_t); tte_hash_t tte_hash_create(uint64_t context, uint64_t *scratchval); ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/pmap.c#9 (text+ko) ==== @@ -756,7 +756,7 @@ * This could happen earlier - but I put it here to avoid * attempts to do updates until they're legal */ - pm->pm_hash = tte_hash_kernel_create(TLB_PHYS_TO_DIRECT(kernel_hash_pa), kernel_hash_size); + pm->pm_hash = tte_hash_kernel_create(TLB_PHYS_TO_DIRECT(kernel_hash_pa), kernel_hash_size, pmap_bootstrap_alloc(PAGE_SIZE)); pm->pm_hashscratch = tte_hash_set_scratchpad_kernel(pm->pm_hash); for (i = 0; i < translations_size; i++) { ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/tte_hash.c#3 (text+ko) ==== @@ -150,7 +150,7 @@ } tte_hash_t -tte_hash_kernel_create(vm_offset_t va, uint64_t size) +tte_hash_kernel_create(vm_offset_t va, uint64_t size, vm_paddr_t fragment_page) { tte_hash_t th; @@ -159,17 +159,40 @@ th->th_entries = 0; th->th_context = 0; th->th_hashtable = (tte_hash_entry_t)va; - + th->th_fhtail = th->th_fhhead = (void *)TLB_PHYS_TO_DIRECT(fragment_page); + return th; } +static inline vm_page_t +alloc_zeroed_page(void) +{ + vm_page_t m; + static int color; + + m = NULL; + + while (m == NULL) { + m = vm_page_alloc(NULL, color++, + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); + + if (m == NULL) + VM_WAIT; + } + + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + + return (m); +} + tte_hash_t tte_hash_create(uint64_t context, uint64_t *scratchval) { tte_hash_t th; vm_page_t m, tm; int i; - static int color; th = get_tte_hash(); @@ -191,20 +214,11 @@ pmap_zero_page(tm); th->th_hashtable = (void *)TLB_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); - m = NULL; - while (m == NULL) { - m = vm_page_alloc(NULL, color++, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + m = alloc_zeroed_page(); - if (m == NULL) - VM_WAIT; - } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - th->th_fhtail = th->th_fhhead = (void *)TLB_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); + KASSERT(th->th_fhtail != NULL, ("th->th_fhtail == NULL")); *scratchval = (uint64_t)((vm_offset_t)th->th_hashtable) | ((vm_offset_t)th->th_size); @@ -273,30 +287,17 @@ struct tte_hash_fragment *fh; tte_hash_entry_t newentry; vm_page_t m; - static int color; - + fh = th->th_fhtail; if (fh->thf_head.fh_free_head == MAX_FRAGMENT_ENTRIES) { - m = NULL; - while (m == NULL) { - m = vm_page_alloc(NULL, color++, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - - if (m == NULL) - VM_WAIT; - } + m = alloc_zeroed_page(); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - fh->thf_head.fh_next = (void *)TLB_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); fh = th->th_fhtail = (void *)TLB_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); fh->thf_head.fh_free_head = 1; #ifdef NOISY_DEBUG printf("new fh=%p \n", fh); #endif - } newentry = &fh->thf_entries[fh->thf_head.fh_free_head];