Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 May 2006 03:46:53 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96680 for review
Message-ID:  <200605050346.k453krAI047096@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605050346.k453krAI047096>