Problems with rt_task_create and rt_task_join
A message that is not in the archive (sent off-list or not yet received): 14515395.201295629170328.JavaMail.SYSTEM@PC-MRINALDI
Hi to all,
I'm running an application on a Linux system with kernel 2.6.35.7 patched with Xenomai 2.5.5.2, Adeos ipipe patch 2.7-04.
My application uses native skin and creates some realtime tasks, each with rt_task_shadow(), each other with rt_task_create(). When I call for first time rt_task_create(), this function is very slow (700-800 ms) to execute, also if rt_task_shadow() calls come first. Subsequent calls of rt_task_create() are quick as expected. I read on manual that at first call rt_task_create() creates a signal handler for SIGWINCH signal: could be this operation that wastes time, maybe on waiting some resources from Linx kernel? Another problem that I've encountered is that if I call a rt_int_delete() and then a rt_task_join() on userspace task that handles destroyed IRQ, rt_task_join() never returns (obviously this task was created with joinable flag). If I create this task without joinable flag and then I call rt_task_delete() instead rt_task_join() I obtain two different behaviours: sometimes rt_task_delete() returns but I still view task on /proc/xenomai/sched (with X status), sometimes system freezes on this call. Thanks to all in advance.
Regards
Mauro Salvini
Quoted 6 lines · Michel Rinaldi
Hi to all,
I'm running an application on a Linux system with kernel 2.6.35.7 patched with Xenomai 2.5.5.2, Adeos ipipe patch 2.7-04.
My application uses native skin and creates some realtime tasks, each withrt_task_shadow(), each other withrt_task_create().
Sorry, -ENOPARSE. rt_task_shadow() is usually invoked from the main thread to make it a Xenomai thread, rt_task_create is normally used to create more tasks. Who is doing what in your code exactly? How many times is rt_task_shadow() invoked?
Quoted 6 lines
When I call for first time
rt_task_create(), this function is very
slow (700-800 ms) to execute, also ifrt_task_shadow()calls come first. Subsequent calls ofrt_task_create()are quick as expected. I read on manual that at first callrt_task_create()creates a signal handler for SIGWINCH signal: could be this operation that wastes time, maybe on waiting some resources from Linx kernel?
No, can't be that long. Something looks wrong in your application init.
Quoted 8 lines
Another problem that I've encountered is that if I call a
rt_int_delete()and then art_task_join()on userspace task that handles destroyed IRQ,rt_task_join()never returns (obviously this task was created with joinable flag). If I create this task without joinable flag and then I callrt_task_delete()insteadrt_task_join()I obtain two different behaviours: sometimesrt_task_delete()returns but I still view task on/proc/xenomai/sched(with X status), sometimes system freezes on this call.
Make sure to test the return values of ALL Xenomai syscalls in your app, particularly what rt_intr_wait() sends you back, and make sure to break out from your work loop whenever it signals any error.
Quoted 10 lines
Thanks to all in advance.
RegardsMauro Salvini
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Signature · 1 line
Philippe.
2011/1/21 Philippe Gerum <[email protected]>
Quoted 8 lines · Michel Rinaldi
Quoted 6 lines
Hi to all,
I'm running an application on a Linux system with kernel 2.6.35.7 patched with Xenomai 2.5.5.2, Adeos ipipe patch 2.7-04.
My application uses native skin and creates some realtime tasks, each withrt_task_shadow(), each other withrt_task_create().
Quoted 5 lines
Sorry,
-ENOPARSE.rt_task_shadow()is usually invoked from the main thread to make it a Xenomai thread,rt_task_createis normally used to create more tasks. Who is doing what in your code exactly? How many times isrt_task_shadow()invoked?
I apologize for "tar.gzipped" :-) explanation.
I have one main thread that calls rt_task_shadow() to become a real-time task.
This task creates a pthread that makes itself a real-time thread with rt_task_shadow() call.
Then, latter task creates a new real-time task with rt_task_create(). First rt_task_create() call spends more time, next calls are immediate ( < 1millisecond ).
Quoted 9 lines
Quoted 6 lines
When I call for first time
rt_task_create(), this function is very
slow (700-800 ms) to execute, also ifrt_task_shadow()calls come first. Subsequent calls ofrt_task_create()are quick as expected. I read on manual that at first callrt_task_create()creates a signal handler for SIGWINCH signal: could be this operation that wastes time, maybe on waiting some resources from Linx kernel?No, can't be that long. Something looks wrong in your application init.
I'll do additional checks on my code monday.
Quoted 10 lines
Quoted 9 lines
Another problem that I've encountered is that if I call a
rt_int_delete()and then art_task_join()on userspace task that handles destroyed IRQ,rt_task_join()never returns (obviously this task was created with joinable flag). If I create this task without joinable flag and then I callrt_task_delete()insteadrt_task_join()I obtain two different behaviours: sometimesrt_task_delete()returns but I still view task on/proc/xenomai/sched(with X status), sometimes system freezes on this call.
Quoted 4 lines
Make sure to test the return values of ALL Xenomai syscalls in your app, particularly what
rt_intr_wait()sends you back, and make sure to break out from your work loop whenever it signals any error.
I'll also add additional checks on all Xenomai calls. Thank you very much.
Regards
Mauro Salvini
Quoted 22 lines
Quoted 11 lines
Thanks to all in advance.
RegardsMauro Salvini
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help--
Philippe._______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Quoted 8 lines · Michel Rinaldi
Hi to all,
I'm running an application on a Linux system with kernel 2.6.35.7 patched with Xenomai 2.5.5.2, Adeos ipipe patch 2.7-04. My application uses native skin and creates some realtime tasks, each with
rt_task_shadow(), each other withrt_task_create(). When I call for first timert_task_create(), this function is very slow (700-800 ms)
A reason for the service being so slow the first time it is called may be the on-demand libraries loading. But for this to take a long time, the native skin library would have to be stored on a really slow storage device, or compressed and the processor you are using being a really slow one. Anyway, you do not tell us on what architecture you get this issue? What processor are you using? Where is the library stored?
Signature · 1 line
Gilles.
Quoted 10 lines
A reason for the service being so slow the first time it is called may be the on-demand libraries loading. But for this to take a long time, the native skin library would have to be stored on a really slow storage device, or compressed and the processor you are using being a really slow one. Anyway, you do not tell us on what architecture you get this issue? What processor are you using? Where is the library stored?
Signature · 1 line
Gilles.
Hi to all, and thank you for your support.
First of all, I'm running Xenomai on an Intel Celeron M 600MHz CPU with 512 MB RAM.
This embedded PC has its storage unit onto a 2GB compact flash, connected to motherboard via ATA interface. Xenomai libraries are into default /usr/xenomai path, and seems not compressed.
Linux distro is Ubuntu 10.04. Attached to this message there's my vanilla kernel configuration.
I tried to check all Xenomai calls, they return no errors.rt_intr_wait() call returns -EIDRM only when interrupt object was deleted, no errors otherwise.
I checked /proc/<pid>/maps to see if libraries are loaded correctly, and all seems to be OK.
To deeply explain my software, some Xenomai syscalls are done into shared objects thata are loaded dinamically at runtime with dlopen()-dlclose() calls. Particularly, I launch my application, and at a certain time I dinamically load into my app an external piece of software contained into a shared object. This piece of software creates a rt task with rt_task_shadow() and contains a function that creates an IRQ handler: to do this, latter function calls rt_intr_create(), rt_task_create() and rt_task_start().
Next, I attach to my app another shared object that also creates a rt task with rt_task_shadow().
Then, if I call my function that creates IRQ handler into first loaded object (where function to create IRQ was contained), execution time is quick.
Instead, if I call this function from latter shared object loaded, execution was horribly long (at least 500ms).
These behaviours are independent from the fact that it is or not the first rt_task_create() into application.
Could be this an issue related to dynamic loading?
Another strange behaviour that I observed is that if I create IRQ handling thread not as joinable, if my call sequence is:
rt_intr_delete(&myIntrHandler);rt_task_delete(&myIntrTask);
I still see task into /proc/xenomai/sched (with X state), and rt_printf() strings subsequent to rt_task_delete() that are into same function don't appear. It seems to be that rt_task_delete() call destroys calling task instead target task.
Instead, If sequence call is:
rt_intr_delete(&myIntrHandler);rt_task_sleep(1000000000);rt_task_delete(&myIntrTask);
I don't see at all task into /proc/xenomai/sched, and rt_printf() strings subsequent to rt_task_delete() was printed normally. Note that these calls are done when an object was dinamically unloaded with dlclose().
One more question, on rt_task_join(): manual says that the joined task must have been created by the same process that wants to join it: into this assertion, process means "a task" (then, a PID) or "a process composed by tasks"? I think the former. And if the process that calls rt_task_join() is not the same, could this cause the function doesn't returns?
Finally, if this can help, I also observed these messages into dmesg:
Clocksource tsc unstable (delta = 2636104979 ns)
Switching to clocksource pit
They appears when rt_task_create() is slow.
Thank you in advance for your precious help.
Regards
Mauro
Quoted 55 lines · Michel Rinaldi
Quoted 9 lines
A reason for the service being so slow the first time it is called may be the on-demand libraries loading. But for this to take a long time, the native skin library would have to be stored on a really slow storage device, or compressed and the processor you are using being a really slow one. Anyway, you do not tell us on what architecture you get this issue? What processor are you using? Where is the library stored?
-- Gilles.
Hi to all, and thank you for your support.
First of all, I'm running Xenomai on an Intel Celeron M 600MHz CPU with 512 MB RAM. This embedded PC has its storage unit onto a 2GB compact flash, connected to motherboard via ATA interface. Xenomai libraries are into default
/usr/xenomaipath, and seems not compressed. Linux distro is Ubuntu 10.04. Attached to this message there's my vanilla kernel configuration.I tried to check all Xenomai calls, they return no errors.
rt_intr_wait()call returns-EIDRMonly when interrupt object was deleted, no errors otherwise.I checked /proc/<pid>/maps to see if libraries are loaded correctly, and all seems to be OK.
To deeply explain my software, some Xenomai syscalls are done into shared objects thata are loaded dinamically at runtime with dlopen()-dlclose() calls. Particularly, I launch my application, and at a certain time I dinamically load into my app an external piece of software contained into a shared object. This piece of software creates a rt task with
rt_task_shadow()and contains a function that creates an IRQ handler: to do this, latter function callsrt_intr_create(),rt_task_create()andrt_task_start(). Next, I attach to my app another shared object that also creates a rt task withrt_task_shadow(). Then, if I call my function that creates IRQ handler into first loaded object (where function to create IRQ was contained), execution time is quick. Instead, if I call this function from latter shared object loaded, execution was horribly long (at least 500ms). These behaviours are independent from the fact that it is or not the firstrt_task_create()into application. Could be this an issue related to dynamic loading?Another strange behaviour that I observed is that if I create IRQ handling thread not as joinable, if my call sequence is:
rt_intr_delete(&myIntrHandler);rt_task_delete(&myIntrTask);I still see task into
/proc/xenomai/sched(with X state), andrt_printf()strings subsequent tort_task_delete()that are into same function don't appear. It seems to be thatrt_task_delete()call destroys calling task instead target task.Instead, If sequence call is:
Quoted 7 lines
rt_intr_delete(&myIntrHandler);rt_task_sleep(1000000000);rt_task_delete(&myIntrTask);I don't see at all task into
/proc/xenomai/sched, andrt_printf()strings subsequent tort_task_delete()was printed normally. Note that these calls are done when an object was dinamically unloaded withdlclose().
You explanations are hard to follow and understand, and what is more, ambiguous. Send us a piece of code which allows us to reproduce this issue. Trying to make it as simple as possible. For instance seeing if registering the interrupt causes any difference (if it does not make any difference, then remove it, you get the idea).
As usual, we do not know what version of Xenomai, Adeos, Linux, etc... you are using. See:
http://www.xenomai.org/index.php/Request_for_information
Quoted 7 lines
One more question, on
rt_task_join(): manual says that the joined task must have been created by the same process that wants to join
it: into this assertion, process means "a task" (then, a PID) or "a process composed by tasks"? I think the former. And if the process that callsrt_task_join()is not the same, could this cause the function doesn't returns?
process means process. process has a very precise meaning in the context of posix operating systems, we mean exactly that. Talking about PID is ambiguous, because unfortunately, with past versions of the glibc, different threads belonging to the same process had different PIDs. A task is a thread.
Quoted 4 lines
Finally, if this can help, I also observed these messages into dmesg:
Clocksource tsc unstable (delta = 2636104979 ns) Switching to
clocksource pit They appears whenrt_task_create()is slow.
That is bad. One more question: what happens when you run the "latency" test, do you get strange results? Also, I see that you have the SMI workaround enabled, does it detect your chipset?
Signature · 1 line
Gilles.