MPCI not returning memory

Andres Monteverde amonteverde at
Tue Jan 29 19:32:19 UTC 2019

Hi, my name is Andres and the purpose of this mail is to ask about a situation we're dealing with and a possible solution.
We are using rtems 4.10.2 in leon3 (gr712) AMP configuration with a shared memory space of 0x1000 bytes.
Our system consists of two applications. One of them is the owner of a global queue and the other is the consumer with a timeout.
The app running on core 0 sends a message every five seconds and the app running on core 1 receives them with a timeout of one second.
After eigth timeouts, the application running in core 1 stops due an internal error.

Analysing the operations of the OS, we've seen that the internal error is generated by the lack of free shared memory, and it happens inside the function _MPCI_Get_packet().
And we believe that the lack of free memory is because previously timed-out mpci packets are not returned.
The same seems to happen with the proxys allocated in case of time out, their are allocated using _Thread_MP_Allocate_proxy() and are not returned.

If we perform the changes below, the test app runs indefinitely without any error.
Whats your opinion about this?

diff -r basicsw_el1618_rtems_4.10/rtems_4.10/cpukit/rtems/src/msgmp.c original/basicsw_el1618_rtems_4.10/rtems_4.10/cpukit/rtems/src/msgmp.c
<       rtems_status_code result = (rtems_status_code) _MPCI_Send_request_packet(
>       return (rtems_status_code) _MPCI_Send_request_packet(
<       _MPCI_Return_packet(&the_packet->Prefix);
<       return result;
<        break;
>       break;
diff -r basicsw_el1618_rtems_4.10/rtems_4.10/cpukit/score/src/threadqtimeout.c original/basicsw_el1618_rtems_4.10/rtems_4.10/cpukit/score/src/threadqtimeout.c
<         break;
<         break;
>       break;
<         //todo check for critical section
<         the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status;
<         _Thread_queue_Extract_with_proxy(the_thread);
<         _Thread_Unnest_dispatch();
<         break;
>       _Thread_queue_Process_timeout( the_thread );
>       _Thread_Unnest_dispatch();
>       break;

Best Regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list