linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Hal Murray <hmurray@megapathdsl.net>
Cc: Hugh Blemings <hugh@blemings.org>,
	linuxppc-dev@ozlabs.org, devel@ntpsec.org,
	Paul Mackerras <paulus@ozlabs.org>,
	Michael Ellerman <michael@ellerman.id.au>
Subject: Re: Timekeeping oddities on MacMini G4s
Date: Wed, 01 Feb 2017 18:13:26 +1100	[thread overview]
Message-ID: <1485933206.2953.19.camel@kernel.crashing.org> (raw)
In-Reply-To: <20170201065932.92618406061@ip-64-139-1-69.sjc.megapath.net>

On Tue, 2017-01-31 at 22:59 -0800, Hal Murray wrote:
> 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.

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.
> 
> > 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.

  reply	other threads:[~2017-02-01  7:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01  3:10 Timekeeping oddities on MacMini G4s Hugh Blemings
2017-02-01  3:34 ` Benjamin Herrenschmidt
2017-02-01  6:59   ` Hal Murray
2017-02-01  7:13     ` Benjamin Herrenschmidt [this message]
2017-02-01  7:56       ` Hal Murray
2017-02-05  0:19         ` Fred Wright
2017-02-05  3:32           ` Hal Murray
2017-02-05 15:36             ` Frank Nicholas
2017-02-06  5:59               ` Hal Murray
2017-02-05 23:22           ` Benjamin Herrenschmidt
2017-02-06  2:12             ` Segher Boessenkool
2017-02-07  2:21         ` Michael Ellerman
2017-02-07  9:56           ` Hal Murray
     [not found] <1316061184.389961.1486121485729@mail.yahoo.com>
2017-02-03 11:41 ` Jochen Rollwagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485933206.2953.19.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=devel@ntpsec.org \
    --cc=hmurray@megapathdsl.net \
    --cc=hugh@blemings.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    --cc=paulus@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).