[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:    be8897644043e4378db7add02c3c9e1ac7fde563
Changeset: http://git.rtems.org/rtems/commit/?id=be8897644043e4378db7add02c3c9e1ac7fde563

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

mpci: Avoid Giant lock

The object creation/deletion is protected by the object allocator lock.

Update #2555.

---

 cpukit/score/src/objectmp.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index d23e6ad..be55fa7 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -91,7 +91,9 @@ void _Objects_MP_Open (
   the_global_object->Object.id = the_id;
   the_global_object->name      = the_name;
 
-  _Chain_Prepend(
+  _Assert( _Objects_Allocator_is_owner() );
+
+  _Chain_Prepend_unprotected(
     &information->global_table[ _Objects_Get_node( the_id ) ],
     &the_global_object->Object.Node
   );
@@ -135,6 +137,8 @@ void _Objects_MP_Close (
   Chain_Node         *the_node;
   Objects_MP_Control *the_object;
 
+  _Assert( _Objects_Allocator_is_owner() );
+
   the_chain = &information->global_table[ _Objects_Get_node( the_id ) ];
 
   for ( the_node = _Chain_First( the_chain ) ;
@@ -145,7 +149,7 @@ void _Objects_MP_Close (
 
     if ( _Objects_Are_ids_equal( the_object->Object.id, the_id ) ) {
 
-      _Chain_Extract( the_node );
+      _Chain_Extract_unprotected( the_node );
       _Objects_MP_Free_global_object( the_object );
       return;
     }
@@ -191,7 +195,7 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search (
     high_node = nodes_to_search;
   }
 
-  _Thread_Disable_dispatch();
+  _Objects_Allocator_lock();
 
   for ( node_index = low_node ; node_index <= high_node ; node_index++ ) {
 
@@ -211,14 +215,14 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search (
 
         if ( the_object->name == name_to_use ) {
           *the_id = the_object->Object.id;
-          _Thread_Enable_dispatch();
+          _Objects_Allocator_unlock();
           return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
         }
       }
     }
   }
 
-  _Thread_Enable_dispatch();
+  _Objects_Allocator_unlock();
   return OBJECTS_INVALID_NAME;
 }
 
@@ -254,7 +258,7 @@ void _Objects_MP_Is_remote (
     return;
   }
 
-  _Thread_Disable_dispatch();
+  _Objects_Allocator_lock();
 
   the_chain = &information->global_table[ node ];
 
@@ -272,7 +276,7 @@ void _Objects_MP_Is_remote (
     }
   }
 
-  _Thread_Enable_dispatch();
+  _Objects_Allocator_unlock();
   *location   = OBJECTS_ERROR;
   *the_object = NULL;
 



More information about the vc mailing list