From owner-p4-projects@FreeBSD.ORG Fri Mar 17 05:05:46 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 13AB216A424; Fri, 17 Mar 2006 05:05:46 +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 E31F516A41F for ; Fri, 17 Mar 2006 05:05:45 +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 AE51B43D5A for ; Fri, 17 Mar 2006 05:05:45 +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 k2H55jbB043737 for ; Fri, 17 Mar 2006 05:05:45 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2H55jW0043734 for perforce@freebsd.org; Fri, 17 Mar 2006 05:05:45 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 17 Mar 2006 05:05:45 GMT Message-Id: <200603170505.k2H55jW0043734@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 93433 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: Fri, 17 Mar 2006 05:05:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=93433 Change 93433 by kmacy@kmacy_storage:sun4v_work on 2006/03/17 05:05:17 ensure that tte_hash_lookup returns NULL if entry not found add addition sanity check in insert reduce debug noise Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tte_hash.c#10 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tte_hash.c#10 (text+ko) ==== @@ -161,7 +161,6 @@ if (proc0_mem_allocated < 40) { - printf("skipping vm_page_alloc_contig\n"); proc0_mem_allocated++; th->th_hashtable = (void *)TLB_PHYS_TO_DIRECT(proc0_mem); proc0_mem += PAGE_SIZE*HASH_SIZE; @@ -183,7 +182,6 @@ th->th_hashtable = (void *)TLB_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); done: - printf("th->th_hashtable %p\n", th->th_hashtable); *scratchval = (uint64_t)((vm_offset_t)th->th_hashtable) | ((vm_offset_t)th->th_size); printf("hash_create done\n"); @@ -258,7 +256,12 @@ uint64_t hash_shift, hash_index, tte_tag; tte_hash_field_t fields; int i; + tte_t *tte; + tte = tte_hash_lookup(th, va); + if (tte) + panic("mapping for va=0x%lx already exists tte_data=0x%lx\n", va, *tte); + /* XXX - only handle 8K pages for now */ hash_shift = PAGE_SHIFT; hash_index = (va >> hash_shift) & HASH_MASK(th); @@ -292,7 +295,8 @@ fields = (th->th_hashtable[hash_index].the_fields); for (i = 0; i <= 3; i++) { - if ((fields[i].tte.tag << TTARGET_VA_SHIFT) == (va & ~PAGE_MASK_4M)) + if (((fields[i].tte.tag << TTARGET_VA_SHIFT) == (va & ~PAGE_MASK_4M)) && + (fields[i].tte.data != 0)) return &(fields[i].tte.data); } /* @@ -302,6 +306,7 @@ return (NULL); } + uint64_t tte_hash_set_scratchpad_kernel(tte_hash_t th) {