Changeset 1512761 in rtems


Ignore:
Timestamp:
Feb 28, 2015, 4:24:52 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
43e1573c
Parents:
222dc77
git-author:
Sebastian Huber <sebastian.huber@…> (02/28/15 16:24:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/05/15 10:36:20)
Message:

score: Thread dispatch dis/enable without Giant

Update #2273.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/threaddispatch.h

    r222dc77 r1512761  
    190190
    191191    return disable_level;
     192  }
     193
     194  RTEMS_INLINE_ROUTINE void _Giant_Acquire( Per_CPU_Control *cpu_self )
     195  {
     196    (void) cpu_self;
     197  }
     198
     199  RTEMS_INLINE_ROUTINE void _Giant_Release( Per_CPU_Control *cpu_self )
     200  {
     201    (void) cpu_self;
    192202  }
    193203#endif /* RTEMS_SMP */
     
    228238
    229239/**
    230  * This routine prevents dispatching.
    231  */
    232 
    233 #if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
    234 void _Thread_Disable_dispatch( void );
    235 #else
    236 RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
    237 {
    238   _Thread_Dispatch_increment_disable_level();
    239   RTEMS_COMPILER_MEMORY_BARRIER();
    240 }
    241 #endif
    242 
    243 RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch_body( void )
     240 * @brief Disables thread dispatching inside a critical section (interrupts
     241 * disabled).
     242 *
     243 * This function does not acquire the Giant lock.
     244 *
     245 * @param[in] cpu_self The current processor.
     246 */
     247RTEMS_INLINE_ROUTINE void _Thread_Dispatch_disable_critical(
     248  Per_CPU_Control *cpu_self
     249)
     250{
     251  uint32_t disable_level = cpu_self->thread_dispatch_disable_level;
     252
     253  _Profiling_Thread_dispatch_disable( cpu_self, disable_level );
     254  cpu_self->thread_dispatch_disable_level = disable_level + 1;
     255}
     256
     257/**
     258 * @brief Disables thread dispatching.
     259 *
     260 * This function does not acquire the Giant lock.
     261 *
     262 * @return The current processor.
     263 */
     264RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable( void )
    244265{
    245266  Per_CPU_Control *cpu_self;
    246   uint32_t         disable_level;
     267
     268#if defined( RTEMS_SMP ) || defined( RTEMS_PROFILING )
     269  ISR_Level level;
     270
     271  _ISR_Disable_without_giant( level );
     272#endif
    247273
    248274  cpu_self = _Per_CPU_Get();
    249 
    250 #if defined( RTEMS_SMP )
    251   _Giant_Release( cpu_self );
    252 #endif
    253 
    254   disable_level = cpu_self->thread_dispatch_disable_level;
     275  _Thread_Dispatch_disable_critical( cpu_self );
     276
     277#if defined( RTEMS_SMP ) || defined( RTEMS_PROFILING )
     278  _ISR_Enable_without_giant( level );
     279#endif
     280
     281  return cpu_self;
     282}
     283
     284/**
     285 * @brief Enables thread dispatching.
     286 *
     287 * May perfrom a thread dispatch if necessary as a side-effect.
     288 *
     289 * This function does not release the Giant lock.
     290 *
     291 * @param[in] cpu_self The current processor.
     292 */
     293RTEMS_INLINE_ROUTINE void _Thread_Dispatch_enable( Per_CPU_Control *cpu_self )
     294{
     295  uint32_t disable_level = cpu_self->thread_dispatch_disable_level;
    255296
    256297  if ( disable_level == 1 ) {
     
    273314
    274315/**
    275  * This routine allows dispatching to occur again.  If this is
    276  * the outer most dispatching critical section, then a dispatching
    277  * operation will be performed and, if necessary, control of the
    278  * processor will be transferred to the heir thread.
    279  */
    280 
     316 * @brief Disables thread dispatching and acquires the Giant lock.
     317 */
     318#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
     319void _Thread_Disable_dispatch( void );
     320#else
     321RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
     322{
     323  _Thread_Dispatch_increment_disable_level();
     324  RTEMS_COMPILER_MEMORY_BARRIER();
     325}
     326#endif
     327
     328RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch_body( void )
     329{
     330  Per_CPU_Control *cpu_self = _Per_CPU_Get();
     331
     332  _Giant_Release( cpu_self );
     333  _Thread_Dispatch_enable( cpu_self );
     334}
     335
     336/**
     337 * @brief Enables thread dispatching and releases the Giant lock.
     338 *
     339 * May perfrom a thread dispatch if necessary as a side-effect.
     340 */
    281341#if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
    282342  void _Thread_Enable_dispatch( void );
     
    291351
    292352/**
    293  * This routine allows dispatching to occur again.  However,
    294  * no dispatching operation is performed even if this is the outer
    295  * most dispatching critical section.
    296  */
    297 
     353 * @brief Enables thread dispatching and releases the Giant lock.
     354 *
     355 * @warning A thread dispatch is not performed as a side-effect.  Use this
     356 * function with
     357 */
    298358RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void )
    299359{
Note: See TracChangeset for help on using the changeset viewer.