Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Mar 2006 05:05:45 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 93433 for review
Message-ID:  <200603170505.k2H55jW0043734@repoman.freebsd.org>

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



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