Re: Timekeeping oddities on MacMini G4s

2 messages, 2 authors, 2017-02-01 · open the first message on its own page

Re: Timekeeping oddities on MacMini G4s

From: Hal Murray <hidden>
Date: 2017-02-01 07:09:29

Thanks.

benh@kernel.crashing.org said:
Right, we just use the value provided by Open Firmware. Any chance you can
try with MacOS X ? 
Not easily.  I'm using boxes from eBay.  They didn't come with CDs and I've 
already installed other software.

From the value in the properties you showed me (and the ones I have in some
DT snapshots) it looks like the value isn't fixed but somewhat calibrated by
Open Firmware during boot. 
I rebooted several times.  It always got the exact same clock speed numbers.

I don't know anything about the insides of the PowerPC chip.  Can you confirm 
that the kernel time keeping works off an always ticking register similar to 
the Intel TSC and uses the timebase-frequency as the scale factor?

If so, I should be able to "fix" it from Open Firmware.  I tried that but 
things got worse.  I could easily have fatfingered something but more likely 
my reasoning for computing the right value was buggy.  I guess I'll try again.

I see that powerpc/kernel/time.c reads both timebase-frequency and 
clock-frequency, but doesn't seem to use clock-frequency.  Was that just a 
handy place to read it that got called before anybody else needed it?



-- 
These are my opinions.  I hate spam.

Re: Timekeeping oddities on MacMini G4s

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2017-02-01 07:13:51

On Tue, 2017-01-31 at 22:59 -0800, Hal Murray wrote:
Thanks.

benh@kernel.crashing.org said:
quoted
Right, we just use the value provided by Open Firmware. Any chance you can
try with MacOS X ? 
Not easily.  I'm using boxes from eBay.  They didn't come with CDs and I've 
already installed other software.
Ok, I do have one though somewhere with OS X on it. If you give me instructions
on how to test (I know near to nothing about ntpsec), I should be able to compile
and run it.
quoted
From the value in the properties you showed me (and the ones I have in some
DT snapshots) it looks like the value isn't fixed but somewhat calibrated by
Open Firmware during boot. 
I rebooted several times.  It always got the exact same clock speed numbers.
Interesting. Though different units get different numbers...
I don't know anything about the insides of the PowerPC chip.  Can you confirm 
that the kernel time keeping works off an always ticking register similar to 
the Intel TSC and uses the timebase-frequency as the scale factor?
It should be externally clocked on these CPUs. Either that or a divisor of
the bus frequency, I don't remember, but I *think* Apple uses an external
clock.

But yes, the timebase is supposed to be always running at a constant speed
which is the timebase-frequency (no scaling, the register is always running
at *that* speed).
If so, I should be able to "fix" it from Open Firmware.  I tried that but 
things got worse.  I could easily have fatfingered something but more likely 
my reasoning for computing the right value was buggy.  I guess I'll try again.

I see that powerpc/kernel/time.c reads both timebase-frequency and 
clock-frequency, but doesn't seem to use clock-frequency.  Was that just a 
handy place to read it that got called before anybody else needed it?
Right, it's for display in /proc/cpuinfo in absence of a specific frequency
control driver for the platform (there should be one for the mac mini though).

Cheers,
Ben.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help