[RFC] Enabling invariant TSC timecounter on SMP
avg at FreeBSD.org
Fri Jun 3 12:12:56 UTC 2011
on 03/06/2011 14:50 John Baldwin said the following:
> 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 ?
> Yes, that can happen.
Well, I think that the test based on smp_rendezvous should ensure that
difference in TSC values is "small enough"; that is, I expect that cost (in TSC
ticks) of migrating a thread from CPU to CPU should be larger than that
difference if the test was passed. Is this an unreasonable expectation?
More information about the freebsd-hackers