Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - HAM should stop process that is constantly in ISR and high priority thread: (3 Items)
   
HAM should stop process that is constantly in ISR and high priority thread  
I am using a PowerPC processor with QNX 6.4.0.
I've developed an application that can be set by the user to perform several (high priority) tasks in a cyclic manner.
That means a user can add everytime a new function, that should be performed every x ms, whereby x can be as small as 1.

In an ISR that will be called every 1ms a list of all in that way registered funtions will be iterated over. (Not the 
ISR is iterating over the list, but a thread, that is woken by the ISR via a pulse.) According to the elapsed time 
several functions will be called. (The awoken thread and so the called function is running with a priority of 30, to 
asure the high priority execution of that tasks.)
This is working fine as long as the number of functions is not too high.

If more than let's say 300 functions with a cycle time of 1ms are registered, the process will stay forever in the ISR 
and the high priority thread, since not all functions can be terminated till the next 1ms interrupt occurs. - So my main
 thread that is of course only at priority 10 is never running again. And so are all other processes, as for example io-
pkt-v4, cause no process has a thread with a that high priority.

Although that scenario is not very likely, cause with normal use there will never be as much as 300 functions, I want to
 catch that case with the HAM. I though a normal heartbeat in the main thread and an action that simply kills the 
process if a heartbeat is missed would be enough. (Whereby I pass the following command to ham_action_execute(): "on -d 
-p35 kill %d")
Obviously the kill command isn't executed.  But why is that? Is the priority of the HAM not high enough to run (higher 
than 30)? With the "on -p35" command I want to start the "kill" with priority 35.

Any suggestions how to make the HAM stop that stuck process? 
Re: HAM should stop process that is constantly in ISR and high pr iority thread  
Just out of curiousity what prio is HAM running at. And do you know if the
action is being executed at all. You can run ham with a few additional -vvvv
and see if the action is being executed. Is the spawn of on occurring but
the kill does not occur or does the action not get executed at all. You can
use ham action notify signal instead I think. Can you also post the code
used to attach to the ham along with the output from the verbose running of
ham ?

Thanks
Shiv
Shiv Nagarajan
Kernel developer, QNX Software Systems
Canada

----- Original Message -----
From: Peter Horatschek <community-noreply@qnx.com>
To: osmeta-core_os <post40482@community.qnx.com>
Sent: Thu Oct 22 07:26:20 2009
Subject: HAM should stop process that is constantly in ISR and high priority
thread

I am using a PowerPC processor with QNX 6.4.0.
I've developed an application that can be set by the user to perform several
(high priority) tasks in a cyclic manner.
That means a user can add everytime a new function, that should be performed
every x ms, whereby x can be as small as 1.
In an ISR that will be called every 1ms a list of all in that way registered
funtions will be iterated over. (Not the ISR is iterating over the list, but
a thread, that is woken by the ISR via a pulse.) According to the elapsed
time several functions will be called. (The awoken thread and so the called
function is running with a priority of 30, to asure the high priority
execution of that tasks.)
This is working fine as long as the number of functions is not too high.

If more than let's say 300 functions with a cycle time of 1ms are
registered, the process will stay forever in the ISR and the high priority
thread, since not all functions can be terminated till the next 1ms
interrupt occurs. - So my main thread that is of course only at priority 10
is never running again. And so are all other processes, as for example
io-pkt-v4, cause no process has a thread with a that high priority.

Although that scenario is not very likely, cause with normal use there will
never be as much as 300 functions, I want to catch that case with the HAM. I
though a normal heartbeat in the main thread and an action that simply kills
the process if a heartbeat is missed would be enough. (Whereby I pass the
following command to ham_action_execute(): "on -d -p35 kill %d")
Obviously the kill command isn't executed.  But why is that? Is the priority
of the HAM not high enough to run (higher than 30)? With the "on -p35"
command I want to start the "kill" with priority 35.

Any suggestions how to make the HAM stop that stuck process? 



_______________________________________________

OSMeta
http://community.qnx.com/sf/go/post40482
Re: HAM should stop process that is constantly in ISR and high pr iority thread  
Of course there a two ham processes running. One is just the guardian, running at priority 10. The other is the real ham
 with 6 threads at priority 10 and 2 at priority 255. I don't realy know how the ham is working, so I can't say what 
thread is responsible for starting a new process.

I don't know wether the action or at least the spawn is executed at all. The problem is, I can't contact and analyze the
 QNX OS, cause my only connection to the hardware with the PPC is via qconn. As soon as the descripted situation occurs 
(too many registered functions) my Momentics IDE shows the hardware as no longer connected. This is, I think, cause the 
qconn process is at a too low priority as well. - So I don't have any possibilty to access my hardware. But I know that 
QNX is still running, cause in one of the first registered functions I let flash a LED and it is still flashing, so that
 function is obviously still executed.

All I can say is, that if I don't send the heartbeat by purpose, the termination of the process works fine. So it's no 
problem with the action in general.

I've attached the code I use to attach to the HAM. (Of course there is missing the whole functionality of my process, 
I've just included the HAM parts.)
Attachment: Text watchdog.c 3.95 KB