Changeset 0e9d5b6 in rtems


Ignore:
Timestamp:
May 24, 2016, 11:15:47 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
8866e62
Parents:
25e28d8
git-author:
Sebastian Huber <sebastian.huber@…> (05/24/16 11:15:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/25/16 10:43:53)
Message:

mpci: Fix thread queue flush method

We must call the MP callout for proxies if we unblock them after a
thread queue extraction. This was missing in
_Thread_queue_Flush_critical(). Move thread remove timer and unblock
code to new function _Thread_Remove_timer_and_unblock().

Location:
cpukit/score
Files:
6 edited

Legend:

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

    r25e28d8 r0e9d5b6  
    15721572}
    15731573
     1574RTEMS_INLINE_ROUTINE void _Thread_Remove_timer_and_unblock(
     1575  Thread_Control     *the_thread,
     1576  Thread_queue_Queue *queue
     1577)
     1578{
     1579  _Thread_Timer_remove( the_thread );
     1580
     1581#if defined(RTEMS_MULTIPROCESSING)
     1582  if ( _Objects_Is_local_id( the_thread->Object.id ) ) {
     1583    _Thread_Unblock( the_thread );
     1584  } else {
     1585    _Thread_queue_Unblock_proxy( queue, the_thread );
     1586  }
     1587#else
     1588  (void) queue;
     1589  _Thread_Unblock( the_thread );
     1590#endif
     1591}
     1592
    15741593RTEMS_INLINE_ROUTINE void _Thread_Debug_set_real_processor(
    15751594  Thread_Control  *the_thread,
  • cpukit/score/include/rtems/score/threadqimpl.h

    r25e28d8 r0e9d5b6  
    408408#endif
    409409
    410 void _Thread_queue_Do_unblock_critical(
    411   bool                     unblock,
    412   Thread_queue_Queue      *queue,
    413   Thread_Control          *the_thread,
    414 #if defined(RTEMS_MULTIPROCESSING)
    415   Thread_queue_MP_callout  mp_callout,
    416   Objects_Id               mp_id,
    417 #endif
    418   ISR_lock_Context        *lock_context
    419 );
    420 
    421410/**
    422411 * @brief Unblocks the thread which was on the thread queue before.
     
    431420 * @param[in] queue The actual thread queue.
    432421 * @param[in] the_thread The thread to extract.
    433  * @param[in] mp_callout Callout to unblock the thread in case it is actually a
    434  *   thread proxy.  This parameter is only used on multiprocessing
    435  *   configurations.
    436  * @param[in] mp_id Object identifier of the object containing the thread
    437  *   queue.  This parameter is only used on multiprocessing configurations.
    438422 * @param[in] lock_context The lock context of the lock acquire.
    439423 */
    440 #if defined(RTEMS_MULTIPROCESSING)
    441   #define _Thread_queue_Unblock_critical( \
    442     unblock, \
    443     queue, \
    444     the_thread, \
    445     mp_callout, \
    446     mp_id, \
    447     lock_context \
    448   ) \
    449     _Thread_queue_Do_unblock_critical( \
    450       unblock, \
    451       queue, \
    452       the_thread, \
    453       mp_callout, \
    454       mp_id, \
    455       lock_context \
    456     )
    457 #else
    458   #define _Thread_queue_Unblock_critical( \
    459     unblock, \
    460     queue, \
    461     the_thread, \
    462     mp_callout, \
    463     mp_id, \
    464     lock_context \
    465   ) \
    466     _Thread_queue_Do_unblock_critical( \
    467       unblock, \
    468       queue, \
    469       the_thread, \
    470       lock_context \
    471     )
    472 #endif
     424void _Thread_queue_Unblock_critical(
     425  bool                unblock,
     426  Thread_queue_Queue *queue,
     427  Thread_Control     *the_thread,
     428  ISR_lock_Context   *lock_context
     429);
    473430
    474431void _Thread_queue_Do_extract_critical(
     
    832789  Objects_Id      mp_id
    833790);
     791
     792void _Thread_queue_Unblock_proxy(
     793  Thread_queue_Queue *queue,
     794  Thread_Control     *the_thread
     795);
    834796#endif
    835797
  • cpukit/score/src/coremutexsurrender.c

    r25e28d8 r0e9d5b6  
    158158      &the_mutex->Wait_queue.Queue,
    159159      the_thread,
    160       mp_callout,
    161       mp_id,
    162160      lock_context
    163161    );
  • cpukit/score/src/mutex.c

    r25e28d8 r0e9d5b6  
    155155      &mutex->Queue.Queue,
    156156      first,
    157       NULL,
    158       0,
    159157      lock_context
    160158    );
  • cpukit/score/src/threadqenqueue.c

    r25e28d8 r0e9d5b6  
    8888  );
    8989  if ( !success ) {
    90     _Thread_Timer_remove( the_thread );
    91 
    92 #if defined(RTEMS_MULTIPROCESSING)
    93     if ( _Objects_Is_local_id( the_thread->Object.id ) ) {
    94       _Thread_Unblock( the_thread );
    95     } else {
    96       Thread_Proxy_control *the_proxy;
    97 
    98       the_proxy = (Thread_Proxy_control *) the_thread;
    99       ( *the_proxy->thread_queue_callout )(
    100         the_thread,
    101         the_proxy->thread_queue_id
    102       );
    103 
    104       _Thread_MP_Free_proxy( the_thread );
    105     }
    106 #else
    107     _Thread_Unblock( the_thread );
    108 #endif
     90    _Thread_Remove_timer_and_unblock( the_thread, queue );
    10991  }
    11092
     
    164146}
    165147
    166 void _Thread_queue_Do_unblock_critical(
    167   bool                     unblock,
    168   Thread_queue_Queue      *queue,
    169   Thread_Control          *the_thread,
    170 #if defined(RTEMS_MULTIPROCESSING)
    171   Thread_queue_MP_callout  mp_callout,
    172   Objects_Id               mp_id,
    173 #endif
    174   ISR_lock_Context        *lock_context
     148void _Thread_queue_Unblock_critical(
     149  bool                unblock,
     150  Thread_queue_Queue *queue,
     151  Thread_Control     *the_thread,
     152  ISR_lock_Context   *lock_context
    175153)
    176154{
     
    181159    _Thread_queue_Queue_release( queue, lock_context );
    182160
    183     _Thread_Timer_remove( the_thread );
    184 
    185 #if defined(RTEMS_MULTIPROCESSING)
    186     if ( _Objects_Is_local_id( the_thread->Object.id ) ) {
    187       _Thread_Unblock( the_thread );
    188     } else {
    189       ( *mp_callout )( the_thread, mp_id );
    190       _Thread_MP_Free_proxy( the_thread );
    191     }
    192 #else
    193     _Thread_Unblock( the_thread );
    194 #endif
     161    _Thread_Remove_timer_and_unblock( the_thread, queue );
    195162
    196163    _Thread_Dispatch_enable( cpu_self );
     
    225192    queue,
    226193    the_thread,
    227     mp_callout,
    228     mp_id,
    229194    lock_context
    230195  );
     
    291256  return the_thread;
    292257}
     258
     259#if defined(RTEMS_MULTIPROCESSING)
     260void _Thread_queue_Unblock_proxy(
     261  Thread_queue_Queue *queue,
     262  Thread_Control     *the_thread
     263)
     264{
     265  Thread_Proxy_control *the_proxy;
     266
     267  the_proxy = (Thread_Proxy_control *) the_thread;
     268  ( *the_proxy->thread_queue_callout )(
     269    the_thread,
     270    the_proxy->thread_queue_id
     271  );
     272
     273  _Thread_MP_Free_proxy( the_thread );
     274}
     275#endif
  • cpukit/score/src/threadqflush.c

    r25e28d8 r0e9d5b6  
    9696      next = _Chain_Next( node );
    9797      the_thread = THREAD_CHAIN_NODE_TO_THREAD( node );
    98       _Thread_Timer_remove( the_thread );
    99       _Thread_Unblock( the_thread );
     98      _Thread_Remove_timer_and_unblock( the_thread, queue );
    10099
    101100      node = next;
Note: See TracChangeset for help on using the changeset viewer.