All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] Synchronising TSC and periodic timer
Date: Mon, 20 Mar 2006 14:26:16 +0100	[thread overview]
Message-ID: <441EAD78.3030007@domain.hid> (raw)
In-Reply-To: <441E9698.5080506@domain.hid>

Jan Kiszka wrote:
> Philippe Gerum wrote:
> 
>>...
>>The issue that worries me - provided that we bound the adjustment offset
>>to the duration of one tick after some jittery - is that any attempt to
>>get intra-tick precision would lead to a possible discrepancy regarding
>>the elapsed time according to those two different scales, between the
>>actual count of jiffies tracked by the timer ISR on the timekeeper CPU,
>>and the corrected time value returned by rtdm_read_clock. And this
>>discrepancy would last for the total duration of the jitter. E.g., for a
>>100 us period, xnpod_get_time() could return 2 albeit rtdm_read_clock
>>returns 300, instead of 200. Spuriously mixing both units in
>>applications would lead to some funky chaos.
>>
> 
> 
> Trying to pick up this thread again, I just tried to understand your
> concerns, but failed so far to imagine a concrete scenario. Could you
> sketch such a "funky chaotic" situation from the application point of
> view?

Given the description above, just that some skin might return either 
nucleus ticks or corrected timestamps to the applications, which would 
in turn do some arithmetics for converting values they got from the skin 
between both scales internally, and mistakenly use the result while 
assuming that both scales are always in sync. In this situation, and 
during a fraction of the time (i.e. the jitter), both scales might not 
be in sync, and the result would be unusable. This said, this kind of 
issue could be solved by big fat warnings in documentation, explicitely 
saying that conversions between both scales might be meaningless.

And what would prevent us from improving the accuracy of other
> timestamping API functions beyond RTDM as well, e.g. on converting from
> ticks to nanos in rt_timer_ticks2ns()?
>

I don't understand why rt_timer_ticks2ns() should be impacted by such 
extension. This service must keep a constant behaviour, regardless of 
any outstanding timing issue. I mean, 3 ticks from a 1Khz clock rate 
must always return 3,000,000 nanos, unless you stop passing count of 
ticks but fractional/compound values instead.

The bottom-line is that we should not blur the line between periodic and 
aperiodic timing modes, just for getting precise timestamps in the 
former case. Additionally, and x86-wise, when no TSC is available on the 
target system, rt_timer_tsc() already returns a timestamp obtained from 
the 8254's channel #2 we use as a free running counter, which is the 
most precise source we have at hand to do so.

Periodic mode bears its own limitation, which is basically a loss of 
accuracy we trade against a lower overhead (even if that does not mean 
much except perhaps on x86). What we could do is reducing the jittery 
involved in periodic ticks, by always emulating periodic mode over 
aperiodic shots instead of using e.g. the 8254 in PIT mode (and remove 
the need for the double scale on x86, tsc + 8254 channel #1), but not 
change the basic meaning of periodic timing.

But maybe we are still discussing different issues actually, so it would 
be useful that the core issue that triggered the discussion about 
periodic mode precision be exposed again.


-- 

Philippe.


  reply	other threads:[~2006-03-20 13:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-14 20:45 [Xenomai-core] Synchronising TSC and periodic timer Jan Kiszka
2006-03-15  7:24 ` Jan Kiszka
     [not found]   ` <4417C74D.3060203@domain.hid>
2006-03-15  8:14     ` Jan Kiszka
2006-03-15 12:59   ` Philippe Gerum
2006-03-15 13:26     ` Gilles Chanteperdrix
2006-03-15 22:58       ` Philippe Gerum
2006-03-20 11:48         ` Jan Kiszka
2006-03-20 13:26           ` Philippe Gerum [this message]
2006-03-20 14:42             ` Rodrigo Rosenfeld Rosas
2006-03-20 16:51               ` Philippe Gerum
2006-03-20 19:27                 ` Rodrigo Rosenfeld Rosas
2006-03-21  0:11                   ` Jan Kiszka
2006-03-21  3:11                     ` Rodrigo Rosenfeld Rosas
2006-03-20 14:46             ` Jan Kiszka
2006-03-21 12:44               ` Philippe Gerum
2006-03-24 13:14                 ` Jan Kiszka
     [not found]             ` <200603201137.12548.rosenfeld@domain.hid>
2006-03-20 15:23               ` Philippe Gerum
2006-03-20 19:01                 ` Rodrigo Rosenfeld Rosas
2006-03-21 17:57                   ` Philippe Gerum
2006-03-15 13:34   ` Gilles Chanteperdrix
2006-03-15 16:50     ` Jan Kiszka
2006-03-16 15:26       ` Gilles Chanteperdrix
2006-03-17  1:16         ` Jan Kiszka
     [not found] <1CFEB358338412458B21FAA0D78FE86D02CABF1C@rennsmail02.eu.thmulti.com>
2006-03-15 17:20 ` Jan Kiszka

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=441EAD78.3030007@domain.hid \
    --to=rpm@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.