Use fences for kernel tsc reads.

Konstantin Belousov kostikbel at
Sat Jul 28 17:12:32 UTC 2012

On Sat, Jul 28, 2012 at 09:36:43AM -0700, Jim Harris wrote:
> On Saturday, July 28, 2012, Konstantin Belousov wrote:
> > Hi,
> >
> > This was discussed on somewhat unwieldly thread on svn-src@ as a followup
> > to the commit r238755 which uncovered the problem in the first place.
> >
> > Below is the commit candidate. It changes the fix in r238755 to use CPUID
> > instead of rmb(), since rmb() translates to locked operation on i386,
> > and experimentation shown that Nehalem's RDTSC can pass LOCK.
> >
> > Also, I explicitely use LFENCE and MFENCE instead using rmb() and mb(),
> > for the same reason that on i386 implementation of *mb() is a locked
> > operation instead of fence.
> >
> > Jim, could you please, recheck that on your machine there is no regression
> > in the TSC synchronization test ?
> >
> Ok. I will do this first thing on Monday. Should I still MFC my patch to
> stable-9?

Definitely, please merge. I do not think that SMP && !SSE2 is important
population for us, and since SMP machines of that kind were definitely
multi-socket, I doubt that TSC was synchronized for them anyway. Users
will need to disable tsc manually.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url :

More information about the freebsd-amd64 mailing list