[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mac mini: serious clock drift



On Fri, Mar 09, 2007 at 07:24:42PM +0100, Benjamin Herrenschmidt wrote:
> On Thu, 2007-03-08 at 16:04 +0100, Bram Senders wrote:
> > Hi there,
> > 
> > I am having issues with clock drift on my G4 Mac mini.  The clock drifts
> > so much that even ntpd can't keep up with it.  I keep getting messages
> > like "time reset +2.404131 s" from ntpd approximately every 15 to 20
> > minutes.
> 
> I think the calibration OF puts in the device-tree is crap or we are
> using the VIA to calibrate and we should not ...
> 
> >From what I remember, Apple has additional calibration code in Darwin
> based on the KeyLargo timers (for machines with a KeyLargo). Might be
> worth implementing something similar.
> 
> Look at pmac_calibrate_decr() in arch/powerpc/platform/powermac/time.c,
> and see wether it's calling via_calibrate_decr() or not on your machine.
> If not, try calling it and tell us if it improves calibration.

Okay, I did that.  via_calibrate_decr() wasn't called, so I built a new
kernel that called it anyway in the timer initialisation code, but this
actually makes matters even worse.

Grepping through my old kern.logs, I see that the decrementer frequency
was always initialised either at 41.620907 MHz or 41.620997 MHz.  I
booted twice with the kernel that calls via_calibrate_decr()
unconditionally; the first time the decrementer frequency was 40.639600
MHz, and 40.639583 Mhz the second time.  I guess it is normal to have
slightly differing frequencies here?

Now I tried running ntpd, without having run tickadj or adjtimex, but
this gives me very bad results:  After having ntpd running for a few
minutes, the offset is already something like -3000 ms, and the jitter
is extremely large at about 2000 ms (which is less than 1 ms normally).
Because of this large jitter, ntpd never gets the chance to synchronise
to any server, and the offset gets progressively larger, to -35000 ms
after less than an hour.  The jitter has at this point doubled to
approximately 4000 ms.  During this period, I was randomly kicked out of
my X session twice, which had never happened before, and hasn't happened
since.  I don't know how this could have anything to do with it, but it
seems related.

So, all in all, via_calibrate_decr() only makes things worse for me.  If
you know any other things to try, or need to know more, I'll be happy to
try stuff out.

Cheers,
Bram



Reply to: