[rtems commit] mpci: Avoid Giant lock

Sebastian Huber sebh at rtems.org
Mon Mar 21 06:45:31 UTC 2016


Module:    rtems
Branch:    master
Commit:    19e855d745819297ee64f817eff02dac17a20104
Changeset: http://git.rtems.org/rtems/commit/?id=19e855d745819297ee64f817eff02dac17a20104

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Mar 18 15:33:13 2016 +0100

mpci: Avoid Giant lock

Update #2555.

---

 cpukit/score/src/mpci.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index c191bbe..3929d78 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -237,16 +237,19 @@ uint32_t   _MPCI_Send_request_packet (
   uint32_t            timeout_code
 )
 {
-  Thread_Control *executing = _Thread_Executing;
+  Per_CPU_Control *cpu_self;
+  Thread_Control  *executing;
 
-  the_packet->source_tid      = executing->Object.id;
-  the_packet->source_priority = executing->current_priority;
-  the_packet->to_convert =
-     ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
+  cpu_self = _Thread_Dispatch_disable();
+
+    executing = _Per_CPU_Get_executing( cpu_self );
 
-  executing->Wait.id = the_packet->id;
+    the_packet->source_tid      = executing->Object.id;
+    the_packet->source_priority = executing->current_priority;
+    the_packet->to_convert =
+       ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
 
-  _Thread_Disable_dispatch();
+    executing->Wait.id = the_packet->id;
 
     (*_MPCI_table->send_packet)( destination, the_packet );
 
@@ -265,7 +268,7 @@ uint32_t   _MPCI_Send_request_packet (
       timeout_code
     );
 
-  _Thread_Enable_dispatch();
+  _Thread_Dispatch_enable( cpu_self );
 
   return executing->Wait.return_code;
 }




More information about the vc mailing list