From: Wolfgang Mauerer <wolfgang.mauerer@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: "Kiszka, Jan" <jan.kiszka@domain.hid>,
Andreas Glatz <AndreasGlatz@domain.hid>,
"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] Question about getting system time
Date: Tue, 18 May 2010 14:11:45 +0200 [thread overview]
Message-ID: <4BF28401.6060503@domain.hid> (raw)
In-Reply-To: <4BF267D3.4040500@domain.hid>
Gilles Chanteperdrix wrote:
> Wolfgang Mauerer wrote:
>> Steve Deiters wrote:
>>>> Periodically setting the time is risky if timed jobs depend
>>>> on Xenomai's real-time clock - it may jump in all directions...
>>>>
>>>>> Any other suggestions for providing timestamps to real time
>>>> tasks in
>>>>> this case?
>>>> Do you just need precise timestamps from with real-time
>>>> tasks, or do you have to synchronize timer events of the
>>>> Xenomai core on an external clock?
>>>>
>>>> For the former case (precisely our scenario), we laid the
>>>> ground to extend Xenomai 2.5 with RT-safe syscalls to obtain
>>>> Linux's view on gettimeofday. It "just" needs some polishing
>>>> to post this for upstream.
>>>> Wolfgang (CC'ed) is working on this.
>>> I'm just looking to get timestamps in the real time task. At least in
>>> my case being able to call gettimeofday from the real time thread would
>>> be exactly what I need.
>> then you might want to try the attached patches for Ipipe and
>> Xenomai. For upstream submission, they still need a bit of
>> cleaning up as Jan mentioned, and I'll also prepare a proper
>> series then. Testing is very welcome, however.
>
> Ok. The following points should be fixed before submission:
thanks for the comments!
> - gettimeofday should not have another timebase than
> clock_gettime(CLOCK_REALTIME): in other word, the whole clock system
> should be based on the ntp clock.
Sorry, I'm not quite sure what you are talking about here. The NTP
corrections are provided for the clock offered in the vsyscall page
by Linux, so the clock is based on the NTP clock, isn't it? Or
am I misparsing your statement?
> - you should not use vread, you should use __xn_rdtsc directly in
> user-space, otherwise, your code would only work on x86. Of course this
> means that the I-pipe should create a clocksource with whatever hardware
> counter the architecture is providing to Xenomai. This also means that
> the I-pipe should declare a clocksource using whatever hardware counter
> is provided by the architecture with highest priority than other
> clocksources, to ensure that Linux is using the same clock source as
> Xenomai, and that NTP is correcting that clock source. This would also
> remove the issue with Linux declaring the tsc unstable.
the reason why it's based on vread() is because the Linux kernel
automatically makes sure that it points to a function that can be called
from userland, so why would it only run on x86? Currently, the
userland patch is limited to x86 because I've only adapted the
sequence counter for this arch.
Besides, vread() could also work with a different source than the TSC as
long as it's accessible from userland.
> - why the transactionnal mechanism at all? Why not simply using seqlocks
> with an ipipe_spinlock, and do the update with irqs off? the locking
> section is much shorter than, say, xnpod_schedule, so it will not have
> any influence on the worst case latency, and the reader side will still
> be lockless.
Because even if we don't increase the peak latency, we'll still
increase the average latency. Additionally, it would also be possible
to extend the base mechanism to an RCU-style communication channel
between the kernel and Xenomai in the long run, so I'd argue that
the lock-less solution is nicer.
> - the NTP event should trigger an ipipe event with ipipe_dispatch_event.
could do, but I was following Gilles' suggestion ;-) to use an
arch-specific hook since it's easier to maintain in the long run than
writing a generic function and replacing every call to
vsyscall_update(), also the future.
(http://www.opensubscriber.com/message/xenomai@xenomai.org,
although I can change that, certainly no religious issues here)
Thanks, Wolfgang
next prev parent reply other threads:[~2010-05-18 12:11 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 22:14 [Xenomai-help] Question about getting system time Abhijit Majumdar
2010-05-14 5:44 ` Gilles Chanteperdrix
2010-05-14 10:34 ` Andreas Glatz
2010-05-14 10:42 ` Gilles Chanteperdrix
2010-05-17 16:27 ` Steve Deiters
2010-05-17 16:52 ` Jan Kiszka
2010-05-17 17:05 ` Steve Deiters
2010-05-17 17:13 ` Jan Kiszka
2010-05-17 18:02 ` Josh Karch
2010-05-17 18:23 ` Jan Kiszka
2010-05-17 18:51 ` Thomas Lockhart
2010-05-17 22:48 ` Steve Deiters
2010-05-17 23:50 ` Gilles Chanteperdrix
2010-05-17 23:53 ` Gilles Chanteperdrix
2010-05-18 0:23 ` Steve Deiters
2010-05-18 7:04 ` Jan Kiszka
2010-05-18 7:59 ` Gilles Chanteperdrix
2010-05-18 8:38 ` Wolfgang Mauerer
2010-05-18 10:11 ` Gilles Chanteperdrix
2010-05-18 12:11 ` Wolfgang Mauerer [this message]
2010-05-18 12:41 ` Gilles Chanteperdrix
2010-05-18 14:58 ` [Xenomai-core] " Wolfgang Mauerer
2010-05-18 15:07 ` Gilles Chanteperdrix
2010-05-18 18:41 ` Gilles Chanteperdrix
2010-05-18 20:23 ` Wolfgang Mauerer
2010-05-18 21:19 ` Gilles Chanteperdrix
2010-05-18 22:09 ` Jan Kiszka
2010-05-18 22:24 ` Gilles Chanteperdrix
2010-05-18 23:02 ` Jan Kiszka
2010-05-19 5:49 ` Gilles Chanteperdrix
2010-05-19 7:11 ` Jan Kiszka
2010-05-21 8:55 ` Gilles Chanteperdrix
2010-05-27 15:35 ` Wolfgang Mauerer
2010-05-19 19:16 ` Daniele Nicolodi
2010-05-19 20:55 ` 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=4BF28401.6060503@domain.hid \
--to=wolfgang.mauerer@domain.hid \
--cc=AndreasGlatz@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@domain.hid \
--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.