Subject: Re: todr changes to improve clock accuracy across sleeps & reboots
To: Perry E. Metzger <>
From: Gavan Fantom <>
List: tech-kern
Date: 09/07/2006 16:51:19
Perry E. Metzger wrote:
> It would be nice if, optionally, one could wait up to one second,
> spinning, for the RTC chip to turn over a fresh second before doing
> inittodr. Similarly, one would, optionally, wait up to one second
> before doing the resettodr -- that could be done with an interval
> timer controlled sleep since the system clock has high precision.

I think this is a very good idea.

> I suggested making this optional (and possibly sysctlable) because
> some people won't care and will resent the one second additional
> delay.

If you can cope with an overall delay of up to 2 seconds, but can
parallelise it with other processing, you can poll the RTC under the
control of a higher precision timer, say at 100Hz. That way you can
establish when the second changes, and then you can wait for just under
1 second (say 49/50ths of a second) and spin only for 1/50th of a second
in order to synchronise with the exact rollover.

Clearly this is only of value if other processing can happen for a
couple of seconds before setting the clock. I'd use probing devices as
an example, but with interrupts disabled during autoconfiguration that
would be a bit pointless.

(As an aside: Do we really need interrupts disabled during
autoconfiguration? Could some element of parallelism be introduced in
this process?)

Gillette - the best a man can forget