Clocks broken on Mac mini

Hal Murray hmurray at megapathdsl.net
Mon Jan 30 11:45:30 UTC 2017


hugh at blemings.org said:
> If it would be of help I've a couple of friends who still do  Linux/PowerPC
> kernel work, might be able to prod them about a fix at  least for upstream
> if we have a simple to demonstrate test case and are  confident it's in the
> kernel.

Thanks.

I think that would be a big help.

My goal was to get our code running on a big-endian system to make sure we 
had all the byte swaps in the right place.  We can do that even if the kernel 
doesn't keep good time so fixing this is not high priority.  I could use some 
help in tracking this down and/or I'm willing to help if anybody is 
interested in investigating.

I'm a geek, but know nothing about the PowerPC and close to nothing about 
debugging kernels.

I think I found the timekeeping code in the kernel.  It's using a cycle 
counter like I expect.  I think it is using the clock frequency from Open 
Firmware.  Do you know anything about Open Firmware on the Mac mini?  I found 
a web page that said to hold down Command+Option+o+f at power up but I 
couldn't get that to work.  Maybe I don't know my keys.

Time for sleep.

-----------

I'm reasonably confident that the system doesn't keep reasonable time when 
ntpd isn't running.

Here is my test case:
  assuming you have a working ntp setup
  add "disable ntp" to ntp.conf
  make sure you are logging loopstats:
    statsdir /var/log/ntp or ntpstats or ...
    filegen loopstats  type day link
reboot the system to start clean

You will get things like this in loopstats.
57783 14135.823 0.684044126 0.000 0.000000954 0.000000 6
57783 14137.823 0.688713522 0.000 0.000000954 0.000000 6
57783 14139.823 0.692100011 0.000 0.000000954 0.000000 6
...
57783 16640.823 6.663863776 0.000 0.000000954 0.000000 6
57783 16692.823 6.743695119 0.000 0.000000954 0.000000 6
57783 16708.823 6.823918338 0.000 0.000000954 0.000000 6
The second column is the seconds this day.
The 3rd column is the offset from the servers you are using.
It should be changing slowly.  If it is slow enough, ntpd will correct it by 
adjusting the drift.

You can calculate the drift as
   (offset2-offset1)*1000000/(time2 - time1)

$ dc
16708.823 14135.823 - p
2573.000
6.823918338 0.684044126 - p
6.139874212
1000000 * p
6139874.212000000
2573.000 / p
2386

That's 2386 ppm.  "slow enough" is under 500 ppm.  Sane numbers are under 
100.  (either sign)

Without the "disable ntp", the 4th column will be the drift.  It should vary 
with temperature.  Ballpark change is 1 ppm per C.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list