Re: Dual core Athlons and unsynced TSCs

thockin
2006-01-15T18:37:57Z

On Sun, Jan 15, 2006 at 01:29:36PM -0500, Lee Revell wrote:
> > Or both. You can trap rdtsc users in userland, you have to manually audit
> > kernel users.
> >
> > It should be abolished or properly wrapped in kernel code, as soon as a
> > resync path is available.
>
> For the purposes of this discussion I was not considering direct use of
> rdtsc from userland for timing, I've accepted the arguments that this is
> a lost cause with today's hardware (although I maintain it was viable in
> practice on previous generations of hardware). Besides, rdtsc is
> useless from userspace if the kernel traps it, because the whole point
> of using it over gettimeofday() was that it was dirt cheap.
>
> I'm content to make sure the kernel's internal timekeeping is solid.

You only need to trap rdtsc if you know that some unsyncronizing event has
happened. E.g. 'hlt' or some other sleep state. If we sync every time we
hlt, then we don't need to trap. But we can maybe be lazier about it.

The sync operation itself may not be cheap, and it may be useful to skip
it if possible.