Date: Fri, 24 Mar 2006 19:58:00 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 93943 for review Message-ID: <200603241958.k2OJw006010587@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93943 Change 93943 by jhb@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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603241958.k2OJw006010587>