Changeset 75f6d18 in rtems


Ignore:
Timestamp:
Aug 26, 2013, 2:03:35 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
ca68215e
Parents:
ef3640f7
git-author:
Sebastian Huber <sebastian.huber@…> (08/26/13 14:03:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/27/13 08:48:17)
Message:

rtems: Add SMP support for signals

Add and use _ASR_Get_posted_signals(). The post-switch handler is not
protected by disabled thread dispatching. Use proper SMP lock for
signal management.

Location:
cpukit/rtems
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/asr.h

    ref3640f7 r75f6d18  
    2323#define _RTEMS_RTEMS_ASR_H
    2424
     25#include <rtems/score/isrlock.h>
    2526#include <rtems/rtems/modes.h>
    2627
     
    7475  /** This field indicates if nest level of signals being processed */
    7576  uint32_t          nest_level;
     77  /** Lock to protect this structure */
     78  ISR_lock_Control  Lock;
    7679}   ASR_Information;
    7780
  • cpukit/rtems/include/rtems/rtems/asrimpl.h

    ref3640f7 r75f6d18  
    1919
    2020#include <rtems/rtems/asr.h>
    21 #include <rtems/score/isrlevel.h>
    2221
    2322#ifdef __cplusplus
     
    3938 */
    4039RTEMS_INLINE_ROUTINE void _ASR_Initialize (
    41   ASR_Information *information
     40  ASR_Information *asr
    4241)
    4342{
    44   information->is_enabled      = false;
    45   information->handler         = NULL;
    46   information->mode_set        = RTEMS_DEFAULT_MODES;
    47   information->signals_posted  = 0;
    48   information->signals_pending = 0;
    49   information->nest_level      = 0;
     43  asr->is_enabled      = false;
     44  asr->handler         = NULL;
     45  asr->mode_set        = RTEMS_DEFAULT_MODES;
     46  asr->signals_posted  = 0;
     47  asr->signals_pending = 0;
     48  asr->nest_level      = 0;
     49  _ISR_lock_Initialize( &asr->Lock );
    5050}
    5151
     
    5858 */
    5959RTEMS_INLINE_ROUTINE void _ASR_Swap_signals (
    60   ASR_Information *information
     60  ASR_Information *asr
    6161)
    6262{
     
    6464  ISR_Level        _level;
    6565
    66   _ISR_Disable( _level );
    67     _signals                     = information->signals_pending;
    68     information->signals_pending = information->signals_posted;
    69     information->signals_posted  = _signals;
    70   _ISR_Enable( _level );
     66  _ISR_lock_ISR_disable_and_acquire( &asr->Lock, _level );
     67    _signals             = asr->signals_pending;
     68    asr->signals_pending = asr->signals_posted;
     69    asr->signals_posted  = _signals;
     70  _ISR_lock_Release_and_ISR_enable( &asr->Lock, _level );
    7171}
    7272
     
    9191 */
    9292RTEMS_INLINE_ROUTINE bool _ASR_Are_signals_pending (
    93   ASR_Information *information
     93  ASR_Information *asr
    9494)
    9595{
    96   return information->signals_posted != 0;
     96  return asr->signals_posted != 0;
    9797}
    9898
     
    106106 */
    107107RTEMS_INLINE_ROUTINE void _ASR_Post_signals(
     108  ASR_Information  *asr,
    108109  rtems_signal_set  signals,
    109110  rtems_signal_set *signal_set
     
    112113  ISR_Level              _level;
    113114
    114   _ISR_Disable( _level );
     115  _ISR_lock_ISR_disable_and_acquire( &asr->Lock, _level );
    115116    *signal_set |= signals;
    116   _ISR_Enable( _level );
     117  _ISR_lock_Release_and_ISR_enable( &asr->Lock, _level );
     118}
     119
     120RTEMS_INLINE_ROUTINE rtems_signal_set _ASR_Get_posted_signals(
     121  ASR_Information *asr
     122)
     123{
     124  rtems_signal_set signal_set;
     125  ISR_Level        _level;
     126
     127  _ISR_lock_ISR_disable_and_acquire( &asr->Lock, _level );
     128    signal_set = asr->signals_posted;
     129    asr->signals_posted = 0;
     130  _ISR_lock_Release_and_ISR_enable( &asr->Lock, _level );
     131
     132  return signal_set;
    117133}
    118134
  • cpukit/rtems/src/signalcatch.c

    ref3640f7 r75f6d18  
    2828static void _RTEMS_signal_Post_switch_hook( Thread_Control *executing )
    2929{
    30   ISR_Level          level;
    3130  RTEMS_API_Control *api;
    3231  ASR_Information   *asr;
     
    4342
    4443  asr = &api->Signal;
    45 
    46   _ISR_Disable( level );
    47     signal_set = asr->signals_posted;
    48     asr->signals_posted = 0;
    49   _ISR_Enable( level );
    50 
     44  signal_set = _ASR_Get_posted_signals( asr );
    5145
    5246  if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */
  • cpukit/rtems/src/signalsend.c

    ref3640f7 r75f6d18  
    4747      if ( ! _ASR_Is_null_handler( asr->handler ) ) {
    4848        if ( asr->is_enabled ) {
    49           _ASR_Post_signals( signal_set, &asr->signals_posted );
     49          _ASR_Post_signals( asr, signal_set, &asr->signals_posted );
    5050          _Thread_Signal_notification( the_thread );
    5151        } else {
    52           _ASR_Post_signals( signal_set, &asr->signals_pending );
     52          _ASR_Post_signals( asr, signal_set, &asr->signals_pending );
    5353        }
    5454        _Objects_Put( &the_thread->Object );
Note: See TracChangeset for help on using the changeset viewer.