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) 


_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to