PERFORCE change 65196 for review

John Baldwin jhb at FreeBSD.org
Mon Nov 15 12:17:31 PST 2004


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

Change 65196 by jhb at jhb_slimer on 2004/11/15 20:17:23

	Ugh, more hacking that may help this further.  If this helps,
	then I think the real fix is going to be to hack on critical
	sections.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_mutex.c#88 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_mutex.c#88 (text+ko) ====

@@ -577,6 +577,9 @@
     int line)
 {
 	int i = 0;
+#ifdef __i386__
+	int apic_hack;
+#endif
 
 	if (LOCK_LOG_TEST(&m->mtx_object, opts))
 		CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m);
@@ -587,6 +590,11 @@
 
 		/* Give interrupts a chance while we spin. */
 		critical_exit();
+#ifdef __i386__
+		apic_hack = (read_eflags() & PSL_I) == 0;
+		if (apic_hack)
+			APIC_IPI_SPINWAIT_ENTER();
+#endif
 		while (m->mtx_lock != MTX_UNOWNED) {
 			if (i++ < 10000000) {
 				cpu_spinwait();
@@ -605,6 +613,10 @@
 			}
 			cpu_spinwait();
 		}
+#ifdef __i386__
+		if (apic_hack)
+			APIC_IPI_SPINWAIT_EXIT();
+#endif
 		critical_enter();
 	}
 


More information about the p4-projects mailing list