non-blocking rt_task_suspend(NULL)
Quoted 53 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]>
Quoted 42 lines · Petr Cervenka
Quoted 37 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/16/2014 02:22 PM, Petr
Quoted 23 lines · Cervenka
Quoted 19 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/15/2014 02:42 PM,
Quoted 6 lines · Petr Cervenka
Hello I have a problem with the
rt_task_suspend(NULL)call. I'm using it for synchronization of two (producer / consumer like) tasks. 1) When the consumer task has no work to do, it stops itself by calling of thert_task_suspend(NULL). 2) When the producer creates new work for consumer, it wakes it up by calling ofrt_task_resume(&consumerTask). The problem is,Quoted 8 lines
that consumer seldom switches to a state, that it sleeps by
rt_task_suspendno more. And the task then takes all the CPU time. The return code is 0. But I already have seen couple of -4 (-EINTR) values in the past also. Consumer task status was 00300380 before and 00300184 (if there is small safety sleep present). I can use for exampleRT_EVENTvariable instead, but I'm curious if you by chance don't know, what is happening? Xenomai 2.6.3, Linux 3.5.7Quoted 3 lines
Could you post the example of code you are using to get this issue?
Quoted 9 lines
It's and application with many threads, mutexes and others. It's also special measuring HW dependent. I can post here some simplified example. But I don't think it would be possible to reproduce the same behavior easily. It happens in my configuration only probably once per day and very unpredictably. But I have more details. I replaced
rt_task_suspend/rt_task_resumebyrt_event_wait/rt_event_signal. It failed similar way, but this time the result of wait was -4 (-EINTR). And (after several millions of invocations) it recovered itself.Quoted 5 lines
-EINTRis a valid return value for bothrt_event_waitandrt_task_suspend. In case you get this error, you should loop to callrt_event_waitagain, and not callrt_event_clear, as you risk clearing an event which has been signaled afterwards.Quoted 6 lines
You are right. It was just very quick replace of waiting and waking-up functions. But I'm checking the "work queue" anyway and it also doesn't need exact timing here. My problem it that the slow consumer task seems to be "interrupted by signal" (or whatever) for several minutes. I mean, that it doesn't wait for the event anymore and it always returns immediately (with
-EINTRreturn code).
Quoted 3 lines
Are you running inside gdb? Does the task receive the SIGDEBUG signal? Do you have the XNWARNSW bit armed?
gdb: No.
SIGDEBUG, XNWARNSW: I don't even know what it is ;-).
Quoted 7 lines
Quoted 4 lines
I also
already got one such situation half an hour ago. But the return code was 0 that time. Could you give me some advice what to check when such situation happens again?Well the task status should help.
Normaly the task status is (from /proc/xenomai/stat): 00300182.
(XNFPU | XNSHADOW| XNMAPPED | XNSTARTED | XNPEND - waiting for an event)
Task status from the last issue (from /proc/xenomai/stat) was 00300380.
(XNFPU | XNSHADOW| XNRELAX | XNMAPPED | XNSTARTED)
CPU load of the task was 23% (and more than 4mil. MSW/CSW). Perhaps sending of UDP packets (used for debugging) caused some sleep and prevented the computer from total freeze.
After next issue I will have more precise information from rt_task_inquire.
Petr
Quoted 53 lines · Petr Cervenka
Quoted 53 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]>
Quoted 48 lines · Petr Cervenka
Quoted 37 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/16/2014 02:22 PM, Petr
Quoted 23 lines · Cervenka
Quoted 19 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/15/2014 02:42 PM,
Quoted 6 lines · Petr Cervenka
Hello I have a problem with the
rt_task_suspend(NULL)call. I'm using it for synchronization of two (producer / consumer like) tasks. 1) When the consumer task has no work to do, it stops itself by calling of thert_task_suspend(NULL). 2) When the producer creates new work for consumer, it wakes it up by calling ofrt_task_resume(&consumerTask). The problem is,Quoted 8 lines
that consumer seldom switches to a state, that it sleeps by
rt_task_suspendno more. And the task then takes all the CPU time. The return code is 0. But I already have seen couple of -4 (-EINTR) values in the past also. Consumer task status was 00300380 before and 00300184 (if there is small safety sleep present). I can use for exampleRT_EVENTvariable instead, but I'm curious if you by chance don't know, what is happening? Xenomai 2.6.3, Linux 3.5.7Quoted 3 lines
Could you post the example of code you are using to get this issue?
Quoted 9 lines
It's and application with many threads, mutexes and others. It's also special measuring HW dependent. I can post here some simplified example. But I don't think it would be possible to reproduce the same behavior easily. It happens in my configuration only probably once per day and very unpredictably. But I have more details. I replaced
rt_task_suspend/rt_task_resumebyrt_event_wait/rt_event_signal. It failed similar way, but this time the result of wait was -4 (-EINTR). And (after several millions of invocations) it recovered itself.Quoted 5 lines
-EINTRis a valid return value for bothrt_event_waitandrt_task_suspend. In case you get this error, you should loop to callrt_event_waitagain, and not callrt_event_clear, as you risk clearing an event which has been signaled afterwards.You are right. It was just very quick replace of waiting and waking-up functions. But I'm checking the "work queue" anyway and it also doesn't need exact timing here. My problem it that the slow consumer task seems to be "interrupted by signal" (or whatever) for several minutes. I mean, that it doesn't wait for the event anymore and it always returns immediately (with
-EINTRreturn code).
Quoted 6 lines
Quoted 3 lines
Are you running inside gdb? Does the task receive the SIGDEBUG signal? Do you have the XNWARNSW bit armed?
gdb: No.
SIGDEBUG, XNWARNSW: I don't even know what it is ;-).
See examples/native/sigdebug.c in xenomai sources. Try installing the same signal handler in your application to be notified upon reception of this signal.
Signature · 1 line
Gilles.
Quoted 61 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]>
Quoted 57 lines · Petr Cervenka
Quoted 56 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]>
Quoted 42 lines · Petr Cervenka
Quoted 37 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/16/2014 02:22 PM, Petr
Quoted 23 lines · Cervenka
Quoted 19 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/15/2014 02:42 PM,
Quoted 6 lines · Petr Cervenka
Hello I have a problem with the
rt_task_suspend(NULL)call. I'm using it for synchronization of two (producer / consumer like) tasks. 1) When the consumer task has no work to do, it stops itself by calling of thert_task_suspend(NULL). 2) When the producer creates new work for consumer, it wakes it up by calling ofrt_task_resume(&consumerTask). The problem is,Quoted 8 lines
that consumer seldom switches to a state, that it sleeps by
rt_task_suspendno more. And the task then takes all the CPU time. The return code is 0. But I already have seen couple of -4 (-EINTR) values in the past also. Consumer task status was 00300380 before and 00300184 (if there is small safety sleep present). I can use for exampleRT_EVENTvariable instead, but I'm curious if you by chance don't know, what is happening? Xenomai 2.6.3, Linux 3.5.7Quoted 3 lines
Could you post the example of code you are using to get this issue?
Quoted 9 lines
It's and application with many threads, mutexes and others. It's also special measuring HW dependent. I can post here some simplified example. But I don't think it would be possible to reproduce the same behavior easily. It happens in my configuration only probably once per day and very unpredictably. But I have more details. I replaced
rt_task_suspend/rt_task_resumebyrt_event_wait/rt_event_signal. It failed similar way, but this time the result of wait was -4 (-EINTR). And (after several millions of invocations) it recovered itself.Quoted 5 lines
-EINTRis a valid return value for bothrt_event_waitandrt_task_suspend. In case you get this error, you should loop to callrt_event_waitagain, and not callrt_event_clear, as you risk clearing an event which has been signaled afterwards.Quoted 6 lines
You are right. It was just very quick replace of waiting and waking-up functions. But I'm checking the "work queue" anyway and it also doesn't need exact timing here. My problem it that the slow consumer task seems to be "interrupted by signal" (or whatever) for several minutes. I mean, that it doesn't wait for the event anymore and it always returns immediately (with
-EINTRreturn code).Are you running inside gdb? Does the task receive the SIGDEBUG signal? Do you have the XNWARNSW bit armed?
Quoted 7 lines
Quoted 2 lines
gdb: No.
SIGDEBUG, XNWARNSW: I don't even know what it is ;-).See
examples/native/sigdebug.cin xenomai sources. Try installing the same signal handler in your application to be notified upon reception of this signal.
SIGDEBUG signal was not received.
Task status from rt_task_inquire() was 0x300180 or 0x300380 (depends where it is placed)
When the task is in the "wrong" state, also the call of rt_task_sleep(100000) is returning permanently -EINTR code. Do you have any other idea what to check or what can cause perhaps every xenomai call fail with -EINTR in one task?
Petr
Quoted 76 lines · Petr Cervenka
Quoted 70 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/16/2014 06:02 PM, Petr
Quoted 66 lines · Cervenka
Quoted 65 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]> On 04/16/2014 04:20 PM,
Quoted 50 lines · Petr Cervenka
Quoted 44 lines
Od: Gilles Chanteperdrix
<[email protected]>CC: "Xenomai" <[email protected]> On 04/16/2014 02:22 PM,
Quoted 27 lines · Petr Cervenka
Quoted 23 lines
Od: Gilles Chanteperdrix
<[email protected]>CC: "Xenomai" <[email protected]> On 04/15/2014 02:42
Quoted 9 lines · Petr Cervenka
Hello I have a problem with the
rt_task_suspend(NULL)call. I'm using it for synchronization of two (producer / consumer like) tasks. 1) When the consumer task has no work to do, it stops itself by calling of thert_task_suspend(NULL). 2) When the producer creates new work for consumer, it wakes it up by calling ofrt_task_resume(&consumerTask). The problem is, that consumer seldom switches to a state, that it sleeps byrt_task_suspendno more. And theQuoted 8 lines
task then takes all the CPU time. The return code is
0. But I already have seen couple of -4 (-EINTR) values in the past also. Consumer task status was 00300380 before and 00300184 (if there is small safety sleep present). I can use for exampleRT_EVENTvariable instead, but I'm curious if you by chance don't know, what is happening? Xenomai 2.6.3, Linux 3.5.7Quoted 3 lines
Could you post the example of code you are using to get this issue?
Quoted 11 lines
It's and application with many threads, mutexes and others. It's also special measuring HW dependent. I can post here some simplified example. But I don't think it would be possible to reproduce the same behavior easily. It happens in my configuration only probably once per day and very unpredictably. But I have more details. I replaced
rt_task_suspend/rt_task_resumebyrt_event_wait/rt_event_signal. It failed similar way, but this time the result of wait was -4 (-EINTR). And (after several millions of invocations) it recovered itself.Quoted 6 lines
-EINTRis a valid return value for bothrt_event_waitandrt_task_suspend. In case you get this error, you should loop to callrt_event_waitagain, and not callrt_event_clear, as you risk clearing an event which has been signaled afterwards.Quoted 7 lines
You are right. It was just very quick replace of waiting and waking-up functions. But I'm checking the "work queue" anyway and it also doesn't need exact timing here. My problem it that the slow consumer task seems to be "interrupted by signal" (or whatever) for several minutes. I mean, that it doesn't wait for the event anymore and it always returns immediately (with
-EINTRreturn code).Are you running inside gdb? Does the task receive the SIGDEBUG signal? Do you have the XNWARNSW bit armed?
Quoted 6 lines
Quoted 1 line
gdb: No. SIGDEBUG, XNWARNSW: I don't even know what it is ;-).
See
examples/native/sigdebug.cin xenomai sources. Try installing the same signal handler in your application to be notified upon reception of this signal.
Quoted 6 lines
SIGDEBUG signal was not received. Task status from
rt_task_inquire()was0x300180or0x300380(depends where it is placed) When the task is in the "wrong" state, also the call ofrt_task_sleep(100000)is returning permanently-EINTRcode. Do you have any other idea what to check or what can cause perhaps every xenomai call fail with-EINTRin one task?
If I had to debug this issue, I would enable the I-pipe tracer and trigger a trace freeze when the -EINTR code is received. With enough trace points, it should be possible to understand what happens.
Signature · 1 line
Gilles.
Quoted 11 lines
Od: Gilles Chanteperdrix <[email protected]>
Quoted 6 lines
SIGDEBUG signal was not received. Task status from
rt_task_inquire()was0x300180or0x300380(depends where it is placed) When the task is in the "wrong" state, also the call ofrt_task_sleep(100000)is returning permanently-EINTRcode. Do you have any other idea what to check or what can cause perhaps every xenomai call fail with-EINTRin one task?If I had to debug this issue, I would enable the I-pipe tracer and trigger a trace freeze when the
-EINTRcode is received. With enough trace points, it should be possible to understand what happens.
I called a xntrace_user_freeze() immediately when the issue occurs, but I simply don't understand what is happening there. The trace output is in the attachment. Could you please help me to understand it?
I also got some minor problem with xntrace_user_freeze, because the linker was not able to find it:
asyncwriter.cpp:(.text+0x843): undefined reference to `xntrace_user_freeze(unsigned long, int)'
It is defined in src/skins/common/trace.c and (should be) contained in libxenomai.so. But I was not successful and I had to define it myself (under different name). Version of xenomai is 2.6.3.
Petr
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: freeze1.txt
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20140424/09c18c23/attachment.txt>
Quoted 19 lines · Petr Cervenka
Quoted 9 lines
Od: Gilles Chanteperdrix <[email protected]>
Quoted 6 lines
SIGDEBUG signal was not received. Task status from
rt_task_inquire()was0x300180or0x300380(depends where it is placed) When the task is in the "wrong" state, also the call ofrt_task_sleep(100000)is returning permanently-EINTRcode. Do you have any other idea what to check or what can cause perhaps every xenomai call fail with-EINTRin one task?Quoted 5 lines
If I had to debug this issue, I would enable the I-pipe tracer and trigger a trace freeze when the
-EINTRcode is received. With enough trace points, it should be possible to understand what happens.I called a
xntrace_user_freeze()immediately when the issue occurs, but I simply don't understand what is happening there. The trace output is in the attachment. Could you please help me to understand it?
Quoted 6 lines
I also got some minor problem with
xntrace_user_freeze, because the linker was not able to find it: asyncwriter.cpp:(.text+0x843):
undefined reference to `xntrace_user_freeze(unsigned long, int)' It is defined insrc/skins/common/trace.cand (should be) contained in libxenomai.so. But I was not successful and I had to define it myself (under different name). Version of xenomai is 2.6.3.
We see that xnpod_suspend_thread returns immediately, likely because it has the XNKICKED bit set. Could you add more back trace points? So that we see what is setting the XNKICKED bit?
Signature · 1 line
Gilles.
Quoted 24 lines
Od: Gilles Chanteperdrix <[email protected]>
CC: "Xenomai" <[email protected]>
Quoted 19 lines · Petr Cervenka
Quoted 9 lines
Od: Gilles Chanteperdrix <[email protected]>
Quoted 6 lines
SIGDEBUG signal was not received. Task status from
rt_task_inquire()was0x300180or0x300380(depends where it is placed) When the task is in the "wrong" state, also the call ofrt_task_sleep(100000)is returning permanently-EINTRcode. Do you have any other idea what to check or what can cause perhaps every xenomai call fail with-EINTRin one task?Quoted 5 lines
If I had to debug this issue, I would enable the I-pipe tracer and trigger a trace freeze when the
-EINTRcode is received. With enough trace points, it should be possible to understand what happens.I called a
xntrace_user_freeze()immediately when the issue occurs, but I simply don't understand what is happening there. The trace output is in the attachment. Could you please help me to understand it?
Quoted 9 lines
Quoted 6 lines
I also got some minor problem with
xntrace_user_freeze, because the linker was not able to find it: asyncwriter.cpp:(.text+0x843):
undefined reference to `xntrace_user_freeze(unsigned long, int)' It is defined insrc/skins/common/trace.cand (should be) contained in libxenomai.so. But I was not successful and I had to define it myself (under different name). Version of xenomai is 2.6.3.We see that
xnpod_suspend_threadreturns immediately, likely because it has the XNKICKED bit set. Could you add more back trace points? So that we see what is setting the XNKICKED bit?
I have added (maybe too much) back trace points. But as last time, I'm not able to see (almost) anything in it ;-) Previous xnpod_suspend_thread (on line 3713, probably caused by rt_mutex_aquire) seems to be fine (for me;-) ).
Petr
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: freeze7.txt
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20140425/4288c679/attachment.txt>