[Gllug] Fedora/Dell Clock Problems
Nix
nix at esperi.org.uk
Thu Mar 29 19:08:06 UTC 2007
On 29 Mar 2007, t. clarke stated:
> My impression has always been that the battery on the Mobo only retains the
> date/time info in the CMOS whilst powered down. Once powered up the mobo
> timer should supply info to the o-s as to real time elapsing. I think the
> o-s gets the elapsed time info from the TSC cycle counter on the CPU, and
Oh, it's much more nasty than that. There are at least five potential
clock sources that I know of, all of which have various horrible
problems. One is nearly useless (0.5s resolution), so there's a choice
of 4 for gettimeofday() / CLOCK_MONOTONIC clocks. Vojtech Pavlik
explained it well in <http://lkml.org/lkml/2005/11/18/261>:
> 1) RTC: 0.5 sec resolution, interrupts
> 2) PIT: takes ages to read, overflows at each timer interrupt
> 3) PMTMR: takes ages to read, overflows in approx 4 seconds, no interrupt
> 4) HPET: slow to read, overflows in 5 minutes. Nice, but usually not present.
> 5) TSC: fast, completely unreliable. Frequency changes, CPUs diverge over time.
> 6) LAPIC: reasonably fast, unreliable, per-cpu
So they *all* suck in various different ways :/ combining the clock sources
is the only way to get a halfway reliable high-accuracy efficient monotonic
clock (and you'll probably lose at least one of those properties to some
degree along the way).
(These days, `per-CPU' means `per-core' on some multicore/hyperthreading
systems!)
> converts the count into real time using a formula. Presumably the o-s needs
> to discover the cock frequency for this to work - and if it is calculating
> using the wrong frequency the o-s clock will be correspondingly wrong.
This depends entirely upon which clock source is in use. It's a black
magic area under heavy development (and this will probably remain so as
CPU and motherboard vendors fuck up all the clocks in even more
interesting ways).
--
`In the future, company names will be a 32-character hex string.'
--- Bruce Schneier on the shortage of company names
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list