PERFORCE change 96460 for review

Kip Macy kmacy at FreeBSD.org
Mon May 1 01:29:28 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96460

Change 96460 by kmacy at kmacy_storage:sun4v_rwbuf on 2006/05/01 01:28:40

	add missing bucket unlocks

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#39 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#39 (text+ko) ====

@@ -972,10 +972,9 @@
 	else
 		tte_data |= TTE_MINFLAGS;
 
-	if ((otte_data & ~(VTD_W|VTD_REF)) != tte_data) {
+	if ((otte_data & ~(VTD_W|VTD_REF|VTD_LOCK)) != tte_data) {
 		if (otte_data & VTD_V) {
 			invlva = FALSE;
-			*otte = tte_data;
 			if (otte_data & VTD_REF) {
 				if (otte_data & VTD_MANAGED)
 					vm_page_flag_set(om, PG_REFERENCED);
@@ -989,6 +988,11 @@
 				if ((prot & VM_PROT_WRITE) == 0)
 					invlva = TRUE;
 			}
+			DPRINTF("update *otte 0x%lx -> 0x%lx\n", otte_data, tte_data);
+			*otte = tte_data;
+
+			if (!(otte_data & VTD_LOCK))
+				tte_hash_bucket_unlock(pmap->pm_hash, va);
 #ifdef notyet
 			if (invlva)
 #endif
@@ -997,9 +1001,13 @@
 			tte_hash_insert(pmap->pm_hash, va, tte_data);
 			membar(Sync);
 		}
+	} else {
+		if (!(*otte & VTD_LOCK))
+			tte_hash_bucket_unlock(pmap->pm_hash, va);
+		else
+			*otte = (*otte & ~VTD_LOCK); 
 	}
 
-
 	sched_unpin();
 	PMAP_UNLOCK(pmap);
 	vm_page_unlock_queues();
@@ -1556,7 +1564,11 @@
 		vm_page_t m;
 	retry:
 		tte = tte_hash_lookup(pmap->pm_hash, tva, TRUE);
-		otte_data = tte_data = tte ? *tte : 0;
+		if (tte == NULL)
+			continue;
+
+		otte_data = tte_data = *tte;
+
 		if (tte_data & VTD_MANAGED) {
 			m = NULL;
 			if (tte_data & VTD_REF) {
@@ -1573,10 +1585,15 @@
 		tte_data &= ~(VTD_SW_W | VTD_W);
 		
 		if (tte_data != otte_data) {
-			if (!atomic_cmpset_long(tte, otte_data, tte_data))
+			if (!atomic_cmpset_long(tte, otte_data, tte_data)) {
+                                /* XXX this should never happen with hash bucket locks  - FIXME */
+				panic("bucket locked but tte data changed");
+				tte_hash_bucket_unlock(pmap->pm_hash, tva); 
 				goto retry;
+			}
 			anychanged = 1;
 		}
+		tte_hash_bucket_unlock(pmap->pm_hash, tva); 
 	}
 	
 


More information about the p4-projects mailing list