Readmsg and floating priority problem

Hello.

We are using this sequence in our program “A” :

while ( 1 )
{
pid = Receivemx(0,0,NULL);

if (pid != -1)
{
Readmsgmx(pid, 0, rnum, rmux);

// message processing - very fast - just memcpy, no call to Proc or
other processes
}
}

There is the process “A” running on floating priority and processing
messages
from process “B” (prio 10) and “C” (prio 29, above Proc with prio 26).

Process “C” :

  • is trigerred by proxy from interrupt handler invoked by IRQ
  • then it sends some data to process “A”
  • then it writes a value to hw. port to detect “finished” state.
    We are able to measure delay between triggered IRQ and “finished” state.

Process “B” :

  • sends some data to “A” in regular intervals (triggered from timer)

PROBLEM is that process “C” is blocked by process “A” - we detect very long
delays when watching “finished” state flag when we load the system to 100%
by other processes on prio 10.

Problem disappears if we :

  • do not use Readmsgmx and use only Receivemx. But we faced some problems
    with Receivemx (corrupted messages) so we use Receivemx(0,0,NULL) and then
    Readmsg. It looks like Readmsg is blocking for long time if system is
    overloaded.
  • or change process “A” to fixed high priority, but then priority stealing
    appears (process “B”).

We use QNX 4.25 patchE

That makes sense!
If B sends to A, A is processing the request from B. For this time A is not
in RCVD state and can’t process the request from C.
For this reason C is SNDBLK on A. The prio boost of A does NOT prevent a
prio inversion. It just helps to make things better.
May you can invert the direction of messaging by triggering a proxy from C
to A and then A fetches the message by a send/reply from C.
Which prio you use for the IRQ proxy?
Why you use a prio 29 for process C?
BTW: I can’t believe that Receivemx() is buggy! It is one of the most used
kernel function.
cheers, Peter

“Marek Malenovsky” <Marek.Malenovsky@aveco.com> schrieb im Newsbeitrag
news:am3v7v$5a3$1@inn.qnx.com

Hello.

We are using this sequence in our program “A” :

while ( 1 )
{
pid = Receivemx(0,0,NULL);

if (pid != -1)
{
Readmsgmx(pid, 0, rnum, rmux);

A Reply() here may change the task scheduling and this is a kernel call.
// message processing - very fast - just memcpy, no call to Proc or
other processes
}
}

There is the process “A” running on floating priority and processing
messages
from process “B” (prio 10) and “C” (prio 29, above Proc with prio 26).

Process “C” :

  • is trigerred by proxy from interrupt handler invoked by IRQ
  • then it sends some data to process “A”
  • then it writes a value to hw. port to detect “finished” state.
    We are able to measure delay between triggered IRQ and “finished” state.

Process “B” :

  • sends some data to “A” in regular intervals (triggered from timer)

PROBLEM is that process “C” is blocked by process “A” - we detect very
long
delays when watching “finished” state flag when we load the system to 100%
by other processes on prio 10.

Problem disappears if we :

  • do not use Readmsgmx and use only Receivemx. But we faced some
    problems
    with Receivemx (corrupted messages) so we use Receivemx(0,0,NULL) and then
    Readmsg. It looks like Readmsg is blocking for long time if system is
    overloaded.
  • or change process “A” to fixed high priority, but then priority
    stealing
    appears (process “B”).

We use QNX 4.25 patchE