diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-04 10:09:45 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-06 08:17:04 +0200 |
commit | bb2ad039a7246eecde65592a5116c86d3dede34b (patch) | |
tree | aee3f4b3200d35f7dfc4968bc4a04c5fcac5b262 /cpukit/rtems/include | |
parent | mpci: Avoid Giant lock in _MPCI_Process_response() (diff) | |
download | rtems-bb2ad039a7246eecde65592a5116c86d3dede34b.tar.bz2 |
rtems: Avoid Giant lock for signals
Update #2555.
Diffstat (limited to 'cpukit/rtems/include')
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/asr.h | 2 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/asrimpl.h | 66 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/signalmp.h | 31 |
3 files changed, 26 insertions, 73 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/asr.h b/cpukit/rtems/include/rtems/rtems/asr.h index 0110a404c2..4563750919 100644 --- a/cpukit/rtems/include/rtems/rtems/asr.h +++ b/cpukit/rtems/include/rtems/rtems/asr.h @@ -76,7 +76,7 @@ typedef struct { /** This field indicates if nest level of signals being processed */ uint32_t nest_level; /** Lock to protect this structure */ - ISR_lock_Control Lock; + ISR_LOCK_MEMBER( Lock ) } ASR_Information; /* diff --git a/cpukit/rtems/include/rtems/rtems/asrimpl.h b/cpukit/rtems/include/rtems/rtems/asrimpl.h index 7c1c648533..892c58c595 100644 --- a/cpukit/rtems/include/rtems/rtems/asrimpl.h +++ b/cpukit/rtems/include/rtems/rtems/asrimpl.h @@ -59,41 +59,29 @@ RTEMS_INLINE_ROUTINE void _ASR_Destroy( ASR_Information *asr ) _ISR_lock_Destroy( &asr->Lock ); } -RTEMS_INLINE_ROUTINE void _ASR_Acquire( +RTEMS_INLINE_ROUTINE void _ASR_Acquire_critical( ASR_Information *asr, ISR_lock_Context *lock_context ) { - _ISR_lock_ISR_disable_and_acquire( &asr->Lock, lock_context ); + _ISR_lock_Acquire( &asr->Lock, lock_context ); } -RTEMS_INLINE_ROUTINE void _ASR_Release( +RTEMS_INLINE_ROUTINE void _ASR_Acquire( ASR_Information *asr, ISR_lock_Context *lock_context ) { - _ISR_lock_Release_and_ISR_enable( &asr->Lock, lock_context ); + _ISR_lock_ISR_disable( lock_context ); + _ASR_Acquire_critical( asr, lock_context ); } -/** - * @brief ASR_Swap_signals - * - * This routine atomically swaps the pending and posted signal - * sets. This is done when the thread alters its mode in such a - * way that the RTEMS_ASR disable/enable flag changes. - */ -RTEMS_INLINE_ROUTINE void _ASR_Swap_signals ( - ASR_Information *asr +RTEMS_INLINE_ROUTINE void _ASR_Release( + ASR_Information *asr, + ISR_lock_Context *lock_context ) { - rtems_signal_set _signals; - ISR_lock_Context lock_context; - - _ASR_Acquire( asr, &lock_context ); - _signals = asr->signals_pending; - asr->signals_pending = asr->signals_posted; - asr->signals_posted = _signals; - _ASR_Release( asr, &lock_context ); + _ISR_lock_Release_and_ISR_enable( &asr->Lock, lock_context ); } /** @@ -109,38 +97,26 @@ RTEMS_INLINE_ROUTINE bool _ASR_Is_null_handler ( return asr_handler == NULL; } -/** - * @brief ASR_Are_signals_pending - * - * This function returns TRUE if there are signals pending in the - * given RTEMS_ASR information record and FALSE otherwise. - */ -RTEMS_INLINE_ROUTINE bool _ASR_Are_signals_pending ( - ASR_Information *asr -) +RTEMS_INLINE_ROUTINE rtems_signal_set _ASR_Swap_signals( ASR_Information *asr ) { - return asr->signals_posted != 0; + rtems_signal_set new_signals_posted; + ISR_lock_Context lock_context; + + _ASR_Acquire( asr, &lock_context ); + new_signals_posted = asr->signals_pending; + asr->signals_pending = asr->signals_posted; + asr->signals_posted = new_signals_posted; + _ASR_Release( asr, &lock_context ); + + return new_signals_posted; } -/** - * @brief ASR_Post_signals - * - * This routine posts the given signals into the signal_set - * passed in. The result is returned to the user in signal_set. - * - * NOTE: This must be implemented as a macro. - */ RTEMS_INLINE_ROUTINE void _ASR_Post_signals( - ASR_Information *asr, rtems_signal_set signals, rtems_signal_set *signal_set ) { - ISR_lock_Context lock_context; - - _ASR_Acquire( asr, &lock_context ); - *signal_set |= signals; - _ASR_Release( asr, &lock_context ); + *signal_set |= signals; } RTEMS_INLINE_ROUTINE rtems_signal_set _ASR_Get_posted_signals( diff --git a/cpukit/rtems/include/rtems/rtems/signalmp.h b/cpukit/rtems/include/rtems/rtems/signalmp.h index 2f85ac648c..57b8682c58 100644 --- a/cpukit/rtems/include/rtems/rtems/signalmp.h +++ b/cpukit/rtems/include/rtems/rtems/signalmp.h @@ -38,25 +38,6 @@ extern "C" { */ /*{*/ -/** - * The following enumerated type defines the list of - * remote signal operations. - */ -typedef enum { - SIGNAL_MP_SEND_REQUEST = 0, - SIGNAL_MP_SEND_RESPONSE = 1 -} Signal_MP_Remote_operations; - -/** - * The following data structure defines the packet used to perform - * remote signal operations. - */ -typedef struct { - rtems_packet_prefix Prefix; - Signal_MP_Remote_operations operation; - rtems_signal_set signal_in; -} Signal_MP_Packet; - /* * @brief Signal_MP_Send_process_packet * @@ -68,15 +49,11 @@ typedef struct { */ /** - * @brief Signal MP Send Request Packet - * - * This routine performs a remote procedure call so that a - * directive operation can be initiated on another node. + * @brief Issues a remote rtems_signal_send() request. */ -rtems_status_code _Signal_MP_Send_request_packet ( - Signal_MP_Remote_operations operation, - Objects_Id task_id, - rtems_signal_set signal_in +rtems_status_code _Signal_MP_Send( + rtems_id id, + rtems_signal_set signal_set ); /** |