All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Philip Ha <philwman@domain.hid>
Cc: Xenomai-help@domain.hid
Subject: Re: [Xenomai-help] clock problem
Date: Fri, 12 Aug 2011 00:24:33 +0200	[thread overview]
Message-ID: <4E4456A1.6090704@domain.hid> (raw)
In-Reply-To: <1313097516.90873.YahooMailClassic@domain.hid>

On 08/11/2011 11:18 PM, Philip Ha wrote:
>> Could you try measuring the jitter in cpu cycles with rdtscll, in
>> kernel-space? If the inaccuracy persists, check that cpufreq is not
>> enabled, and that if running on a multicore system, tscs are
>> synchronized. Apart from that no, no idea.
>>
>> -- 
>>                                            Gilles.
> 
> 
> Hi Gilles,
> 
> I measured the interval between input pulses using rdtsc to grab the 
> cpu cycles. The number of clock cycles between my 1 second input 
> pulses was quite consistent varying by less than 10,000 cycles. On 
> my 1600 MHz system that works out to less than 6 us. This value was 
> consistent between reboots. This indicates to me that the tsc clock 
> is very stable between reboots.
> 
> Looking at /proc/cpuinfo showed that the "cpu MHz" value changes 
> by a small amount during each reboot. It varies from 1600.131 MHz 
> to 1599.628 MHz. The difference between 1600 and 1599.628 MHz 
> accounts exactly for the unexpected latency I described in earlier 
> emails.
> 
> So it would seem that the frequency used for clock time stamps is 
> reported incorrectly when using my Xenomai build. If I boot the system 
> with regular Ubuntu, /proc/cpuinfo consistently reports the frequency 
> as 1600 MHz.
> 
> I do not have CPU scaling set. I am running an Atom dual CPU 
> processor and /proc/cpuinfo shows both processors as having the 
> same frequency. How can I ensure syncronization of the tscs?
> 
> The Xenomai build seems to produce an incorrect cpufreq, any ideas 
> as to why?

The cpu frequency is obtained by the linux kernel calibration procedure.
This same procedure returns the same imprecise results without xenomai.
Now, something in the distro kernel must change the frequency to a nice
round value (a good candidate would be the cpufreq module, except that
the acpi_cpufreq module does not seem to load on my atom).

As a workaround, xenomai proposes kernel parameters to adjust the idea
of the machine clock/cpu frequency. Try adding the following argument on
the kernel command line:

xeno_hal.clockfreq=1600000000 xeno_hal.cpufreq=1600000000

-- 
                                                                Gilles.


  reply	other threads:[~2011-08-11 22:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11 21:18 [Xenomai-help] clock problem Philip Ha
2011-08-11 22:24 ` Gilles Chanteperdrix [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-15 13:50 Philip Ha
2011-08-10 15:18 Philip Ha
2011-08-10 15:49 ` Gilles Chanteperdrix
2011-08-04 19:27 Philip Ha
2011-08-05 12:53 ` Gilles Chanteperdrix
2011-08-08 16:44   ` Philip Ha
2011-08-08 18:00     ` Gilles Chanteperdrix
2011-08-04 15:55 Philip Ha
2011-08-04 16:39 ` Gilles Chanteperdrix
2011-08-04 17:26   ` Philip Ha
2011-08-04 17:34     ` Gilles Chanteperdrix
     [not found] <1311873701.2537.YahooMailClassic@domain.hid>
2011-07-31 17:19 ` Gilles Chanteperdrix
     [not found] <1311805213.7716.YahooMailClassic@domain.hid>
2011-07-28 14:35 ` Gilles Chanteperdrix
2011-07-20 18:35 Philip Ha
2011-07-19 14:24 Philip Ha
2011-07-27 18:47 ` 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=4E4456A1.6090704@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=Xenomai-help@domain.hid \
    --cc=philwman@domain.hid \
    /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.