From 362722795abb917fb53d8903eae450c78ba43be4 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 8 Apr 2016 16:23:22 +0200 Subject: sapi: Avoid Giant lock for extensions Extension create and delete is protected by the object allocator lock. Update #2555. --- cpukit/sapi/include/rtems/extensionimpl.h | 7 ++----- cpukit/sapi/src/extensiondelete.c | 33 ++++++++++++------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h index e26731cbcc..64ac600520 100644 --- a/cpukit/sapi/include/rtems/extensionimpl.h +++ b/cpukit/sapi/include/rtems/extensionimpl.h @@ -39,13 +39,10 @@ RTEMS_INLINE_ROUTINE void _Extension_Free ( _Objects_Free( &_Extension_Information, &the_extension->Object ); } -RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get ( - Objects_Id id, - Objects_Locations *location -) +RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get( Objects_Id id ) { return (Extension_Control *) - _Objects_Get( &_Extension_Information, id, location ); + _Objects_Get_no_protection( &_Extension_Information, id ); } #ifdef __cplusplus diff --git a/cpukit/sapi/src/extensiondelete.c b/cpukit/sapi/src/extensiondelete.c index f851ea06c2..af2bd83f18 100644 --- a/cpukit/sapi/src/extensiondelete.c +++ b/cpukit/sapi/src/extensiondelete.c @@ -20,35 +20,28 @@ #endif #include -#include #include rtems_status_code rtems_extension_delete( rtems_id id ) { - Extension_Control *the_extension; - Objects_Locations location; + rtems_status_code status; + Extension_Control *the_extension; _Objects_Allocator_lock(); - the_extension = _Extension_Get( id, &location ); - switch ( location ) { - case OBJECTS_LOCAL: - _User_extensions_Remove_set( &the_extension->Extension ); - _Objects_Close( &_Extension_Information, &the_extension->Object ); - _Objects_Put( &the_extension->Object ); - _Extension_Free( the_extension ); - _Objects_Allocator_unlock(); - return RTEMS_SUCCESSFUL; - -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: /* should never return this */ -#endif - case OBJECTS_ERROR: - break; + + the_extension = _Extension_Get( id ); + + if ( the_extension != NULL ) { + _Objects_Close( &_Extension_Information, &the_extension->Object ); + _User_extensions_Remove_set( &the_extension->Extension ); + _Extension_Free( the_extension ); + status = RTEMS_SUCCESSFUL; + } else { + status = RTEMS_INVALID_ID; } _Objects_Allocator_unlock(); - - return RTEMS_INVALID_ID; + return status; } -- cgit v1.2.3