<div dir="ltr"><div dir="ltr">Hi,<div>This is the result of task command in shell after SCrx task gets stuck</div><div><br><div><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] # task</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">
ID
NAME PRI
STATE MODES EVENTS WAITID WAITARG
NOTES</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="IT">------------------------------------------------------------------------------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="IT">0a010001
UI1
1 Wevnt P:T:nA NONE 2002a77c 0x80673a3</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="IT">0a010002
LOGT 99
Wmsg P:T:nA NONE 22010001 0x80673a3</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="IT">0a010003
ntwk 100 Wsysev
P:T:nA NONE 2005d8a4 0x80673a3</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="IT">0a010004
SCtx 100 Wsysev
P:T:nA NONE 2005ed0c 0x80673a3</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><b>0a010005
SCrx 100
READY P:T:nA 08000000 2005fd1c 0x80673a3</b></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0a010006
SHLL 100
READY P:T:nA NONE fef90700 0x80673a3</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] #</span></p></div><div><br></div><div>SCrx is ready and my USB event is set (<span style="font-family:Calibri,sans-serif;font-size:14.6667px">08000000</span>); still, SCrx doesn't get CPU time.</div><div>Here is the result of cpuuse at two different times</div><div><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] #
cpuuse</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">-------------------------------------------------------------------------------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">
CPU USAGE BY THREAD</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">------------+----------------------------------------+---------------+---------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">ID
|
NAME
| SECONDS | PERCENT</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">------------+----------------------------------------+---------------+---------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x09010001
|
IDLE
| 9218.757029 | 99.562</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010001
|
UI1
| 1.067066 | 0.011</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010002
|
LOGT
| 0.000015 | 0.000</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010003
|
ntwk
| 0.639828 | 0.006</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010004
|
SCtx
| 0.199488 | 0.002</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><b>0x0a010005
|
SCrx
|
0.138781 | 0.001</b></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><b>0x0a010006
|
SHLL
| 38.550932 | 0.416</b></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">------------+----------------------------------------+---------------+---------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">TIME SINCE
LAST CPU USAGE RESET IN
SECONDS:
9259.353153</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">-------------------------------------------------------------------------------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] #</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] #</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] #</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">[/] #
cpuuse</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">-------------------------------------------------------------------------------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">
CPU USAGE BY THREAD</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">------------+----------------------------------------+---------------+---------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">ID
|
NAME
| SECONDS | PERCENT</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">------------+----------------------------------------+---------------+---------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x09010001
|
IDLE
| 9223.354634 | 99.560</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010001
|
UI1
| 1.067066 | 0.011</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010002
|
LOGT
| 0.000015 | 0.000</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010003
| ntwk
|
0.640091 | 0.006</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">0x0a010004
|
SCtx
| 0.199519 | 0.002</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><b>0x0a010005
|
SCrx
| 0.138781 | 0.001</b></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"><b>0x0a010006
|
SHLL
| 38.674044
| 0.417</b></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">------------+----------------------------------------+---------------+---------</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">TIME SINCE
LAST CPU USAGE RESET IN
SECONDS:
9264.074153</span></p></div><div><br></div><div>As seen, the shell task is getting CPU (<span style="font-family:Calibri,sans-serif;font-size:14.6667px">38.674044 > </span><span style="font-family:Calibri,sans-serif;font-size:14.6667px">38.550932</span>), but SCrx is unchanged (<span style="font-family:Calibri,sans-serif;font-size:14.6667px">0.138781</span>). This is what we know.</div><div><br></div><div>In my debugging sessions I"m verifying different conditions that may change the scheduling policy.</div><div>(<a href="https://docs.rtems.org/releases/rtems-docs-4.11.2/c-user/scheduling_concepts.html">https://docs.rtems.org/releases/rtems-docs-4.11.2/c-user/scheduling_concepts.html</a>, section 5.3)<br></div><div><b>I think it's not caused by priority because I changed it from 100 to 98 for SCrx and then to 105 and I could reproduce the issue.</b></div><div><br></div><div>Also I checked if another task has preemption disabled and that's why my task doesn't run, but it's not happening here.</div><div>Also I checked CPU budget allocation, but that's not the cause either.</div><div><br></div><div>Maybe I should check the RTEMS dispatcher code, since it's the component responsible for allocating the CPU for a ready task ?</div><div><br></div><div>regards,</div><div>Catalin</div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 19, 2018 at 5:58 AM Mingyu Li <<a href="mailto:lmy2010lmy@gmail.com">lmy2010lmy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Catalin.</div><div dir="ltr"><br></div><div>I find the problem you encountered interesting. I hope to offer some hints that might be helpful to you:</div><div><br></div><div>1. use a user task to first rtems_event_send then rtems_event_receive, in order to make sure the internal IPC of RTEMS kernel you are using (4.11.2) works as expected.</div><div>2. ensure to disable/lock interrupts while operating the message_queue <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">inside USB ISR</span>. Try to check if clock ISR is still responded when USB ISR exits, so that the kernel task can be scheduled to obtain the message.</div><div><br></div><div>Best regards,</div><div>Mingyu</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-09-18 20:20 GMT+08:00 Catalin Demergian <span dir="ltr"><<a href="mailto:demergian@gmail.com" target="_blank">demergian@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello,</div><div>I am using RTEMS 4.11.2 and I tried first to use RTEMS message queues in my USB FS driver.</div><div>I'm populating the queue from the ISR and then use rtems_message_queue_receive from a kernel task to</div><div>read the messages. After some debugging sessions I came to the conlusion that rtems_message_queue_receive function</div><div>hangs even if there are messages in the queue. (manpage says it should return immediately if there is at least one message</div><div>in the queue; in my case the queue gets full, but still the function hangs)</div><div><br></div><div>I tried then rtems_event_receive. I used my own queues and from ISR I only called rtems_event_send; the same issue</div><div>happened again, this time rtems_event_receive hangs even if I see the event was raised (with task command in the shell)</div><div><br></div><div>My question is: are there any known issues/bugs with these functions ? </div><div><br></div><div>thanks,</div><div>Catalin</div></div>
<br>_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br></blockquote></div><br></div>
</blockquote></div>