[RFC] Enabling invariant TSC timecounter on SMP

John Baldwin jhb at freebsd.org
Fri Jun 3 12:04:24 UTC 2011

On Friday, June 03, 2011 2:03:55 am Andriy Gapon wrote:
> > Consecutive RDTSCs used on a same CPU is always incremental but we 
> > cannot 100% guarantee that on two cores, even if TSC is derived from 
> > the same clock.  I am hoping at least latency difference (I believe 
> > it's about few tens of cycles max) is "eaten up" by lowering 
> > resolution.  It's not perfect but it's better than serialization 
> > (Linux) or heuristics (OpenSolaris), just because there are few rare 
> > conditions to consider.  Thoughts?
> I am still not sure which case this code should solve.
> Thread T1: x1 = rdtsc() on CPU1;
> Thread T1: x2 = rdtsc() on CPU2;
> x2 < x1 ?
> Or?

Yes, that can happen.

John Baldwin

More information about the freebsd-hackers mailing list