All of lore.kernel.org
 help / color / mirror / Atom feed
From: ZIV-Alberto Ozalla Cantabrana <alberto.ozalla@cgglobal.com>
To: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: [Xenomai] rt_task_sleep_until() miss release point?
Date: Thu, 6 Nov 2014 15:24:08 +0000	[thread overview]
Message-ID: <545B9297.2090003@cgglobal.com> (raw)

Hi all,

enclosed you will find two examples:

  *   rt_task_sleep_until() missing release point, and
  *   rt_task_sleep_until() working fine.

In the first example:

Current time: t1=4205571 ms - Calculated next release point: t2= 4205572 ms
Real release: t3=4205574 ms

Many Thanks
Alberto Ozalla

Simplest example that shows the issue:
________________________________
static RT_TASK Test_Task_descriptor;

static void Test_Task(void *arg)
{
    RTIME t1, t2;
    rt_task_set_mode(0, 0, NULL);

    while(1) {

        t1 = rt_timer_tsc();
        t2 = t1 + 24000;        // 24000 tsc = 1 ms

        cu_log(CU_LOG_ERR, "t1(%lld)-t2(%lld)", rt_timer_tsc2ns(t1), rt_timer_tsc2ns(t2));
        rt_task_sleep_until(rt_timer_tsc2ns(t2));
        cu_log(CU_LOG_ERR, "t3(%lld)", rt_timer_tsc2ns(rt_timer_tsc()));
    }
}

void main(void)
{
    ...
    // Real-time function creation.
       if (int err = rt_task_create(&Test_Task_descriptor, "Test_Task", 0, 79, 0)) {
             cu_log(CU_LOG_ERR, "Error creating Test_Task (%d)", err);
         }

     // Real-time function started.
       if(rt_task_start(&Test_Task_descriptor, &Test_Task, NULL)) {
             cu_log(CU_LOG_ERR, "Error starting Test_Task");
       }
     ...
}

Log traces:

t1(4205571256580)-t2(4205572256580) ns
t3(4205574861288)
t1(4205575085163)-t2(4205576 085163)
t3(4205578686872)
t1(4205578899038)-t2(4205579 899038)
t3(4205582499538)
t1(4205582839455)-t2(4205583 839455)
t3(4205586444497)
t1(4205586669455)-t2(4205587 669455)
t3(4205590273872)
________________________________
Additional data:

Xenomai 2.6.4
Linux version 3.14.17 (gcc version 4.7.3 (GCC) )
#1 SMP 20<6>kernel: [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
2000/01/03,02:42:00  kern.info kernel: [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
2000/01/03,02:42:00  kern.info kernel: [    0.000000] Machine model: TI AM335x BeagleBone
2000/01/03,02:42:00  kern.info kernel: [    0.000000] CPU: All CPU(s) started in SVC mode.
2000/01/03,02:42:00  kern.info kernel: [    0.000000] AM335X ES2.1 (sgx neon )
________________________________
In the other hand, this example works fine:

static void Test_Task(void *arg)
{
    rt_task_set_mode(0, 0, NULL);

    RTIME t1, t2;

    while(1) {
        t1 = rt_timer_read();
        t2 = t1 + 1000000;        //  1 ms

        cu_log(CU_LOG_ERR, "t1(%lld)-t2(%lld)", t1, t2);
        rt_task_sleep_until(t2);
        cu_log(CU_LOG_ERR, "t3(%lld)", rt_timer_read());
    }
}

t1(564272 373824)-t2(564273 373824)
t3(564273 387783)
________________________________
Many Thanks
Alberto Ozalla

CG DISCLAIMER: This email contains confidential information. It is intended exclusively for the addressees. If you are not an addressee, you must not store, transmit or disclose its contents. Instead please notify the sender immediately; and permanently delete this e-mail from your computer systems. We have taken reasonable precautions to ensure that no viruses are present. However, you must check this email and the attachments, for viruses. We accept no liability whatsoever, for any detriment caused by any transmitted virus.

             reply	other threads:[~2014-11-06 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 15:24 ZIV-Alberto Ozalla Cantabrana [this message]
2014-11-06 15:37 ` [Xenomai] rt_task_sleep_until() miss release point? 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
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=545B9297.2090003@cgglobal.com \
    --to=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.