From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Xenomai core <Xenomai-core@domain.hid>
Subject: Re: [Xenomai-core] Clock drift.
Date: Wed, 14 Jan 2009 13:55:27 +0000 [thread overview]
Message-ID: <496DEECF.1070407@domain.hid> (raw)
In-Reply-To: <496DEDBB.8000204@domain.hid>
Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Hi,
>>
>> I run clocktest on a system here, not running NTP, using
>> CONFIG_GENERIC_CLOCKEVENT, with a systematic drift of 3us/s. How can
>> this happen? Does it come from the error due to the multiply and shift
>> used for tsc to/from ns conversions ?
>
> What clocksource is used by Linux? Also tsc?
It is an ARM, but yes, the timer used to emulate the tsc is also used by
Linux. Here is the relevant code:
notrace unsigned long long __ipipe_mach_get_tsc(void)
{
if (likely(ixp4xx_timer_initialized)) {
union tsc_reg *local_tsc, result;
unsigned long stamp;
local_tsc = &tsc[ipipe_processor_id()];
__asm__ ("ldmia %1, %M0\n":
"=r"(result.full): "r"(local_tsc),
"m"(*local_tsc));
barrier();
stamp = *IXP4XX_OSTS;
if (unlikely(stamp < result.low))
/* 32 bit counter wrapped, increment high word. */
result.high++;
result.low = stamp;
return result.full;
}
return 0;
}
cycle_t ixp4xx_get_cycles(void)
{
return *IXP4XX_OSTS;
}
static struct clocksource clocksource_ixp4xx = {
.name = "OSTS",
.rating = 200,
.read = ixp4xx_get_cycles,
.mask = CLOCKSOURCE_MASK(32),
.shift = 20,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
unsigned long ixp4xx_timer_freq = FREQ;
static int __init ixp4xx_clocksource_init(void)
{
clocksource_ixp4xx.mult =
clocksource_hz2mult(ixp4xx_timer_freq,
clocksource_ixp4xx.shift);
clocksource_register(&clocksource_ixp4xx);
return 0;
}
--
Gilles.
next prev parent reply other threads:[~2009-01-14 13:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-14 13:39 [Xenomai-core] Clock drift Gilles Chanteperdrix
2009-01-14 13:50 ` Jan Kiszka
2009-01-14 13:55 ` Gilles Chanteperdrix [this message]
2009-01-14 13:53 ` Philippe Gerum
2009-01-14 14:00 ` Gilles Chanteperdrix
2009-01-14 14:06 ` Philippe Gerum
2009-01-15 13:15 ` Gilles Chanteperdrix
2009-01-15 13:30 ` Gilles Chanteperdrix
2009-01-15 13:50 ` Gilles Chanteperdrix
2009-01-15 13:32 ` Philippe Gerum
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=496DEECF.1070407@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=Xenomai-core@domain.hid \
--cc=jan.kiszka@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.