PERFORCE change 93943 for review

John Baldwin jhb at FreeBSD.org
Fri Mar 24 19:58:01 UTC 2006


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

Change 93943 by jhb at jhb_slimer on 2006/03/24 19:57:35

	Force the TD_IS_RUNNING check in the adaptive spin to treat
	td_state as volatile.  On amd64 the compiler was caching the
	value of td_state in a register. :(

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_mutex.c#119 edit
.. //depot/projects/smpng/sys/sys/proc.h#167 edit

Differences ...

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

@@ -551,8 +551,14 @@
 		if (m != &Giant && TD_IS_RUNNING(owner)) {
 #endif
 			turnstile_release(&m->mtx_object);
+
+			/*
+			 * Inline expansion of TD_IS_RUNNING(owner) to
+			 * force volatile.
+			 */
 			while (mtx_rawowner(m) == owner &&
-			    TD_IS_RUNNING(owner)) {
+			    (volatile enum _td_state)owner->td_state ==
+			    TDS_RUNNING) {
 				cpu_spinwait();
 			}
 			continue;

==== //depot/projects/smpng/sys/sys/proc.h#167 (text+ko) ====

@@ -311,7 +311,7 @@
  * or already have been set in the allocator, constructor, etc.
  */
 	struct pcb	*td_pcb;	/* (k) Kernel VA of pcb and kstack. */
-	enum {
+	enum _td_state {
 		TDS_INACTIVE = 0x0,
 		TDS_INHIBITED,
 		TDS_CAN_RUN,


More information about the p4-projects mailing list