Changeset 8f96581 in rtems


Ignore:
Timestamp:
Apr 1, 2016, 9:38:47 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7d21700
Parents:
818ad5eb
git-author:
Sebastian Huber <sebastian.huber@…> (04/01/16 09:38:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/06/16 07:08:21)
Message:

score: Rework MP thread queue callout support

The thread queue implementation was heavily reworked to support SMP.
This broke the multiprocessing support of the thread queues. This is
fixed by this patch.

A thread proxy is unblocked due to three reasons

1) timeout,
2) request satisfaction, and
3) extraction.

In case 1) no MPCI message must be sent. This is ensured via the
_Thread_queue_MP_callout_do_nothing() callout set during
_Thread_MP_Allocate_proxy().

In case 2) and 3) an MPCI message must be sent. In case we interrupt
the blocking operation during _Thread_queue_Enqueue_critical(), then
this message must be sent by the blocking thread. For this the new
fields Thread_Proxy_control::thread_queue_callout and
Thread_Proxy_control::thread_queue_id are used.

Delete the individual API MP callout types and use
Thread_queue_MP_callout throughout. This type is only defined in
multiprocessing configurations. Prefix the multiprocessing parameters
with mp_ to ease code review. Multiprocessing specific parameters are
optional due to use of a similar macro pattern. There is no overhead
for non-multiprocessing configurations.

Location:
cpukit
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/rtems/rtems_glue.c

    r818ad5eb r8f96581  
    428428        status = _CORE_mutex_Surrender (
    429429                &the_networkSemaphore->Core_control.mutex,
    430                 networkSemaphore,
    431430                NULL,
     431                0,
    432432                &lock_context
    433433                );
  • cpukit/posix/include/rtems/posix/pthreadimpl.h

    r818ad5eb r8f96581  
    218218  return _Thread_queue_Dequeue(
    219219    &api->Join_List,
    220     POSIX_THREAD_JOIN_TQ_OPERATIONS
     220    POSIX_THREAD_JOIN_TQ_OPERATIONS,
     221    NULL,
     222    0
    221223  );
    222224}
  • cpukit/posix/src/condsignalsupp.c

    r818ad5eb r8f96581  
    5050        the_thread = _Thread_queue_Dequeue(
    5151          &the_cond->Wait_queue,
    52           POSIX_CONDITION_VARIABLES_TQ_OPERATIONS
     52          POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
     53          NULL,
     54          0
    5355        );
    5456        if ( !the_thread )
  • cpukit/posix/src/mqueuesendsupp.c

    r818ad5eb r8f96581  
    106106        msg_ptr,
    107107        msg_len,
    108         mqdes,      /* mqd_t is an object id */
    109108        NULL,
     109        0,
    110110        _POSIX_Message_queue_Priority_to_core( msg_prio ),
    111111        do_wait,
  • cpukit/posix/src/mutexsetprioceiling.c

    r818ad5eb r8f96581  
    8282      _CORE_mutex_Surrender(
    8383        &the_mutex->Mutex,
    84         the_mutex->Object.id,
    8584        NULL,
     85        0,
    8686        &lock_context
    8787      );
  • cpukit/posix/src/mutexunlock.c

    r818ad5eb r8f96581  
    5353      status = _CORE_mutex_Surrender(
    5454        &the_mutex->Mutex,
    55         the_mutex->Object.id,
    5655        NULL,
     56        0,
    5757        &lock_context
    5858      );
  • cpukit/posix/src/pbarrierwait.c

    r818ad5eb r8f96581  
    5656        &the_barrier->Barrier,
    5757        executing,
    58         the_barrier->Object.id,
    5958        true,
    6059        0,
    61         NULL
     60        NULL,
     61        0
    6262      );
    6363      _Objects_Put( &the_barrier->Object );
  • cpukit/posix/src/sempost.c

    r818ad5eb r8f96581  
    4949      _CORE_semaphore_Surrender(
    5050        &the_semaphore->Semaphore,
    51         the_semaphore->Object.id,
    52 #if defined(RTEMS_MULTIPROCESSING)
    53         NULL,        /* POSIX Semaphores are local only */
    54 #else
    5551        NULL,
    56 #endif
     52        0,
    5753        &lock_context
    5854      );
  • cpukit/rtems/src/barrierrelease.c

    r818ad5eb r8f96581  
    5555
    5656    case OBJECTS_LOCAL:
    57       *released = _CORE_barrier_Release( &the_barrier->Barrier, id, NULL );
     57      *released = _CORE_barrier_Release( &the_barrier->Barrier, NULL, 0 );
    5858      _Objects_Put( &the_barrier->Object );
    5959      return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/barrierwait.c

    r818ad5eb r8f96581  
    4444        &the_barrier->Barrier,
    4545        executing,
    46         id,
    4746        true,
    4847        timeout,
    49         NULL
     48        NULL,
     49        0
    5050      );
    5151      _Objects_Put( &the_barrier->Object );
  • cpukit/rtems/src/msgqbroadcast.c

    r818ad5eb r8f96581  
    6161                      buffer,
    6262                      size,
     63                      _Message_queue_Core_message_queue_mp_support,
    6364                      id,
    64                       #if defined(RTEMS_MULTIPROCESSING)
    65                         _Message_queue_Core_message_queue_mp_support,
    66                       #else
    67                         NULL,
    68                       #endif
    6965                      count,
    7066                      &lock_context
  • cpukit/rtems/src/msgqsend.c

    r818ad5eb r8f96581  
    3131#include <rtems/rtems/support.h>
    3232
    33 /*
    34  *
    35  *  rtems_message_queue_send
    36  *
    37  *  This routine implements the directive rtems_message_queue_send.  It sends a
    38  *  message to the specified message queue.
    39  *
    40  *  Input parameters:
    41  *    id     - pointer to message queue
    42  *    buffer - pointer to message buffer
    43  *    size   - size of message to send
    44  *
    45  *  Output parameters:
    46  *    RTEMS_SUCCESSFUL - if successful
    47  *    error code       - if unsuccessful
    48  */
    49 
    50 #if defined(RTEMS_MULTIPROCESSING)
    51 #define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
    52 #else
    53 #define MESSAGE_QUEUE_MP_HANDLER NULL
    54 #endif
    55 
    5633rtems_status_code rtems_message_queue_send(
    5734  rtems_id    id,
     
    8057        buffer,
    8158        size,
     59        _Message_queue_Core_message_queue_mp_support,
    8260        id,
    83         MESSAGE_QUEUE_MP_HANDLER,
    8461        false,   /* sender does not block */
    8562        0,       /* no timeout */
  • cpukit/rtems/src/msgqurgent.c

    r818ad5eb r8f96581  
    3131#include <rtems/rtems/support.h>
    3232
    33 #if defined(RTEMS_MULTIPROCESSING)
    34 #define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
    35 #else
    36 #define MESSAGE_QUEUE_MP_HANDLER NULL
    37 #endif
    38 
    3933rtems_status_code rtems_message_queue_urgent(
    4034  rtems_id    id,
     
    6357        buffer,
    6458        size,
     59        _Message_queue_Core_message_queue_mp_support,
    6560        id,
    66         MESSAGE_QUEUE_MP_HANDLER,
    6761        false,   /* sender does not block */
    6862        0,       /* no timeout */
  • cpukit/rtems/src/semrelease.c

    r818ad5eb r8f96581  
    3232#include <rtems/score/coresemimpl.h>
    3333#include <rtems/score/thread.h>
    34 
    3534#include <rtems/score/interr.h>
    36 
    37 /*
    38  *  rtems_semaphore_release
    39  *
    40  *  This directive allows a thread to release a semaphore.
    41  *
    42  *  Input parameters:
    43  *    id - semaphore id
    44  *
    45  *  Output parameters:
    46  *    RTEMS_SUCCESSFUL - if successful
    47  *    error code        - if unsuccessful
    48  */
    49 
    50 #if defined(RTEMS_MULTIPROCESSING)
    51 #define MUTEX_MP_SUPPORT _Semaphore_Core_mutex_mp_support
    52 #else
    53 #define MUTEX_MP_SUPPORT NULL
    54 #endif
    5535
    5636rtems_status_code rtems_semaphore_release(
     
    8969        mutex_status = _CORE_mutex_Surrender(
    9070          &the_semaphore->Core_control.mutex,
     71          _Semaphore_Core_mutex_mp_support,
    9172          id,
    92           MUTEX_MP_SUPPORT,
    9373          &lock_context
    9474        );
     
    9777        semaphore_status = _CORE_semaphore_Surrender(
    9878          &the_semaphore->Core_control.semaphore,
     79          _Semaphore_Core_mutex_mp_support,
    9980          id,
    100           MUTEX_MP_SUPPORT,
    10181          &lock_context
    10282        );
  • cpukit/score/include/rtems/score/corebarrierimpl.h

    r818ad5eb r8f96581  
    6666
    6767/**
    68  *  The following type defines the callout which the API provides
    69  *  to support global/multiprocessor operations on barriers.
    70  */
    71 typedef void ( *CORE_barrier_API_mp_support_callout )(
    72                  Thread_Control *,
    73                  Objects_Id
    74              );
    75 
    76 /**
    7768 *  @brief Initialize core barrier.
    7869 *
     
    9485}
    9586
     87void _CORE_barrier_Do_wait(
     88  CORE_barrier_Control    *the_barrier,
     89  Thread_Control          *executing,
     90  bool                     wait,
     91  Watchdog_Interval        timeout
     92#if defined(RTEMS_MULTIPROCESSING)
     93  ,
     94  Thread_queue_MP_callout  mp_callout,
     95  Objects_Id               mp_id
     96#endif
     97);
     98
    9699/**
    97100 *  @brief Wait for the barrier.
     
    104107 *  @param[in] the_barrier is the barrier to wait for
    105108 *  @param[in,out] executing The currently executing thread.
    106  *  @param[in] id is the id of the object being waited upon
    107109 *  @param[in] wait is true if the calling thread is willing to wait
    108110 *  @param[in] timeout is the number of ticks the calling thread is willing
    109111 *         to wait if @a wait is true.
    110  *  @param[in] api_barrier_mp_support is the routine to invoke if the
     112 *  @param[in] mp_callout is the routine to invoke if the
    111113 *         thread unblocked is remote
     114 *  @param[in] mp_id is the id of the object being waited upon
    112115 *
    113116 * @note Status is returned via the thread control block.
    114117 */
    115 void _CORE_barrier_Wait(
    116   CORE_barrier_Control                *the_barrier,
    117   Thread_Control                      *executing,
    118   Objects_Id                           id,
    119   bool                                 wait,
    120   Watchdog_Interval                    timeout,
    121   CORE_barrier_API_mp_support_callout  api_barrier_mp_support
     118#if defined(RTEMS_MULTIPROCESSING)
     119  #define _CORE_barrier_Wait( \
     120    the_barrier, \
     121    executing, \
     122    wait, \
     123    timeout, \
     124    mp_callout, \
     125    mp_id \
     126  ) \
     127    _CORE_barrier_Do_wait( \
     128      the_barrier, \
     129      executing, \
     130      wait, \
     131      timeout, \
     132      mp_callout, \
     133      mp_id \
     134    )
     135#else
     136  #define _CORE_barrier_Wait( \
     137    the_barrier, \
     138    executing, \
     139    wait, \
     140    timeout, \
     141    mp_callout, \
     142    mp_id \
     143  ) \
     144    _CORE_barrier_Do_wait( \
     145      the_barrier, \
     146      executing, \
     147      wait, \
     148      timeout \
     149    )
     150#endif
     151
     152uint32_t _CORE_barrier_Do_release(
     153  CORE_barrier_Control    *the_barrier
     154#if defined(RTEMS_MULTIPROCESSING)
     155  ,
     156  Thread_queue_MP_callout  mp_callout,
     157  Objects_Id               mp_id
     158#endif
    122159);
    123160
     
    129166 *
    130167 *  @param[in] the_barrier is the barrier to surrender
    131  *  @param[in] id is the id of the object for a remote unblock
    132  *  @param[in] api_barrier_mp_support is the routine to invoke if the
     168 *  @param[in] mp_callout is the routine to invoke if the
    133169 *         thread unblocked is remote
     170 *  @param[in] mp_id is the id of the object for a remote unblock
    134171 *
    135172 *  @retval the number of unblocked threads
    136173 */
    137 uint32_t _CORE_barrier_Release(
    138   CORE_barrier_Control                *the_barrier,
    139   Objects_Id                           id,
    140   CORE_barrier_API_mp_support_callout  api_barrier_mp_support
    141 );
     174#if defined(RTEMS_MULTIPROCESSING)
     175  #define _CORE_barrier_Release( \
     176    the_barrier, \
     177    mp_callout, \
     178    mp_id \
     179  ) \
     180    _CORE_barrier_Do_release( \
     181      the_barrier, \
     182      mp_callout, \
     183      mp_id \
     184    )
     185#else
     186  #define _CORE_barrier_Release( \
     187    the_barrier, \
     188    mp_callout, \
     189    mp_id \
     190  ) \
     191    _CORE_barrier_Do_release( \
     192      the_barrier \
     193    )
     194#endif
    142195
    143196/* Must be a macro due to the multiprocessing dependent parameters */
  • cpukit/score/include/rtems/score/coremsgimpl.h

    r818ad5eb r8f96581  
    102102
    103103/**
    104  *  @brief Callout provides to support global/multiprocessor operations.
    105  *
    106  *  The following type defines the callout which the API provides
    107  *  to support global/multiprocessor operations on message_queues.
    108  */
    109 typedef void ( *CORE_message_queue_API_mp_support_callout )(
    110                  Thread_Control *,
    111                  Objects_Id
    112              );
    113 
    114 /**
    115104 *  @brief Initialize a message queue.
    116105 *
     
    230219#endif
    231220
     221CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
     222  CORE_message_queue_Control *the_message_queue,
     223  const void                 *buffer,
     224  size_t                      size,
     225#if defined(RTEMS_MULTIPROCESSING)
     226  Thread_queue_MP_callout     mp_callout,
     227  Objects_Id                  mp_id,
     228#endif
     229  uint32_t                   *count,
     230  ISR_lock_Context           *lock_context
     231);
     232
    232233/**
    233234 *  @brief Broadcast a message to the message queue.
     
    243244 *  @param[in] buffer is the starting address of the message to broadcast
    244245 *  @param[in] size is the size of the message being broadcast
    245  *  @param[in] id is the RTEMS object Id associated with this message queue.
     246 *  @param[in] mp_callout is the routine to invoke if
     247 *         a thread that is unblocked is actually a remote thread.
     248 *  @param[in] mp_id is the RTEMS object Id associated with this message queue.
    246249 *         It is used when unblocking a remote thread.
    247  *  @param[in] api_message_queue_mp_support is the routine to invoke if
    248  *         a thread that is unblocked is actually a remote thread.
    249250 *  @param[out] count points to the variable that will contain the
    250251 *         number of tasks that are sent this message
     
    253254 *  @retval indication of the successful completion or reason for failure
    254255 */
    255 CORE_message_queue_Status _CORE_message_queue_Broadcast(
    256   CORE_message_queue_Control                *the_message_queue,
    257   const void                                *buffer,
    258   size_t                                     size,
    259   Objects_Id                                 id,
    260   CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
    261   uint32_t                                  *count,
    262   ISR_lock_Context                          *lock_context
     256#if defined(RTEMS_MULTIPROCESSING)
     257  #define _CORE_message_queue_Broadcast( \
     258    the_message_queue, \
     259    buffer, \
     260    size, \
     261    mp_callout, \
     262    mp_id, \
     263    count, \
     264    lock_context \
     265  ) \
     266    _CORE_message_queue_Do_broadcast( \
     267      the_message_queue, \
     268      buffer, \
     269      size, \
     270      mp_callout, \
     271      mp_id, \
     272      count, \
     273      lock_context \
     274    )
     275#else
     276  #define _CORE_message_queue_Broadcast( \
     277    the_message_queue, \
     278    buffer, \
     279    size, \
     280    mp_callout, \
     281    mp_id, \
     282    count, \
     283    lock_context \
     284  ) \
     285    _CORE_message_queue_Do_broadcast( \
     286      the_message_queue, \
     287      buffer, \
     288      size, \
     289      count, \
     290      lock_context \
     291    )
     292#endif
     293
     294CORE_message_queue_Status _CORE_message_queue_Do_submit(
     295  CORE_message_queue_Control       *the_message_queue,
     296  Thread_Control                   *executing,
     297  const void                       *buffer,
     298  size_t                            size,
     299#if defined(RTEMS_MULTIPROCESSING)
     300  Thread_queue_MP_callout           mp_callout,
     301  Objects_Id                        mp_id,
     302#endif
     303  CORE_message_queue_Submit_types   submit_type,
     304  bool                              wait,
     305  Watchdog_Interval                 timeout,
     306  ISR_lock_Context                 *lock_context
    263307);
    264308
     
    276320 *  @param[in] buffer is the starting address of the message to send
    277321 *  @param[in] size is the size of the message being send
    278  *  @param[in] id is the RTEMS object Id associated with this message queue.
     322 *  @param[in] mp_callout is the routine to invoke if
     323 *         a thread that is unblocked is actually a remote thread.
     324 *  @param[in] mp_id is the RTEMS object Id associated with this message queue.
    279325 *         It is used when unblocking a remote thread.
    280  *  @param[in] api_message_queue_mp_support is the routine to invoke if
    281  *         a thread that is unblocked is actually a remote thread.
    282326 *  @param[in] submit_type determines whether the message is prepended,
    283327 *         appended, or enqueued in priority order.
     
    289333 *  @retval indication of the successful completion or reason for failure
    290334 */
    291 CORE_message_queue_Status _CORE_message_queue_Submit(
    292   CORE_message_queue_Control                *the_message_queue,
    293   Thread_Control                            *executing,
    294   const void                                *buffer,
    295   size_t                                     size,
    296   Objects_Id                                 id,
    297   CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
    298   CORE_message_queue_Submit_types            submit_type,
    299   bool                                       wait,
    300   Watchdog_Interval                          timeout,
    301   ISR_lock_Context                          *lock_context
    302 );
     335#if defined(RTEMS_MULTIPROCESSING)
     336  #define _CORE_message_queue_Submit( \
     337    the_message_queue, \
     338    executing, \
     339    buffer, \
     340    size, \
     341    mp_callout, \
     342    mp_id, \
     343    submit_type, \
     344    wait, \
     345    timeout, \
     346    lock_context \
     347  ) \
     348    _CORE_message_queue_Do_submit( \
     349      the_message_queue, \
     350      executing, \
     351      buffer, \
     352      size, \
     353      mp_callout, \
     354      mp_id, \
     355      submit_type, \
     356      wait, \
     357      timeout, \
     358      lock_context \
     359    )
     360#else
     361  #define _CORE_message_queue_Submit( \
     362    the_message_queue, \
     363    executing, \
     364    buffer, \
     365    size, \
     366    mp_callout, \
     367    mp_id, \
     368    submit_type, \
     369    wait, \
     370    timeout, \
     371    lock_context \
     372  ) \
     373    _CORE_message_queue_Do_submit( \
     374      the_message_queue, \
     375      executing, \
     376      buffer, \
     377      size, \
     378      submit_type, \
     379      wait, \
     380      timeout, \
     381      lock_context \
     382    )
     383#endif
    303384
    304385/**
     
    372453 * This routine sends a message to the end of the specified message queue.
    373454 */
    374 RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
    375   CORE_message_queue_Control                *the_message_queue,
    376   const void                                *buffer,
    377   size_t                                     size,
    378   Objects_Id                                 id,
    379   CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
    380   bool                                       wait,
    381   Watchdog_Interval                          timeout,
    382   ISR_lock_Context                          *lock_context
    383 )
    384 {
    385   return _CORE_message_queue_Submit(
    386     the_message_queue,
    387     _Thread_Executing,
    388     buffer,
    389     size,
    390     id,
    391     api_message_queue_mp_support,
    392     CORE_MESSAGE_QUEUE_SEND_REQUEST,
    393     wait,     /* sender may block */
    394     timeout,  /* timeout interval */
    395     lock_context
    396   );
    397 }
     455#define _CORE_message_queue_Send( \
     456  the_message_queue, \
     457  buffer, \
     458  size, \
     459  mp_callout, \
     460  mp_id, \
     461  wait, \
     462  timeout, \
     463  lock_context \
     464) \
     465  _CORE_message_queue_Submit( \
     466    the_message_queue, \
     467    _Thread_Executing, \
     468    buffer, \
     469    size, \
     470    mp_callout, \
     471    mp_id, \
     472    CORE_MESSAGE_QUEUE_SEND_REQUEST, \
     473    wait, \
     474    timeout, \
     475    lock_context \
     476  )
    398477
    399478/**
    400479 * This routine sends a message to the front of the specified message queue.
    401480 */
    402 RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
    403   CORE_message_queue_Control                *the_message_queue,
    404   const void                                *buffer,
    405   size_t                                     size,
    406   Objects_Id                                 id,
    407   CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
    408   bool                                       wait,
    409   Watchdog_Interval                          timeout,
    410   ISR_lock_Context                          *lock_context
    411 )
    412 {
    413   return _CORE_message_queue_Submit(
    414     the_message_queue,
    415     _Thread_Executing,
    416     buffer,
    417     size,
    418     id,
    419     api_message_queue_mp_support,
    420     CORE_MESSAGE_QUEUE_URGENT_REQUEST,
    421     wait,     /* sender may block */
    422     timeout,  /* timeout interval */
    423     lock_context
    424  );
    425 }
     481#define _CORE_message_queue_Urgent( \
     482  the_message_queue, \
     483  buffer, \
     484  size, \
     485  mp_callout, \
     486  mp_id, \
     487  wait, \
     488  timeout, \
     489  lock_context \
     490) \
     491  _CORE_message_queue_Submit( \
     492    the_message_queue, \
     493    _Thread_Executing, \
     494    buffer, \
     495    size, \
     496    mp_callout, \
     497    mp_id, \
     498    CORE_MESSAGE_QUEUE_URGENT_REQUEST, \
     499    wait,\
     500    timeout, \
     501    lock_context \
     502 )
    426503
    427504RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire(
     
    439516{
    440517  _Thread_queue_Acquire_critical( &the_message_queue->Wait_queue, lock_context );
    441 
    442   #if defined(RTEMS_MULTIPROCESSING)
    443     /*
    444      * In case RTEMS_MULTIPROCESSING is enabled, then we have to prevent
    445      * deletion of the executing thread after the thread queue operations.
    446      */
    447     _Thread_Dispatch_disable();
    448   #endif
    449518}
    450519
     
    455524{
    456525  _Thread_queue_Release( &the_message_queue->Wait_queue, lock_context );
    457   #if defined(RTEMS_MULTIPROCESSING)
    458     _Thread_Dispatch_enable( _Per_CPU_Get() );
    459   #endif
    460526}
    461527
     
    577643#endif
    578644
    579 RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
     645RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Do_dequeue_receiver(
    580646  CORE_message_queue_Control      *the_message_queue,
    581647  const void                      *buffer,
    582648  size_t                           size,
     649#if defined(RTEMS_MULTIPROCESSING)
     650  Thread_queue_MP_callout          mp_callout,
     651  Objects_Id                       mp_id,
     652#endif
    583653  CORE_message_queue_Submit_types  submit_type,
    584654  ISR_lock_Context                *lock_context
     
    624694    the_message_queue->operations,
    625695    the_thread,
     696    mp_callout,
     697    mp_id,
    626698    lock_context
    627699  );
     
    630702}
    631703
     704#if defined(RTEMS_MULTIPROCESSING)
     705  #define _CORE_message_queue_Dequeue_receiver( \
     706    the_message_queue, \
     707    buffer, \
     708    size, \
     709    mp_callout, \
     710    mp_id, \
     711    submit_type, \
     712    lock_context \
     713  ) \
     714    _CORE_message_queue_Do_dequeue_receiver( \
     715      the_message_queue, \
     716      buffer, \
     717      size, \
     718      mp_callout, \
     719      mp_id, \
     720      submit_type, \
     721      lock_context \
     722    )
     723#else
     724  #define _CORE_message_queue_Dequeue_receiver( \
     725    the_message_queue, \
     726    buffer, \
     727    size, \
     728    mp_callout, \
     729    mp_id, \
     730    submit_type, \
     731    lock_context \
     732  ) \
     733    _CORE_message_queue_Do_dequeue_receiver( \
     734      the_message_queue, \
     735      buffer, \
     736      size, \
     737      submit_type, \
     738      lock_context \
     739    )
     740#endif
     741
    632742/** @} */
    633743
  • cpukit/score/include/rtems/score/coremuteximpl.h

    r818ad5eb r8f96581  
    3333 */
    3434/**@{**/
    35 
    36 /**
    37  *  @brief Callout which provides to support global/multiprocessor operations.
    38  *
    39  *  The following type defines the callout which the API provides
    40  *  to support global/multiprocessor operations on mutexes.
    41  */
    42 typedef void ( *CORE_mutex_API_mp_support_callout )(
    43                  Thread_Control *,
    44                  Objects_Id
    45              );
    4635
    4736/**
     
    303292#endif
    304293
    305 /**
    306  *  @brief Frees a unit to the mutex.
    307  *
    308  *  This routine frees a unit to the mutex.  If a task was blocked waiting for
    309  *  a unit from this mutex, then that task will be readied and the unit
    310  *  given to that task.  Otherwise, the unit will be returned to the mutex.
    311  *
    312  *  @param[in] the_mutex is the mutex to surrender
    313  *  @param[in] id is the id of the RTEMS Object associated with this mutex
    314  *  @param[in] api_mutex_mp_support is the routine that will be called when
    315  *         unblocking a remote mutex
    316  *  @param[in] lock_context is the interrupt level
    317  *
    318  *  @retval an indication of whether the routine succeeded or failed
    319  */
    320 CORE_mutex_Status _CORE_mutex_Surrender(
    321   CORE_mutex_Control                *the_mutex,
    322   Objects_Id                         id,
    323   CORE_mutex_API_mp_support_callout  api_mutex_mp_support,
    324   ISR_lock_Context                  *lock_context
     294CORE_mutex_Status _CORE_mutex_Do_surrender(
     295  CORE_mutex_Control      *the_mutex,
     296#if defined(RTEMS_MULTIPROCESSING)
     297  Thread_queue_MP_callout  mp_callout,
     298  Objects_Id               mp_id,
     299#endif
     300  ISR_lock_Context        *lock_context
    325301);
     302
     303#if defined(RTEMS_MULTIPROCESSING)
     304  #define _CORE_mutex_Surrender( \
     305    the_mutex, \
     306    mp_callout, \
     307    mp_id, \
     308    lock_context \
     309  ) \
     310    _CORE_mutex_Do_surrender( \
     311      the_mutex, \
     312      mp_callout, \
     313      mp_id, \
     314      lock_context \
     315    )
     316#else
     317  #define _CORE_mutex_Surrender( \
     318    the_mutex, \
     319    mp_callout, \
     320    mp_id, \
     321    lock_context \
     322  ) \
     323    _CORE_mutex_Do_surrender( \
     324      the_mutex, \
     325      lock_context \
     326    )
     327#endif
    326328
    327329/* Must be a macro due to the multiprocessing dependent parameters */
  • cpukit/score/include/rtems/score/coresemimpl.h

    r818ad5eb r8f96581  
    6969
    7070/**
    71  *  The following type defines the callout which the API provides
    72  *  to support global/multiprocessor operations on semaphores.
    73  */
    74 typedef void ( *CORE_semaphore_API_mp_support_callout )(
    75                  Thread_Control *,
    76                  Objects_Id
    77              );
    78 
    79 /**
    8071 *  @brief Initialize the semaphore based on the parameters passed.
    8172 *
     
    10394}
    10495
    105 /**
    106  *  @brief Surrender a unit to a semaphore.
    107  *
    108  *  This routine frees a unit to the semaphore.  If a task was blocked waiting
    109  *  for a unit from this semaphore, then that task will be readied and the unit
    110  *  given to that task.  Otherwise, the unit will be returned to the semaphore.
    111  *
    112  *  @param[in] the_semaphore is the semaphore to surrender
    113  *  @param[in] id is the Id of the API level Semaphore object associated
    114  *         with this instance of a SuperCore Semaphore
    115  *  @param[in] api_semaphore_mp_support is the routine to invoke if the
    116  *         thread unblocked is remote
    117  *  @param[in] lock_context is a temporary variable used to contain the ISR
    118  *        disable level cookie
    119  *
    120  *  @retval an indication of whether the routine succeeded or failed
    121  */
    122 RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
    123   CORE_semaphore_Control                *the_semaphore,
    124   Objects_Id                             id,
    125   CORE_semaphore_API_mp_support_callout  api_semaphore_mp_support,
    126   ISR_lock_Context                      *lock_context
     96RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Do_surrender(
     97  CORE_semaphore_Control  *the_semaphore,
     98#if defined(RTEMS_MULTIPROCESSING)
     99  Thread_queue_MP_callout  mp_callout,
     100  Objects_Id               mp_id,
     101#endif
     102  ISR_lock_Context        *lock_context
    127103)
    128104{
     
    139115  );
    140116  if ( the_thread != NULL ) {
    141 #if defined(RTEMS_MULTIPROCESSING)
    142     _Thread_Dispatch_disable();
    143 #endif
    144 
    145117    _Thread_queue_Extract_critical(
    146118      &the_semaphore->Wait_queue.Queue,
    147119      the_semaphore->operations,
    148120      the_thread,
     121      mp_callout,
     122      mp_id,
    149123      lock_context
    150124    );
    151 
    152 #if defined(RTEMS_MULTIPROCESSING)
    153     if ( !_Objects_Is_local_id( the_thread->Object.id ) )
    154       (*api_semaphore_mp_support) ( the_thread, id );
    155 
    156     _Thread_Dispatch_enable( _Per_CPU_Get() );
    157 #endif
    158125  } else {
    159126    if ( the_semaphore->count < UINT32_MAX )
     
    167134  return status;
    168135}
     136
     137/**
     138 *  @brief Surrender a unit to a semaphore.
     139 *
     140 *  This routine frees a unit to the semaphore.  If a task was blocked waiting
     141 *  for a unit from this semaphore, then that task will be readied and the unit
     142 *  given to that task.  Otherwise, the unit will be returned to the semaphore.
     143 *
     144 *  @param[in] the_semaphore is the semaphore to surrender
     145 *  @param[in] mp_callout is the routine to invoke if the
     146 *         thread unblocked is remote
     147 *  @param[in] mp_id is the Id of the API level Semaphore object associated
     148 *         with this instance of a SuperCore Semaphore
     149 *  @param[in] lock_context is a temporary variable used to contain the ISR
     150 *        disable level cookie
     151 *
     152 *  @retval an indication of whether the routine succeeded or failed
     153 */
     154#if defined(RTEMS_MULTIPROCESSING)
     155  #define _CORE_semaphore_Surrender( \
     156    the_semaphore, \
     157    mp_callout, \
     158    mp_id, \
     159    lock_context \
     160  ) \
     161    _CORE_semaphore_Do_surrender( \
     162      the_semaphore, \
     163      mp_callout, \
     164      mp_id, \
     165      lock_context \
     166    )
     167#else
     168  #define _CORE_semaphore_Surrender( \
     169    the_semaphore, \
     170    mp_callout, \
     171    mp_id, \
     172    lock_context \
     173  ) \
     174    _CORE_semaphore_Do_surrender( \
     175      the_semaphore, \
     176      lock_context \
     177    )
     178#endif
    169179
    170180/* Must be a macro due to the multiprocessing dependent parameters */
  • cpukit/score/include/rtems/score/thread.h

    r818ad5eb r8f96581  
    419419  /** This field is the received response packet in an MP system. */
    420420  MP_packet_Prefix        *receive_packet;
    421 #endif
    422421     /****************** end of common block ********************/
     422
     423  /**
     424   * @brief Thread queue callout for _Thread_queue_Enqueue_critical().
     425   */
     426  Thread_queue_MP_callout  thread_queue_callout;
     427
     428  /**
     429   * @brief Thread queue object identifier for
     430   * _Thread_queue_Enqueue_critical().
     431   */
     432  Objects_Id               thread_queue_id;
     433
    423434  /** This field is used to manage the set of proxies in the system. */
    424435  Chain_Node               Active;
     
    432443   */
    433444  Thread_queue_Heads       Thread_queue_heads[ RTEMS_ZERO_LENGTH_ARRAY ];
     445#endif
    434446}   Thread_Proxy_control;
    435447
  • cpukit/score/include/rtems/score/threadq.h

    r818ad5eb r8f96581  
    2222#include <rtems/score/chain.h>
    2323#include <rtems/score/isrlock.h>
     24#include <rtems/score/object.h>
    2425#include <rtems/score/priority.h>
    2526#include <rtems/score/rbtree.h>
     
    4142
    4243typedef struct _Thread_Control Thread_Control;
     44
     45#if defined(RTEMS_MULTIPROCESSING)
     46/**
     47 * @brief Multiprocessing (MP) support callout for thread queue operations.
     48 *
     49 * @param the_proxy The thread proxy of the thread queue operation.  A thread
     50 *   control is actually a thread proxy if and only if
     51 *   _Objects_Is_local_id( the_proxy->Object.id ) is false.
     52 * @param mp_id Object identifier of the object containing the thread queue.
     53 */
     54typedef void ( *Thread_queue_MP_callout )(
     55  Thread_Control *the_proxy,
     56  Objects_Id      mp_id
     57);
     58#endif
    4359
    4460/**
  • cpukit/score/include/rtems/score/threadqimpl.h

    r818ad5eb r8f96581  
    154154}
    155155
    156 #if defined(RTEMS_MULTIPROCESSING)
    157 /**
    158  * @brief Multiprocessing (MP) support callout for thread queue operations.
    159  *
    160  * @param the_proxy The thread proxy of the thread queue operation.  A thread
    161  *   control is actually a thread proxy if and only if
    162  *   _Objects_Is_local_id( the_proxy->Object.id ) is false.
    163  * @param mp_id Object identifier of the object containing the thread queue.
    164  */
    165 typedef void ( *Thread_queue_MP_callout )(
    166   Thread_Control *the_proxy,
    167   Objects_Id      mp_id
    168 );
    169 #endif
     156Thread_Control *_Thread_queue_Do_dequeue(
     157  Thread_queue_Control          *the_thread_queue,
     158  const Thread_queue_Operations *operations
     159#if defined(RTEMS_MULTIPROCESSING)
     160  ,
     161  Thread_queue_MP_callout        mp_callout,
     162  Objects_Id                     mp_id
     163#endif
     164);
    170165
    171166/**
     
    180175 *    + single case
    181176 */
    182 Thread_Control *_Thread_queue_Dequeue(
    183   Thread_queue_Control          *the_thread_queue,
    184   const Thread_queue_Operations *operations
    185 );
     177#if defined(RTEMS_MULTIPROCESSING)
     178  #define _Thread_queue_Dequeue( \
     179    the_thread_queue, \
     180    operations, \
     181    mp_callout, \
     182    mp_id \
     183  ) \
     184    _Thread_queue_Do_dequeue( \
     185      the_thread_queue, \
     186      operations, \
     187      mp_callout, \
     188      mp_id \
     189    )
     190#else
     191  #define _Thread_queue_Dequeue( \
     192    the_thread_queue, \
     193    operations, \
     194    mp_callout, \
     195    mp_id \
     196  ) \
     197    _Thread_queue_Do_dequeue( \
     198      the_thread_queue, \
     199      operations \
     200    )
     201#endif
    186202
    187203/**
     
    284300}
    285301
     302bool _Thread_queue_Do_extract_locked(
     303  Thread_queue_Queue            *queue,
     304  const Thread_queue_Operations *operations,
     305  Thread_Control                *the_thread
     306#if defined(RTEMS_MULTIPROCESSING)
     307  ,
     308  Thread_queue_MP_callout        mp_callout,
     309  Objects_Id                     mp_id
     310#endif
     311);
     312
    286313/**
    287314 * @brief Extracts the thread from the thread queue, restores the default wait
     
    294321 * @param[in] operations The thread queue operations.
    295322 * @param[in] the_thread The thread to extract.
     323 * @param[in] mp_callout Callout to unblock the thread in case it is actually a
     324 *   thread proxy.  This parameter is only used on multiprocessing
     325 *   configurations.
     326 * @param[in] mp_id Object identifier of the object containing the thread
     327 *   queue.  This parameter is only used on multiprocessing configurations.
    296328 *
    297329 * @return Returns the unblock indicator for _Thread_queue_Unblock_critical().
     
    303335 * configuration.
    304336 */
    305 bool _Thread_queue_Extract_locked(
    306   Thread_queue_Queue            *queue,
    307   const Thread_queue_Operations *operations,
    308   Thread_Control                *the_thread
     337#if defined(RTEMS_MULTIPROCESSING)
     338  #define _Thread_queue_Extract_locked( \
     339    unblock, \
     340    queue, \
     341    the_thread, \
     342    mp_callout, \
     343    mp_id \
     344  ) \
     345    _Thread_queue_Do_extract_locked( \
     346      unblock, \
     347      queue, \
     348      the_thread, \
     349      mp_callout, \
     350      mp_id \
     351    )
     352#else
     353  #define _Thread_queue_Extract_locked( \
     354    unblock, \
     355    queue, \
     356    the_thread, \
     357    mp_callout, \
     358    mp_id \
     359  ) \
     360    _Thread_queue_Do_extract_locked( \
     361      unblock, \
     362      queue, \
     363      the_thread \
     364    )
     365#endif
     366
     367void _Thread_queue_Do_unblock_critical(
     368  bool                     unblock,
     369  Thread_queue_Queue      *queue,
     370  Thread_Control          *the_thread,
     371#if defined(RTEMS_MULTIPROCESSING)
     372  Thread_queue_MP_callout  mp_callout,
     373  Objects_Id               mp_id,
     374#endif
     375  ISR_lock_Context        *lock_context
    309376);
    310377
     
    321388 * @param[in] queue The actual thread queue.
    322389 * @param[in] the_thread The thread to extract.
     390 * @param[in] mp_callout Callout to unblock the thread in case it is actually a
     391 *   thread proxy.  This parameter is only used on multiprocessing
     392 *   configurations.
     393 * @param[in] mp_id Object identifier of the object containing the thread
     394 *   queue.  This parameter is only used on multiprocessing configurations.
    323395 * @param[in] lock_context The lock context of the lock acquire.
    324396 */
    325 void _Thread_queue_Unblock_critical(
    326   bool                unblock,
    327   Thread_queue_Queue *queue,
    328   Thread_Control     *the_thread,
    329   ISR_lock_Context   *lock_context
     397#if defined(RTEMS_MULTIPROCESSING)
     398  #define _Thread_queue_Unblock_critical( \
     399    unblock, \
     400    queue, \
     401    the_thread, \
     402    mp_callout, \
     403    mp_id, \
     404    lock_context \
     405  ) \
     406    _Thread_queue_Do_unblock_critical( \
     407      unblock, \
     408      queue, \
     409      the_thread, \
     410      mp_callout, \
     411      mp_id, \
     412      lock_context \
     413    )
     414#else
     415  #define _Thread_queue_Unblock_critical( \
     416    unblock, \
     417    queue, \
     418    the_thread, \
     419    mp_callout, \
     420    mp_id, \
     421    lock_context \
     422  ) \
     423    _Thread_queue_Do_unblock_critical( \
     424      unblock, \
     425      queue, \
     426      the_thread, \
     427      lock_context \
     428    )
     429#endif
     430
     431void _Thread_queue_Do_extract_critical(
     432  Thread_queue_Queue            *queue,
     433  const Thread_queue_Operations *operations,
     434  Thread_Control                *the_thread,
     435#if defined(RTEMS_MULTIPROCESSING)
     436  Thread_queue_MP_callout        mp_callout,
     437  Objects_Id                     mp_id,
     438#endif
     439  ISR_lock_Context              *lock_context
    330440);
    331441
     
    365475 *       mutex->Queue.operations,
    366476 *       first,
     477 *       NULL,
     478 *       0,
    367479 *       &lock_context
    368480 *   );
     
    373485 * @param[in] operations The thread queue operations.
    374486 * @param[in] the_thread The thread to extract.
     487 * @param[in] mp_callout Callout to unblock the thread in case it is actually a
     488 *   thread proxy.  This parameter is only used on multiprocessing
     489 *   configurations.
     490 * @param[in] mp_id Object identifier of the object containing the thread
     491 *   queue.  This parameter is only used on multiprocessing configurations.
    375492 * @param[in] lock_context The lock context of the lock acquire.
    376493 */
    377 void _Thread_queue_Extract_critical(
    378   Thread_queue_Queue            *queue,
    379   const Thread_queue_Operations *operations,
    380   Thread_Control                *the_thread,
    381   ISR_lock_Context              *lock_context
    382 );
     494#if defined(RTEMS_MULTIPROCESSING)
     495  #define _Thread_queue_Extract_critical( \
     496    queue, \
     497    operations, \
     498    the_thread, \
     499    mp_callout, \
     500    mp_id, \
     501    lock_context \
     502  ) \
     503    _Thread_queue_Do_extract_critical( \
     504      queue, \
     505      operations, \
     506      the_thread, \
     507      mp_callout, \
     508      mp_id, \
     509      lock_context \
     510    )
     511#else
     512  #define _Thread_queue_Extract_critical( \
     513    queue, \
     514    operations, \
     515    the_thread, \
     516    mp_callout, \
     517    mp_id, \
     518    lock_context \
     519  ) \
     520    _Thread_queue_Do_extract_critical( \
     521      queue, \
     522      operations, \
     523      the_thread, \
     524      lock_context \
     525    )
     526#endif
    383527
    384528/**
     
    575719);
    576720
     721#if defined(RTEMS_MULTIPROCESSING)
     722void _Thread_queue_MP_callout_do_nothing(
     723  Thread_Control *the_proxy,
     724  Objects_Id      mp_id
     725);
     726#endif
     727
    577728extern const Thread_queue_Operations _Thread_queue_Operations_default;
    578729
  • cpukit/score/src/apimutexunlock.c

    r818ad5eb r8f96581  
    3636  _CORE_mutex_Surrender(
    3737    &the_mutex->Mutex,
    38     the_mutex->Object.id,
    3938    NULL,
     39    0,
    4040    &lock_context
    4141  );
  • cpukit/score/src/condition.c

    r818ad5eb r8f96581  
    258258      &condition->Queue.Queue,
    259259      operations,
    260       first
     260      first,
     261      NULL,
     262      0
    261263    );
    262264    if (do_unblock) {
  • cpukit/score/src/corebarrierrelease.c

    r818ad5eb r8f96581  
    2424#include <rtems/score/threadqimpl.h>
    2525
    26 static Thread_Control *_CORE_barrier_Dequeue(
    27   CORE_barrier_Control *the_barrier
    28 )
    29 {
    30   return _Thread_queue_Dequeue(
    31     &the_barrier->Wait_queue,
    32     CORE_BARRIER_TQ_OPERATIONS
    33   );
    34 }
    35 
    36 uint32_t _CORE_barrier_Release(
    37   CORE_barrier_Control                *the_barrier,
     26uint32_t _CORE_barrier_Do_release(
     27  CORE_barrier_Control    *the_barrier
    3828#if defined(RTEMS_MULTIPROCESSING)
    39   Objects_Id                           id,
    40   CORE_barrier_API_mp_support_callout  api_barrier_mp_support
    41 #else
    42   Objects_Id                           id RTEMS_UNUSED,
    43   CORE_barrier_API_mp_support_callout  api_barrier_mp_support RTEMS_UNUSED
     29  ,
     30  Thread_queue_MP_callout  mp_callout,
     31  Objects_Id               mp_id
    4432#endif
    4533)
     
    4937
    5038  count = 0;
    51   while ( ( the_thread = _CORE_barrier_Dequeue( the_barrier ) ) ) {
    52 #if defined(RTEMS_MULTIPROCESSING)
    53     if ( !_Objects_Is_local_id( the_thread->Object.id ) )
    54       (*api_barrier_mp_support) ( the_thread, id );
    55 #endif
     39  while (
     40    (
     41      the_thread = _Thread_queue_Dequeue(
     42        &the_barrier->Wait_queue,
     43        CORE_BARRIER_TQ_OPERATIONS,
     44        mp_callout,
     45        mp_id
     46      )
     47    )
     48  ) {
    5649    count++;
    5750  }
  • cpukit/score/src/corebarrierwait.c

    r818ad5eb r8f96581  
    2424#include <rtems/score/threadqimpl.h>
    2525
    26 void _CORE_barrier_Wait(
    27   CORE_barrier_Control                *the_barrier,
    28   Thread_Control                      *executing,
    29   Objects_Id                           id,
    30   bool                                 wait,
    31   Watchdog_Interval                    timeout,
    32   CORE_barrier_API_mp_support_callout  api_barrier_mp_support
     26void _CORE_barrier_Do_wait(
     27  CORE_barrier_Control    *the_barrier,
     28  Thread_Control          *executing,
     29  bool                     wait,
     30  Watchdog_Interval        timeout
     31#if defined(RTEMS_MULTIPROCESSING)
     32  ,
     33  Thread_queue_MP_callout  mp_callout,
     34  Objects_Id               mp_id
     35#endif
    3336)
    3437{
     
    4346      executing->Wait.return_code = CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED;
    4447      _Thread_queue_Release( &the_barrier->Wait_queue, &lock_context );
    45       _CORE_barrier_Release( the_barrier, id, api_barrier_mp_support );
     48      _CORE_barrier_Release( the_barrier, mp_callout, mp_id );
    4649      return;
    4750    }
  • cpukit/score/src/coremsgbroadcast.c

    r818ad5eb r8f96581  
    2222#include <rtems/score/objectimpl.h>
    2323
    24 CORE_message_queue_Status _CORE_message_queue_Broadcast(
    25   CORE_message_queue_Control                *the_message_queue,
    26   const void                                *buffer,
    27   size_t                                     size,
    28   #if defined(RTEMS_MULTIPROCESSING)
    29     Objects_Id                                 id,
    30     CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
    31   #else
    32     Objects_Id                                 id RTEMS_UNUSED,
    33     CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support RTEMS_UNUSED,
    34   #endif
    35   uint32_t                                  *count,
    36   ISR_lock_Context                          *lock_context
     24CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
     25  CORE_message_queue_Control *the_message_queue,
     26  const void                 *buffer,
     27  size_t                      size,
     28#if defined(RTEMS_MULTIPROCESSING)
     29  Thread_queue_MP_callout     mp_callout,
     30  Objects_Id                  mp_id,
     31#endif
     32  uint32_t                   *count,
     33  ISR_lock_Context           *lock_context
    3734)
    3835{
     
    5552        buffer,
    5653        size,
     54        mp_callout,
     55        mp_id,
    5756        0,
    5857        lock_context
     
    6160  ) {
    6261    number_broadcasted += 1;
    63 
    64 #if defined(RTEMS_MULTIPROCESSING)
    65     if ( !_Objects_Is_local_id( the_thread->Object.id ) )
    66       (*api_message_queue_mp_support) ( the_thread, id );
    67 #endif
    6862
    6963    _CORE_message_queue_Acquire( the_message_queue, lock_context );
  • cpukit/score/src/coremsgseize.c

    r818ad5eb r8f96581  
    2828
    2929void _CORE_message_queue_Seize(
    30   CORE_message_queue_Control      *the_message_queue,
    31   Thread_Control                  *executing,
    32   Objects_Id                       id,
    33   void                            *buffer,
    34   size_t                          *size_p,
    35   bool                             wait,
    36   Watchdog_Interval                timeout,
    37   ISR_lock_Context                *lock_context
     30  CORE_message_queue_Control *the_message_queue,
     31  Thread_Control             *executing,
     32  Objects_Id                  id,
     33  void                       *buffer,
     34  size_t                     *size_p,
     35  bool                        wait,
     36  Watchdog_Interval           timeout,
     37  ISR_lock_Context           *lock_context
    3838)
    3939{
     
    112112        the_message_queue->operations,
    113113        the_thread,
     114        NULL,
     115        0,
    114116        lock_context
    115117      );
    116       #if defined(RTEMS_MULTIPROCESSING)
    117         _Thread_Dispatch_enable( _Per_CPU_Get() );
    118       #endif
    119118      return;
    120119    }
     
    141140    lock_context
    142141  );
    143   #if defined(RTEMS_MULTIPROCESSING)
    144     _Thread_Dispatch_enable( _Per_CPU_Get() );
    145   #endif
    146142}
  • cpukit/score/src/coremsgsubmit.c

    r818ad5eb r8f96581  
    2626#include <rtems/score/wkspace.h>
    2727
    28 CORE_message_queue_Status _CORE_message_queue_Submit(
    29   CORE_message_queue_Control                *the_message_queue,
    30   Thread_Control                            *executing,
    31   const void                                *buffer,
    32   size_t                                     size,
    33   Objects_Id                                 id,
    34   #if defined(RTEMS_MULTIPROCESSING)
    35     CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
    36   #else
    37     CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support  RTEMS_UNUSED,
    38   #endif
    39   CORE_message_queue_Submit_types            submit_type,
    40   bool                                       wait,
    41   Watchdog_Interval                          timeout,
    42   ISR_lock_Context                          *lock_context
     28CORE_message_queue_Status _CORE_message_queue_Do_submit(
     29  CORE_message_queue_Control       *the_message_queue,
     30  Thread_Control                   *executing,
     31  const void                       *buffer,
     32  size_t                            size,
     33#if defined(RTEMS_MULTIPROCESSING)
     34  Thread_queue_MP_callout           mp_callout,
     35  Objects_Id                        mp_id,
     36#endif
     37  CORE_message_queue_Submit_types   submit_type,
     38  bool                              wait,
     39  Watchdog_Interval                 timeout,
     40  ISR_lock_Context                 *lock_context
    4341)
    4442{
     
    6159    buffer,
    6260    size,
     61    mp_callout,
     62    mp_id,
    6363    submit_type,
    6464    lock_context
    6565  );
    6666  if ( the_thread != NULL ) {
    67     #if defined(RTEMS_MULTIPROCESSING)
    68       if ( !_Objects_Is_local_id( the_thread->Object.id ) )
    69         (*api_message_queue_mp_support) ( the_thread, id );
    70 
    71       _Thread_Dispatch_enable( _Per_CPU_Get() );
    72     #endif
    7367    return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
    7468  }
     
    140134      lock_context
    141135    );
    142     #if defined(RTEMS_MULTIPROCESSING)
    143       _Thread_Dispatch_enable( _Per_CPU_Get() );
    144     #endif
    145 
    146136    return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT;
    147137  #endif
  • cpukit/score/src/coremutexsurrender.c

    r818ad5eb r8f96581  
    6969#endif
    7070
    71 /*
    72  *  _CORE_mutex_Surrender
    73  *
    74  *  This routine frees a unit to the mutex.  If a task was blocked waiting for
    75  *  a unit from this mutex, then that task will be readied and the unit
    76  *  given to that task.  Otherwise, the unit will be returned to the mutex.
    77  *
    78  *  Input parameters:
    79  *    the_mutex            - the mutex to be flushed
    80  *    id                   - id of parent mutex
    81  *    api_mutex_mp_support - api dependent MP support actions
    82  *
    83  *  Output parameters:
    84  *    CORE_MUTEX_STATUS_SUCCESSFUL - if successful
    85  *    core error code              - if unsuccessful
    86  */
    87 
    88 CORE_mutex_Status _CORE_mutex_Surrender(
    89   CORE_mutex_Control                *the_mutex,
     71CORE_mutex_Status _CORE_mutex_Do_surrender(
     72  CORE_mutex_Control      *the_mutex,
    9073#if defined(RTEMS_MULTIPROCESSING)
    91   Objects_Id                         id,
    92   CORE_mutex_API_mp_support_callout  api_mutex_mp_support,
    93 #else
    94   Objects_Id                         id RTEMS_UNUSED,
    95   CORE_mutex_API_mp_support_callout  api_mutex_mp_support RTEMS_UNUSED,
    96 #endif
    97   ISR_lock_Context                  *lock_context
     74  Thread_queue_MP_callout  mp_callout,
     75  Objects_Id               mp_id,
     76#endif
     77  ISR_lock_Context        *lock_context
    9878)
    9979{
     
    200180      &the_mutex->Wait_queue.Queue,
    201181      the_mutex->operations,
    202       the_thread
     182      the_thread,
     183      mp_callout,
     184      mp_id
    203185    );
    204186
    205187#if defined(RTEMS_MULTIPROCESSING)
    206     _Thread_Dispatch_disable();
    207 
    208188    if ( _Objects_Is_local_id( the_thread->Object.id ) )
    209189#endif
     
    233213      &the_mutex->Wait_queue.Queue,
    234214      the_thread,
     215      mp_callout,
     216      mp_id,
    235217      lock_context
    236218    );
    237 
    238 #if defined(RTEMS_MULTIPROCESSING)
    239     if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    240       ( *api_mutex_mp_support)( the_thread, id );
    241     }
    242 
    243     _Thread_Dispatch_enable( _Per_CPU_Get() );
    244 #endif
    245219  } else {
    246220    _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
  • cpukit/score/src/corerwlockrelease.c

    r818ad5eb r8f96581  
    6767  next = _Thread_queue_Dequeue(
    6868    &the_rwlock->Wait_queue,
    69     CORE_RWLOCK_TQ_OPERATIONS
     69    CORE_RWLOCK_TQ_OPERATIONS,
     70    NULL,
     71    0
    7072  );
    7173
  • cpukit/score/src/futex.c

    r818ad5eb r8f96581  
    134134      &futex->Queue.Queue,
    135135      operations,
    136       first
     136      first,
     137      NULL,
     138      0
    137139    );
    138140    if (do_unblock) {
  • cpukit/score/src/mutex.c

    r818ad5eb r8f96581  
    146146      &mutex->Queue.Queue,
    147147      operations,
    148       first
     148      first,
     149      NULL,
     150      0
    149151    );
    150152    _Thread_queue_Boost_priority( &mutex->Queue.Queue, first );
     
    153155      &mutex->Queue.Queue,
    154156      first,
     157      NULL,
     158      0,
    155159      lock_context
    156160    );
  • cpukit/score/src/semaphore.c

    r818ad5eb r8f96581  
    134134      operations,
    135135      first,
     136      NULL,
     137      0,
    136138      &lock_context
    137139    );
  • cpukit/score/src/threadmp.c

    r818ad5eb r8f96581  
    103103    the_proxy->Wait.timeout_code            = executing->Wait.timeout_code;
    104104
     105    the_proxy->thread_queue_callout = _Thread_queue_MP_callout_do_nothing;
     106
    105107    _Chain_Append( &_Thread_MP_Active_proxies, &the_proxy->Active );
    106108
  • cpukit/score/src/threadq.c

    r818ad5eb r8f96581  
    8787#endif
    8888}
     89
     90#if defined(RTEMS_MULTIPROCESSING)
     91void _Thread_queue_MP_callout_do_nothing(
     92  Thread_Control *the_proxy,
     93  Objects_Id      mp_id
     94)
     95{
     96  /* Do nothing */
     97}
     98#endif
  • cpukit/score/src/threadqenqueue.c

    r818ad5eb r8f96581  
    3333#define THREAD_QUEUE_READY_AGAIN \
    3434  (THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_READY_AGAIN)
    35 
    36 static void _Thread_queue_Unblock( Thread_Control *the_thread )
    37 {
    38   _Thread_Timer_remove( the_thread );
    39   _Thread_Unblock( the_thread );
    40 
    41 #if defined(RTEMS_MULTIPROCESSING)
    42   if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    43     _Thread_MP_Free_proxy( the_thread );
    44   }
    45 #endif
    46 }
    4735
    4836void _Thread_queue_Enqueue_critical(
     
    10088  );
    10189  if ( !success ) {
    102     _Thread_queue_Unblock( the_thread );
     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
    103109  }
    104110
     
    106112}
    107113
    108 bool _Thread_queue_Extract_locked(
     114bool _Thread_queue_Do_extract_locked(
    109115  Thread_queue_Queue            *queue,
    110116  const Thread_queue_Operations *operations,
    111117  Thread_Control                *the_thread
     118#if defined(RTEMS_MULTIPROCESSING)
     119  ,
     120  Thread_queue_MP_callout        mp_callout,
     121  Objects_Id                     mp_id
     122#endif
    112123)
    113124{
    114125  bool success;
    115126  bool unblock;
     127
     128#if defined(RTEMS_MULTIPROCESSING)
     129  if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
     130    Thread_Proxy_control *the_proxy;
     131
     132    _Assert( mp_callout != NULL );
     133
     134    the_proxy = (Thread_Proxy_control *) the_thread;
     135    the_proxy->thread_queue_callout = mp_callout;
     136    the_proxy->thread_queue_id = mp_id;
     137  }
     138#endif
    116139
    117140  ( *operations->extract )( queue, the_thread );
     
    141164}
    142165
    143 void _Thread_queue_Unblock_critical(
    144   bool                unblock,
    145   Thread_queue_Queue *queue,
    146   Thread_Control     *the_thread,
    147   ISR_lock_Context   *lock_context
     166void _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
    148175)
    149176{
     
    154181    _Thread_queue_Queue_release( queue, lock_context );
    155182
    156     _Thread_queue_Unblock( the_thread );
     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
    157195
    158196    _Thread_Dispatch_enable( cpu_self );
     
    162200}
    163201
    164 void _Thread_queue_Extract_critical(
     202void _Thread_queue_Do_extract_critical(
    165203  Thread_queue_Queue            *queue,
    166204  const Thread_queue_Operations *operations,
    167205  Thread_Control                *the_thread,
     206#if defined(RTEMS_MULTIPROCESSING)
     207  Thread_queue_MP_callout        mp_callout,
     208  Objects_Id                     mp_id,
     209#endif
    168210  ISR_lock_Context              *lock_context
    169211)
     
    171213  bool unblock;
    172214
    173   unblock = _Thread_queue_Extract_locked( queue, operations, the_thread );
    174   _Thread_queue_Unblock_critical( unblock, queue, the_thread, lock_context );
     215  unblock = _Thread_queue_Extract_locked(
     216    queue,
     217    operations,
     218    the_thread,
     219    mp_callout,
     220    mp_id
     221  );
     222
     223  _Thread_queue_Unblock_critical(
     224    unblock,
     225    queue,
     226    the_thread,
     227    mp_callout,
     228    mp_id,
     229    lock_context
     230  );
    175231}
    176232
     
    192248      the_thread->Wait.operations,
    193249      the_thread,
     250      _Thread_queue_MP_callout_do_nothing,
     251      0,
    194252      &lock_context
    195253    );
     
    199257}
    200258
    201 Thread_Control *_Thread_queue_Dequeue(
     259Thread_Control *_Thread_queue_Do_dequeue(
    202260  Thread_queue_Control          *the_thread_queue,
    203261  const Thread_queue_Operations *operations
     262#if defined(RTEMS_MULTIPROCESSING)
     263  ,
     264  Thread_queue_MP_callout        mp_callout,
     265  Objects_Id                     mp_id
     266#endif
    204267)
    205268{
     
    218281      operations,
    219282      the_thread,
     283      mp_callout,
     284      mp_id,
    220285      &lock_context
    221286    );
  • cpukit/score/src/threadqflush.c

    r818ad5eb r8f96581  
    5252      operations,
    5353      the_thread,
     54      mp_callout,
     55      mp_id,
    5456      &lock_context
    5557    );
    56 
    57 #if defined(RTEMS_MULTIPROCESSING)
    58     if ( !_Objects_Is_local_id( the_thread->Object.id ) )
    59       ( *mp_callout )( the_thread, mp_id );
    60 #endif
    6158
    6259    _Thread_queue_Acquire( the_thread_queue, &lock_context );
Note: See TracChangeset for help on using the changeset viewer.