All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Ipipe-core patched kernel fails to start when certain platform drivers are enabled
Date: Fri, 1 May 2015 16:44:28 +0200	[thread overview]
Message-ID: <20150501144428.GI1993@hermes.click-hack.org> (raw)
In-Reply-To: <20150501143631.GH24389@csclub.uwaterloo.ca>

On Fri, May 01, 2015 at 10:36:31AM -0400, Lennart Sorensen wrote:
> On Fri, May 01, 2015 at 03:56:51PM +0200, Gilles Chanteperdrix wrote:
> > 6MHz is still not a lot (even omap3 did better than that).
> > 
> > And no, a A 56 bits counter running at 6MHz does not wrap in 2794
> > seconds, it wraps in:
> > 
> > (2^56) / 6000000 = 12009599006 s
> > 
> > That is:
> > 12009599006 / (365 * 24 * 3600) = 380 years
> > 
> > So, you are safe, it can be considered to avoid wrapping for a
> > reasonable amount of time.
> > 
> > Which means really, that I do not understand why the frequency is so
> > low.
> 
> I hava a suspicition that the 6.144MHz was chosen because it is what
> S/PDIF requires to run 48Khz audio.  Some it may have something to do
> with multimedia handling.
> 
> And in low power mode they run it from 32.768 KHz * 375 / 2.
> 
> Sure looks like they could have easily made it faster, although making
> it faster wouldn't necesarily make it any more accurate depending on
> how it is implemented.  After all if it is just taking a 20MHz system
> clock input and incrementing from that, then there isn't much point
> running it faster.  If you can run it from the PLL circuit that runs
> the CPU core on the other hand, that would be interesting.  Of course
> that frequency can scale up and down if cpu frequency scaling is
> enabled.

That is what the cortex A9 did, the twd local timers and the global
timer are derived from the cpu clock. That said, the twd are still
available on A15 I guess, so maybe the global timer is also
available?

> 
> > 56 bits at 1 GHz would wrap in two years using the same computation,
> > that clearly would violate ARM specs. But 60 MHz for instance would
> > wrap in 38 years, that would seem reasonable.
> 
> Does the kernel have a bug then:
> 
> [    0.000000] OMAP clockevent source: timer1 at 32786 Hz
> [    0.000000] sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 65536000000000ns
> [    0.000000] OMAP clocksource: 32k_counter at 32768 Hz
> [    0.000335] Architected cp15 timer(s) running at 6.14MHz (phys).
> [    0.000370] sched_clock: 56 bits at 6MHz, resolution 162ns, wraps every 2794592043008ns
> [    0.000376] Switching to timer-based delay loop
> [    0.100554] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.29 BogoMIPS (lpj=6147)
> 
> I think 2794592043008ns = 2794.592043008s, and I must admit I assumed
> the kernel knew what it was talking about.  It looks like it does not.

I do not know how that is computed. I do not think I did my
calculations wrong. Maybe the kernel does not use the raw value for
sched_clock, but something transformed with some shifts and
multiplies, and it tells you in how much time that transformed
counter wraps.

-- 
					    Gilles.


  reply	other threads:[~2015-05-01 14:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 15:53 [Xenomai] Ipipe-core patched kernel fails to start when certain platform drivers are enabled Hongfei Cheng
2015-04-30 16:17 ` Gilles Chanteperdrix
2015-04-30 18:12   ` Hongfei Cheng
2015-04-30 18:14     ` Gilles Chanteperdrix
2015-04-30 18:17       ` Hongfei Cheng
2015-04-30 18:31 ` Gilles Chanteperdrix
2015-04-30 20:04   ` Hongfei Cheng
2015-04-30 20:14     ` Gilles Chanteperdrix
2015-04-30 21:21       ` Lennart Sorensen
2015-04-30 21:27         ` Gilles Chanteperdrix
2015-05-01 13:45           ` Lennart Sorensen
2015-05-01 13:56             ` Gilles Chanteperdrix
2015-05-01 14:36               ` Lennart Sorensen
2015-05-01 14:44                 ` Gilles Chanteperdrix [this message]
2015-05-01 15:33                   ` Lennart Sorensen
2015-05-13 17:01                     ` Lennart Sorensen
2015-05-13 17:33                       ` Lennart Sorensen
2015-05-01 14:00             ` Gilles Chanteperdrix
2015-04-30 21:34         ` Gilles Chanteperdrix
2015-05-01 14:20           ` Lennart Sorensen
2015-05-01 14:30             ` Gilles Chanteperdrix
2015-05-01 15:11               ` Lennart Sorensen
2015-05-01 15:22                 ` Gilles Chanteperdrix

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=20150501144428.GI1993@hermes.click-hack.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=lsorense@csclub.uwaterloo.ca \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.