Changeset e50e42b8 in rtems


Ignore:
Timestamp:
Feb 15, 2020, 10:52:00 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
ca82a603
Parents:
5b8d80d7
git-author:
Sebastian Huber <sebastian.huber@…> (02/15/20 10:52:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/25/20 06:18:35)
Message:

score: _Scheduler_Is_non_preempt_mode_supported()

If the non-preempt mode for threads is supported depends on the
scheduler implementation. Add
_Scheduler_Is_non_preempt_mode_supported() to indicate this.

Update #3876.

Location:
cpukit
Files:
5 edited

Legend:

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

    r5b8d80d7 re50e42b8  
    2828
    2929#if defined(RTEMS_SMP)
     30  #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value ) \
     31    , value
     32#else
     33  #define SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( value )
     34#endif
     35
     36#if defined(RTEMS_SMP)
    3037  /* This object doesn't exist and indicates a configuration error */
    3138  extern const Scheduler_Control RTEMS_SCHEDULER_INVALID_INDEX;
     
    7380      SCHEDULER_CBS_MAXIMUM_PRIORITY, \
    7481      ( obj_name ) \
     82      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
    7583    }
    7684
     
    99107      SCHEDULER_EDF_MAXIMUM_PRIORITY, \
    100108      ( obj_name ) \
     109      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
    101110    }
    102111
     
    132141      SCHEDULER_EDF_MAXIMUM_PRIORITY, \
    133142      ( obj_name ) \
     143      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
    134144    }
    135145
     
    163173      ) - 1, \
    164174      ( obj_name ) \
     175      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
    165176    }
    166177
     
    194205      ) - 1, \
    195206      ( obj_name ) \
     207      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
    196208    }
    197209
     
    225237      ) - 1, \
    226238      ( obj_name ) \
     239      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
    227240    }
    228241
     
    256269      ) - 1, \
    257270      ( obj_name ) \
     271      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
    258272    }
    259273
     
    283297      SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \
    284298      ( obj_name ) \
     299      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( true ) \
    285300    }
    286301
     
    310325      SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \
    311326      ( obj_name ) \
     327      SCHEDULER_CONTROL_IS_NON_PREEMPT_MODE_SUPPORTED( false ) \
    312328    }
    313329
  • cpukit/include/rtems/score/scheduler.h

    r5b8d80d7 re50e42b8  
    290290   */
    291291  uint32_t name;
     292
     293#if defined(RTEMS_SMP)
     294  /**
     295   * @brief True if the non-preempt mode for threads is supported by the
     296   * scheduler, otherwise false.
     297   */
     298  bool is_non_preempt_mode_supported;
     299#endif
    292300};
    293301
  • cpukit/include/rtems/score/schedulerimpl.h

    r5b8d80d7 re50e42b8  
    129129#endif
    130130}
     131
     132#if defined(RTEMS_SMP)
     133/**
     134 * @brief Indicate if the thread non-preempt mode is supported by the
     135 * scheduler.
     136 *
     137 * @param scheduler The scheduler instance.
     138 *
     139 * @return True if the non-preempt mode for threads is supported by the
     140 *   scheduler, otherwise false.
     141 */
     142RTEMS_INLINE_ROUTINE bool _Scheduler_Is_non_preempt_mode_supported(
     143  const Scheduler_Control *scheduler
     144)
     145{
     146  return scheduler->is_non_preempt_mode_supported;
     147}
     148#endif
    131149
    132150#if defined(RTEMS_SMP)
  • cpukit/rtems/src/taskmode.c

    r5b8d80d7 re50e42b8  
    4242  rtems_mode          old_mode;
    4343
     44  executing = _Thread_Get_executing();
     45
    4446  if ( !previous_mode_set )
    4547    return RTEMS_INVALID_ADDRESS;
     
    4951    ( mask & RTEMS_PREEMPT_MASK ) != 0
    5052      && !_Modes_Is_preempt( mode_set )
    51       && rtems_configuration_is_smp_enabled()
     53      && !_Scheduler_Is_non_preempt_mode_supported(
     54        _Thread_Scheduler_get_home( executing )
     55      )
    5256  ) {
    5357    return RTEMS_NOT_IMPLEMENTED;
     
    7276   * past this point.
    7377   */
    74  
    75   executing     = _Thread_Get_executing();
     78
    7679  api = executing->API_Extensions[ THREAD_API_RTEMS ];
    7780  asr = &api->Signal;
  • cpukit/score/src/threadinitialize.c

    r5b8d80d7 re50e42b8  
    6464
    6565#if defined(RTEMS_SMP)
    66   if ( !config->is_preemptible && rtems_configuration_is_smp_enabled() ) {
     66  if (
     67    !config->is_preemptible
     68      && !_Scheduler_Is_non_preempt_mode_supported( config->scheduler )
     69  ) {
    6770    goto failed;
    6871  }
Note: See TracChangeset for help on using the changeset viewer.