All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: ZIV-Alberto Ozalla Cantabrana <alberto.ozalla@cgglobal.com>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] rt_task_sleep_until() miss release point?
Date: Fri, 7 Nov 2014 10:37:39 +0100	[thread overview]
Message-ID: <20141107093739.GC6724@sisyphus.hd.free.fr> (raw)
In-Reply-To: <545C9001.7070508@cgglobal.com>

On Fri, Nov 07, 2014 at 09:25:21AM +0000, ZIV-Alberto Ozalla Cantabrana wrote:
> 
> On 06/11/14 21:22, Philippe Gerum wrote:
> > On 11/06/2014 05:46 PM, ZIV-Alberto Ozalla Cantabrana wrote:
> >> Hi,
> >>
> >> These are the simplest examples:
> >> There are no MSW for Test_Task.
> >> The goal is to increment counter_ms each millisecond.
> >>
> >> Given that:
> >> 1000000 nanoseconds = 24000 tsc.
> >> 1 tsc = 41 ns
> >>
> > Is rt_timer_ns2tsc(1000000) actually returning 24000 on your platform?
> > Yes.
> >> void Test_Task(void *arg)
> >> {
> >>     rt_task_set_mode(0, 0, NULL);
> > This is useless and not recommended. A newly created task always starts
> > in primary mode.
> >
> > Ok. I will delete it.
> >>      while (1) {
> >>
> >>              unsigned long long before = counter_ms;
> >>              usleep(1000000);    // 1 second.
> > Although this would rather cause higher count values, this non-rt main
> > using a non-rt sleep service won't give you an accurate delay for the
> > measurement.
> >
> > It is only an example.

The problem is that so far, you have not been able to provide a
correct example which provides a proof of what you are saying. It
does not mean that what you say is wrong, just that we have reasons
to doubt it.

Anyway, I do not think you can assume that
rt_timer_tsc2ns(rt_timer_tsc()) is the same thing as
rt_timer_read(), I would say the first is equivalent to POSIX
CLOCK_MONOTONIC whereas the second is equivalent to CLOCK_REALTIME,
so, there is an offset between the two.

What rt_task_sleep_until expects, is what rt_timer_read() returns

To check that, right after the call to rt_task_sleep_until, call
rt_timer_read (and not rt_timer_tsc), and see if it is near t2. You
can use rt_printf in a real-time task to avoid switches to secondary
mode.

Also, are you running the native skin timer in periodic or aperiodic
mode?

-- 
					    Gilles.


  reply	other threads:[~2014-11-07  9:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 15:24 [Xenomai] rt_task_sleep_until() miss release point? ZIV-Alberto Ozalla Cantabrana
2014-11-06 15:37 ` Gilles Chanteperdrix
2014-11-06 15:52   ` ZIV-Alberto Ozalla Cantabrana
2014-11-06 15:55     ` Gilles Chanteperdrix
2014-11-06 16:46       ` ZIV-Alberto Ozalla Cantabrana
2014-11-06 20:22         ` Philippe Gerum
2014-11-07  9:25           ` ZIV-Alberto Ozalla Cantabrana
2014-11-07  9:37             ` Gilles Chanteperdrix [this message]
2014-11-07  9:42         ` 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=20141107093739.GC6724@sisyphus.hd.free.fr \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=alberto.ozalla@cgglobal.com \
    --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.