All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] rt_task_sleep_until() miss release point?
@ 2014-11-06 15:24 ZIV-Alberto Ozalla Cantabrana
  2014-11-06 15:37 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 9+ messages in thread
From: ZIV-Alberto Ozalla Cantabrana @ 2014-11-06 15:24 UTC (permalink / raw)
  To: xenomai

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-07  9:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2014-11-07  9:42         ` Philippe Gerum

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.