Re: spinaphore conceptual draft

Andi Kleen
2005-05-30T19:24:13Z

> > >I suspect any attempt to use time stamps in locks is a bad
> > >idea because of this.
> >
> > Something like this could be built only for CPUs that do support that
> > kind of cycle counter.
>
> RDTSC on older Intel CPUs takes something like 6 cycles. On P4's it
> takes much more, since it's decoded to a microcode MSR access.

It actually seems to flush the trace cache, because Intel figured
out that out of order RDTSC is probably not too useful (which is right)
and the only way to ensure that on Netburst seems to stop the trace
cache in its track. That can be pretty slow, we're talking 1000+ cycles
here.

Now on the other hand if you only execute it in the slow path
of a lock it might not be that bad (since the machine should
be pretty synchronized at this point anyways), but still it
is probably not something you want to do often.

-Andi