All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Will Linux kernel lose timer ticks when RT thread is running
@ 2006-04-19 18:20 Li Yi (Adam)
  2006-04-20  8:08 ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Li Yi (Adam) @ 2006-04-19 18:20 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 2788 bytes --]

 Hi,

When a real-time thread is running, the Linux kernel will lose Timer Tick
(and lose timer interrupts), is this the expected behavior?
If yes, in this case,  no interrupts will be passed to Linux domain? This
may cause some services depending on timing in Linux domain do not work
correctly. In another thread I read:

"
I do not know if it is what you mean, but when running Xenomai, your
tasks are supposed to suspend sufficiently frequently to leave Linux
tick normally. This means that if you configured CONFIG_HZ=100, your
real-time activity (including kernel-space tasks and user-space tasks in
primary mode) is supposed to take a break at least once every 1/100
second.
--
                                           Gilles Chanteperdrix.
"
Is this the best solution? Since there may be possibility that a real-time
thread keep running for severl hundred ms (e.g, processing large block of
data).


I tried to run a test on Xenomai-2.1.0 on Blackfin. This test looks like:

In a user space RT task (created with rt_task_create()), it does:

"
    read_proc(); // Read "/proc/interrupts" and "/proc/uptime"

    for(;;)
    {

        fprintf(stderr, "+++++++++ start test +++++++++++++++\n");
        read_proc();
        fprintf(stderr, "-------- sleep for 2 sec-----\n");
        sleep(2);
        fprintf(stderr, "-------- start spin ---------\n");
        start_tsc = rt_timer_tsc();

        for (cnt = 0; cnt < 6000; cnt++)
                rt_timer_spin(1000000); // in ns

        diff = rt_timer_tsc() - start_tsc;
        fprintf(stderr, "spin for %d msec\n", rt_timer_tsc2ns(diff) /
1000000);
        read_proc();
        fprintf(stderr, "+++++++++ end test +++++++++++++++++\n");

        getchar();
    }
"

The thread calls rt_timer_spin(), which calls instruction "R0 = 0 (X)"
repeatedly until the specified time is reached. In this case, the thread
spins for 6 seconds.

Here is the test result:

+++++++++ start test +++++++++++++++
-----------------
14:          0   rtc
21:          0   BFIN_UART_RX
22:       5182   BFIN_UART_TX
23:      33531   BFIN Timer Tick
27:       1165   eth0
30:          1   timer_latency
Err:          0

335.41 0.31
-----------------
-------- sleep for 2 sec-----
-------- start spin ---------
spin for 6025 msec
-----------------
14:          0   rtc
21:          0   BFIN_UART_RX
22:       5385   BFIN_UART_TX
23:      33732   BFIN Timer Tick
27:       1165   eth0
30:          1   timer_latency
Err:          0

337.42 0.31
-----------------
+++++++++ end test +++++++++++++++++

>From the test result, " 23:  BFIN Timer Tick", changed from "33531" to
"33732", that is "201 * 10 = 2010 ms". And the "up time" is changed
from "335.41 to 337.42", although in fact that "2 + 6 = 8 sec" has
passed.


Thanks,

-Li Yi (Adam)

[-- Attachment #2: Type: text/html, Size: 5471 bytes --]

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

end of thread, other threads:[~2006-04-20 13:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-19 18:20 [Xenomai-help] Will Linux kernel lose timer ticks when RT thread is running Li Yi (Adam)
2006-04-20  8:08 ` Philippe Gerum
2006-04-20  8:19   ` Philippe Gerum
2006-04-20 11:05     ` Li Yi
2006-04-20 12:46       ` Philippe Gerum
2006-04-20 13:43         ` adam li

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.