From owner-p4-projects@FreeBSD.ORG Fri May 5 03:46:54 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 6B56016A407; Fri, 5 May 2006 03:46:54 +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 2E66216A401 for ; Fri, 5 May 2006 03:46:54 +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 EE48343D49 for ; Fri, 5 May 2006 03:46:53 +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 k453krto047099 for ; Fri, 5 May 2006 03:46:53 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k453krAI047096 for perforce@freebsd.org; Fri, 5 May 2006 03:46:53 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 5 May 2006 03:46:53 GMT Message-Id: <200605050346.k453krAI047096@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 96680 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, 05 May 2006 03:46:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=96680 Change 96680 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/05 03:46:27 clean up tte_hash_destroy tighten up insertion sanity checks Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tte_hash.c#18 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tte_hash.c#18 (text+ko) ==== @@ -219,24 +219,7 @@ void tte_hash_destroy(tte_hash_t th) { - vm_page_t m, hash_pages[MAX_HASH_SIZE]; - int i; - panic("FIXME"); - for (i = 0; i < th->th_size; i++) - hash_pages[i] = PHYS_TO_VM_PAGE(vtophys(((char *)th->th_hashtable) + i*PAGE_SIZE)); - - pmap_qremove((vm_offset_t)th->th_hashtable, th->th_size); - - vm_page_lock_queues(); - for (i = 0; i < th->th_size; i++) { - m = hash_pages[i]; - - m->wire_count--; - atomic_subtract_int(&cnt.v_wire_count, 1); - vm_page_free_zero(m); - } - vm_page_unlock_queues(); free_tte_hash(th); } @@ -284,8 +267,6 @@ hash_shift = PAGE_SHIFT; hash_index = (va >> hash_shift) & HASH_MASK(th); fields = (th->th_hashtable[hash_index].the_fields); - - tte_data = 0; hash_bucket_lock(fields); @@ -294,6 +275,8 @@ if (tte_data == 0) goto done; + th->th_entries--; + for (i = 0; (i < 4) && (fields[i + 1].tte.tag != 0); i++) ; lastindex = i; @@ -338,7 +321,7 @@ fields[cookie].tte.data = tte_data | (fields[cookie].tte.data & VTD_LOCK); fields[cookie].tte.tag = tte_tag; - if (cookie == 4) + if (cookie == 3) panic("collision handling unimplemented - please re-consider"); hash_bucket_unlock_inline(fields); @@ -428,6 +411,9 @@ #ifdef TTE_DEBUG printf("tte_hash_update(va=0x%lx, tte_data=0x%lx, index=%d)\n", va, tte_data, cookie); #endif + if (cookie == 3) + panic("collision handling unimplemented - please re-consider"); + fields[cookie].tte.tag = (((uint64_t)th->th_context << TTARGET_CTX_SHIFT)|(va >> TTARGET_VA_SHIFT)); fields[cookie].tte.data = tte_data | (fields[cookie].tte.data & VTD_LOCK); hash_bucket_unlock_inline(fields);