non-invariant tsc and cputicker

From: Andriy Gapon <avg_at_freebsd.org>
Date: Fri, 03 Dec 2010 19:26:42 +0200
FreeBSD uses cpu_ticks [function pointer] in a few places for a few things like
process CPU time accounting.  On x86 cpu_ticks always points to rdtsc.
If TSC is not invariant that leads to incorrect accounting of "CPU ticks".
The code pretends to try to handle changing cpufreq levels, but does that incorrectly.

I think that we could use a selected timecounter instead of "raw" TSC if the
latter is not invariant.  In this case cpu_ticks calls would be slightly costlier,
but always correct.

The change is quite trivial:
http://people.freebsd.org/~avg/tsc-cputicker.diff

What do you think?

P.S. it's probably a good idea to merge i386 and amd64 tsc.c files into a common
x86 version, which would be the same as i386 version, which seems to be generic
enough.

-- 
Andriy Gapon
Received on Fri Dec 03 2010 - 16:26:45 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:09 UTC