Changeset 78b867e2 in rtems


Ignore:
Timestamp:
Dec 21, 2017, 4:49:30 PM (3 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
4.10
Children:
b50468c
Parents:
776caaed
git-author:
Gedare Bloom <gedare@…> (12/21/17 16:49:30)
git-committer:
Gedare Bloom <gedare@…> (03/23/18 15:33:59)
Message:

score: replace current and real priority with priority node

Encapsulate the current_priority and real_priority fields of
the thread control block with a Thread_Priority_node struct.
Propagate modifications throughout the tree where the two
fields are directly accessed.

Updates #3359.

Files:
27 edited

Legend:

Unmodified
Added
Removed
  • cpukit/itron/src/chg_pri.c

    r776caaed r78b867e2  
    5353
    5454      new_priority = _ITRON_Task_Priority_to_Core( tskpri );
    55       the_thread->real_priority = new_priority;
     55      the_thread->Priority_node.real_priority = new_priority;
    5656
    5757      /*
     
    6161
    6262      if ( the_thread->resource_count == 0 ||
    63            the_thread->current_priority > new_priority )
     63           the_thread->Priority_node.current_priority > new_priority )
    6464        _Thread_Change_priority( the_thread, new_priority, false );
    6565
  • cpukit/itron/src/ref_tsk.c

    r776caaed r78b867e2  
    7575      pk_rtsk->exinf   = NULL;   /* extended information */
    7676      pk_rtsk->tskpri  =
    77                     _ITRON_Task_Core_to_Priority(the_thread->current_priority);
     77                    _ITRON_Task_Core_to_Priority(the_thread->Priority_node.current_priority);
    7878
    7979      /*
  • cpukit/itron/src/rot_rdq.c

    r776caaed r78b867e2  
    4444   */
    4545
    46   priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->current_priority);
     46  priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->Priority_node.current_priority);
    4747  if ( priority == tskpri )
    4848    _Thread_Yield_processor();
  • cpukit/libmisc/capture/capture.c

    r776caaed r78b867e2  
    532532
    533533    if ((events & RTEMS_CAPTURE_RECORD_EVENTS) ||
    534         ((task->tcb->real_priority >= capture_ceiling) &&
    535          (task->tcb->real_priority <= capture_floor) &&
     534        ((task->tcb->Priority_node.real_priority >= capture_ceiling) &&
     535         (task->tcb->Priority_node.real_priority <= capture_floor) &&
    536536         ((capture_flags & RTEMS_CAPTURE_GLOBAL_WATCH) ||
    537537          (control && (control->flags & RTEMS_CAPTURE_WATCH)))))
     
    546546        capture_in->task   = task;
    547547        capture_in->events = (events |
    548                               (task->tcb->real_priority) |
    549                               (task->tcb->current_priority << 8));
     548                              (task->tcb->Priority_node.real_priority) |
     549                              (task->tcb->Priority_node.current_priority << 8));
    550550
    551551        if ((events & RTEMS_CAPTURE_RECORD_EVENTS) == 0)
  • cpukit/libmisc/capture/capture.h

    r776caaed r78b867e2  
    712712{
    713713  if (rtems_capture_task_valid (task))
    714     return task->tcb->real_priority;
     714    return task->tcb->Priority_node.real_priority;
    715715  return 0;
    716716}
     
    727727{
    728728  if (rtems_capture_task_valid (task))
    729     return task->tcb->current_priority;
     729    return task->tcb->Priority_node.current_priority;
    730730  return 0;
    731731}
  • cpukit/libmisc/monitor/mon-task.c

    r776caaed r78b867e2  
    3030    canonical_task->stack = rtems_thread->Start.Initial_stack.area;
    3131    canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
    32     canonical_task->priority = rtems_thread->current_priority;
     32    canonical_task->priority = rtems_thread->Priority_node.current_priority;
    3333    canonical_task->state = rtems_thread->current_state;
    3434    canonical_task->wait_id = rtems_thread->Wait.id;
  • cpukit/posix/src/killinfo.c

    r776caaed r78b867e2  
    215215          the_thread->Object.id,
    216216          ((interested) ? interested->Object.id : 0),
    217           the_thread->current_priority, interested_priority,
     217          the_thread->Priority_node.current_priority, interested_priority,
    218218          the_thread->current_state
    219219        );
     
    224224       *  go on to the next thread.
    225225       */
    226       if ( the_thread->current_priority > interested_priority )
     226      if ( the_thread->Priority_node.current_priority > interested_priority )
    227227        continue;
    228228      DEBUG_STEP("2");
     
    251251       *        interested thread.
    252252       */
    253       if ( the_thread->current_priority < interested_priority ) {
     253      if ( the_thread->Priority_node.current_priority < interested_priority ) {
    254254        interested   = the_thread;
    255         interested_priority = the_thread->current_priority;
     255        interested_priority = the_thread->Priority_node.current_priority;
    256256        continue;
    257257      }
     
    271271        if ( _States_Is_ready( the_thread->current_state ) ) {
    272272          interested          = the_thread;
    273           interested_priority = the_thread->current_priority;
     273          interested_priority = the_thread->Priority_node.current_priority;
    274274          continue;
    275275        }
     
    282282            DEBUG_STEP("8");
    283283            interested          = the_thread;
    284             interested_priority = the_thread->current_priority;
     284            interested_priority = the_thread->Priority_node.current_priority;
    285285            continue;
    286286          }
  • cpukit/posix/src/pthread.c

    r776caaed r78b867e2  
    8585
    8686  new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority );
    87   the_thread->real_priority = new_priority;
     87  the_thread->Priority_node.real_priority = new_priority;
    8888
    8989  /*
     
    9292  #if 0
    9393    printk( "TSR %d %d %d\n", the_thread->resource_count,
    94         the_thread->current_priority, new_priority );
     94        the_thread->Priority_node.current_priority, new_priority );
    9595  #endif
    9696  if ( the_thread->resource_count == 0 ) {
     
    9898     *  If this would make them less important, then do not change it.
    9999     */
    100     if ( the_thread->current_priority > new_priority ) {
     100    if ( the_thread->Priority_node.current_priority > new_priority ) {
    101101      _Thread_Change_priority( the_thread, new_priority, true );
    102102      #if 0
     
    131131
    132132  new_priority = _POSIX_Priority_To_core(api->schedparam.sched_ss_low_priority);
    133   the_thread->real_priority = new_priority;
     133  the_thread->Priority_node.real_priority = new_priority;
    134134
    135135  /*
     
    138138  #if 0
    139139    printk( "callout %d %d %d\n", the_thread->resource_count,
    140         the_thread->current_priority, new_priority );
     140        the_thread->Priority_node.current_priority, new_priority );
    141141  #endif
    142142  if ( the_thread->resource_count == 0 ) {
     
    146146     *  change it.
    147147     */
    148     if ( the_thread->current_priority < new_priority ) {
     148    if ( the_thread->Priority_node.current_priority < new_priority ) {
    149149      _Thread_Change_priority( the_thread, new_priority, true );
    150150      #if 0
     
    182182  api->schedparam  = _POSIX_Threads_Default_attributes.schedparam;
    183183  api->schedparam.sched_priority =
    184      _POSIX_Priority_From_core( created->current_priority );
     184     _POSIX_Priority_From_core( created->Priority_node.current_priority );
    185185
    186186  /*
  • cpukit/posix/src/pthreadgetschedparam.c

    r776caaed r78b867e2  
    4747        *param  = api->schedparam;
    4848        param->sched_priority =
    49           _POSIX_Priority_From_core( the_thread->current_priority );
     49          _POSIX_Priority_From_core( the_thread->Priority_node.current_priority );
    5050      }
    5151      _Thread_Enable_dispatch();
  • cpukit/posix/src/pthreadsetschedparam.c

    r776caaed r78b867e2  
    7777          the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
    7878
    79           the_thread->real_priority =
     79          the_thread->Priority_node.real_priority =
    8080            _POSIX_Priority_To_core( api->schedparam.sched_priority );
    8181
    8282          _Thread_Change_priority(
    8383             the_thread,
    84              the_thread->real_priority,
     84             the_thread->Priority_node.real_priority,
    8585             true
    8686          );
  • cpukit/rtems/src/tasksetpriority.c

    r776caaed r78b867e2  
    7373    case OBJECTS_LOCAL:
    7474      /* XXX need helper to "convert" from core priority */
    75       *old_priority = the_thread->current_priority;
     75      *old_priority = the_thread->Priority_node.current_priority;
    7676      if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
    77         the_thread->real_priority = new_priority;
     77        the_thread->Priority_node.real_priority = new_priority;
    7878        if ( the_thread->resource_count == 0 ||
    79              the_thread->current_priority > new_priority )
     79             the_thread->Priority_node.current_priority > new_priority )
    8080          _Thread_Change_priority( the_thread, new_priority, false );
    8181      }
  • cpukit/score/include/rtems/score/thread.h

    r776caaed r78b867e2  
    278278
    279279/**
     280 * @brief Encapsulates base and inherited priority.
     281 */
     282typedef struct Thread_Priority_node {
     283  Chain_Node               Node;
     284  /** current priority = min(real_priority, min(Inherited_priorities)) */
     285  Priority_Control         current_priority;
     286  /** base priority irrespective of inheritance/ceiling */
     287  Priority_Control         real_priority;
     288} Thread_Priority_node;
     289
     290/**
    280291 *  The following defines the control block used to manage
    281292 *  each thread proxy.
     
    289300  /** This field is the current execution state of this proxy. */
    290301  States_Control           current_state;
    291   /** This field is the current priority state of this proxy. */
    292   Priority_Control         current_priority;
    293   /** This field is the base priority of this proxy. */
    294   Priority_Control         real_priority;
     302  /** This field encapsulates the base and current (inherited) priority
     303   * of this proxy. */
     304  Thread_Priority_node     Priority_node;
    295305  /** This field is the number of mutexes currently held by this proxy. */
    296306  uint32_t                 resource_count;
     
    339349  /** This field is the current execution state of this thread. */
    340350  States_Control           current_state;
    341   /** This field is the current priority state of this thread. */
    342   Priority_Control         current_priority;
    343   /** This field is the base priority of this thread. */
    344   Priority_Control         real_priority;
     351  /** This field encapsulates the base and current (inherited) priority
     352   * of this thread. */
     353  Thread_Priority_node     Priority_node;
    345354  /** This field is the number of mutexes currently held by this thread. */
    346355  uint32_t                 resource_count;
  • cpukit/score/inline/rtems/score/coremutex.inl

    r776caaed r78b867e2  
    147147       _Chain_Prepend_unprotected( &executing->lock_mutex,
    148148                                   &the_mutex->queue.lock_queue );
    149        the_mutex->queue.priority_before = executing->current_priority;
     149       the_mutex->queue.priority_before = executing->Priority_node.current_priority;
    150150#endif
    151151
     
    166166
    167167      ceiling = the_mutex->Attributes.priority_ceiling;
    168       current = executing->current_priority;
     168      current = executing->Priority_node.current_priority;
    169169      if ( current == ceiling ) {
    170170        _ISR_Enable( *level_p );
  • cpukit/score/src/coremutex.c

    r776caaed r78b867e2  
    7272
    7373      if ( is_priority_ceiling &&
    74            _Thread_Executing->current_priority < ceiling )
     74           _Thread_Executing->Priority_node.current_priority < ceiling )
    7575       return CORE_MUTEX_STATUS_CEILING_VIOLATED;
    7676#ifdef __RTEMS_STRICT_ORDER_MUTEX__
    7777       _Chain_Prepend_unprotected( &_Thread_Executing->lock_mutex,
    7878                                   &the_mutex->queue.lock_queue );
    79        the_mutex->queue.priority_before = _Thread_Executing->current_priority;
     79       the_mutex->queue.priority_before = _Thread_Executing->Priority_node.current_priority;
    8080#endif
    8181
  • cpukit/score/src/coremutexseize.c

    r776caaed r78b867e2  
    6262  executing = _Thread_Executing;
    6363  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
    64     if ( the_mutex->holder->current_priority > executing->current_priority ) {
     64    if ( the_mutex->holder->Priority_node.current_priority > executing->Priority_node.current_priority ) {
    6565      _Thread_Change_priority(
    6666        the_mutex->holder,
    67         executing->current_priority,
     67        executing->Priority_node.current_priority,
    6868        false
    6969      );
  • cpukit/score/src/coremutexsurrender.c

    r776caaed r78b867e2  
    136136       _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
    137137#ifdef __RTEMS_STRICT_ORDER_MUTEX__
    138     if(the_mutex->queue.priority_before != holder->current_priority)
     138    if(the_mutex->queue.priority_before != holder->Priority_node.current_priority)
    139139      _Thread_Change_priority(holder,the_mutex->queue.priority_before,true);
    140140#endif
    141141    if ( holder->resource_count == 0 &&
    142          holder->real_priority != holder->current_priority ) {
    143       _Thread_Change_priority( holder, holder->real_priority, true );
     142         holder->Priority_node.real_priority != holder->Priority_node.current_priority ) {
     143      _Thread_Change_priority( holder, holder->Priority_node.real_priority, true );
    144144    }
    145145  }
     
    175175#ifdef __RTEMS_STRICT_ORDER_MUTEX__
    176176          _Chain_Prepend_unprotected(&the_thread->lock_mutex,&the_mutex->queue.lock_queue);
    177           the_mutex->queue.priority_before = the_thread->current_priority;
     177          the_mutex->queue.priority_before = the_thread->Priority_node.current_priority;
    178178#endif
    179179          the_thread->resource_count++;
     
    182182#ifdef __RTEMS_STRICT_ORDER_MUTEX__
    183183          _Chain_Prepend_unprotected(&the_thread->lock_mutex,&the_mutex->queue.lock_queue);
    184           the_mutex->queue.priority_before = the_thread->current_priority;
     184          the_mutex->queue.priority_before = the_thread->Priority_node.current_priority;
    185185#endif
    186186          the_thread->resource_count++;
    187187          if (the_mutex->Attributes.priority_ceiling <
    188               the_thread->current_priority){
     188              the_thread->Priority_node.current_priority){
    189189              _Thread_Change_priority(
    190190                the_thread,
  • cpukit/score/src/mpci.c

    r776caaed r78b867e2  
    255255{
    256256  the_packet->source_tid      = _Thread_Executing->Object.id;
    257   the_packet->source_priority = _Thread_Executing->current_priority;
     257  the_packet->source_priority = _Thread_Executing->Priority_node.current_priority;
    258258  the_packet->to_convert =
    259259     ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
  • cpukit/score/src/threadchangepriority.c

    r776caaed r78b867e2  
    6969  if ( prepend_it &&
    7070       _Thread_Is_executing( the_thread ) &&
    71        new_priority >= the_thread->current_priority )
     71       new_priority >= the_thread->Priority_node.current_priority )
    7272    prepend_it = true;
    7373*/
     
    8989   *  we are not REALLY changing priority.
    9090   */
    91  if ( the_thread->current_priority != new_priority )
     91 if ( the_thread->Priority_node.current_priority != new_priority )
    9292    _Thread_Set_priority( the_thread, new_priority );
    9393
  • cpukit/score/src/threadclearstate.c

    r776caaed r78b867e2  
    8585         *    a pseudo-ISR system task, we need to do a context switch.
    8686         */
    87         if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
     87        if ( the_thread->Priority_node.current_priority < _Thread_Heir->Priority_node.current_priority ) {
    8888          _Thread_Heir = the_thread;
    8989          if ( _Thread_Executing->is_preemptible ||
    90                the_thread->current_priority == 0 )
     90               the_thread->Priority_node.current_priority == 0 )
    9191            _Context_Switch_necessary = true;
    9292        }
  • cpukit/score/src/threadinitialize.c

    r776caaed r78b867e2  
    193193    the_thread->suspend_count         = 0;
    194194  #endif
    195   the_thread->real_priority           = priority;
     195  the_thread->Priority_node.real_priority           = priority;
    196196  the_thread->Start.initial_priority  = priority;
    197197  _Thread_Set_priority( the_thread, priority );
  • cpukit/score/src/threadmp.c

    r776caaed r78b867e2  
    7979    the_proxy->Object.id = _MPCI_Receive_server_tcb->receive_packet->source_tid;
    8080
    81     the_proxy->current_priority =
     81    the_proxy->Priority_node.current_priority =
    8282      _MPCI_Receive_server_tcb->receive_packet->source_priority;
    8383
  • cpukit/score/src/threadqenqueuepriority.c

    r776caaed r78b867e2  
    7070  _Chain_Initialize_empty( &the_thread->Wait.Block2n );
    7171
    72   priority     = the_thread->current_priority;
     72  priority     = the_thread->Priority_node.current_priority;
    7373  header_index = _Thread_queue_Header_number( priority );
    7474  header       = &the_thread_queue->Queues.Priority[ header_index ];
     
    8383  search_thread = (Thread_Control *) header->first;
    8484  while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) {
    85     search_priority = search_thread->current_priority;
     85    search_priority = search_thread->Priority_node.current_priority;
    8686    if ( priority <= search_priority )
    8787      break;
     
    9191    if ( _Chain_Is_tail( header, (Chain_Node *)search_thread ) )
    9292      break;
    93     search_priority = search_thread->current_priority;
     93    search_priority = search_thread->Priority_node.current_priority;
    9494    if ( priority <= search_priority )
    9595      break;
     
    131131  search_thread = (Thread_Control *) header->last;
    132132  while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) {
    133     search_priority = search_thread->current_priority;
     133    search_priority = search_thread->Priority_node.current_priority;
    134134    if ( priority >= search_priority )
    135135      break;
     
    138138    if ( _Chain_Is_head( header, (Chain_Node *)search_thread ) )
    139139      break;
    140     search_priority = search_thread->current_priority;
     140    search_priority = search_thread->Priority_node.current_priority;
    141141    if ( priority >= search_priority )
    142142      break;
  • cpukit/score/src/threadreset.c

    r776caaed r78b867e2  
    6464  }
    6565
    66   if ( the_thread->current_priority != the_thread->Start.initial_priority ) {
    67     the_thread->real_priority = the_thread->Start.initial_priority;
     66  if ( the_thread->Priority_node.current_priority != the_thread->Start.initial_priority ) {
     67    the_thread->Priority_node.real_priority = the_thread->Start.initial_priority;
    6868    _Thread_Set_priority( the_thread, the_thread->Start.initial_priority );
    6969  }
  • cpukit/score/src/threadresume.c

    r776caaed r78b867e2  
    8888      _ISR_Flash( level );
    8989
    90       if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
     90      if ( the_thread->Priority_node.current_priority < _Thread_Heir->Priority_node.current_priority ) {
    9191        _Thread_Heir = the_thread;
    9292        if ( _Thread_Executing->is_preemptible ||
    93              the_thread->current_priority == 0 )
     93             the_thread->Priority_node.current_priority == 0 )
    9494          _Context_Switch_necessary = true;
    9595      }
  • cpukit/score/src/threadsetpriority.c

    r776caaed r78b867e2  
    4949)
    5050{
    51   the_thread->current_priority = new_priority;
     51  the_thread->Priority_node.current_priority = new_priority;
    5252  the_thread->ready            = &_Thread_Ready_chain[ new_priority ];
    5353
  • testsuites/sptests/sp34/changepri.c

    r776caaed r78b867e2  
    4040#if defined(TEST_PRINT_TASK_ID)
    4141  sprintf( buffer, "0x%08x -- %d",
    42       rtems_task_self(), _Thread_Executing->current_priority );
     42      rtems_task_self(), _Thread_Executing->Priority_node.current_priority );
    4343#else
    4444  volatile union {
     
    5454    sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control,
    5555      TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3],
    56       _Thread_Executing->current_priority
     56      _Thread_Executing->Priority_node.current_priority
    5757  );
    5858#endif
  • testsuites/sptests/sp35/priinv.c

    r776caaed r78b867e2  
    8282#if defined(TEST_PRINT_TASK_ID)
    8383  sprintf( buffer, "0x%08x -- %d",
    84       rtems_task_self(), _Thread_Executing->current_priority );
     84      rtems_task_self(), _Thread_Executing->Priority_node.current_priority
     85  );
    8586#else
    8687  volatile union {
     
    9697  sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control,
    9798      TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3],
    98       _Thread_Executing->current_priority
     99      _Thread_Executing->Priority_node.current_priority
    99100  );
    100101#endif
     
    248249
    249250  /* Store information about the current situation */
    250   EnterPrio = _Thread_Executing->current_priority;
     251  EnterPrio = _Thread_Executing->Priority_node.current_priority;
    251252  EnterCnt  = _Thread_Executing->resource_count;
    252253
     
    267268
    268269  /* Store information about the current situation */
    269   AccessPrio = _Thread_Executing->current_priority;
     270  AccessPrio = _Thread_Executing->Priority_node.current_priority;
    270271  AccessCnt  = _Thread_Executing->resource_count;
    271272
     
    274275
    275276  /* Store information about the current situation */
    276   LeavePrio = _Thread_Executing->current_priority;
     277  LeavePrio = _Thread_Executing->Priority_node.current_priority;
    277278  LeaveCnt  = _Thread_Executing->resource_count;
    278279
     
    309310
    310311  /* Store information about the current situation */
    311   EnterPrio = _Thread_Executing->current_priority;
     312  EnterPrio = _Thread_Executing->Priority_node.current_priority;
    312313  EnterCnt  = _Thread_Executing->resource_count;
    313314
     
    327328
    328329  /* Store information about the current situation */
    329   AccessPrio = _Thread_Executing->current_priority;
     330  AccessPrio = _Thread_Executing->Priority_node.current_priority;
    330331  AccessCnt  = _Thread_Executing->resource_count;
    331332
     
    334335
    335336  /* Store information about the current situation */
    336   LeavePrio = _Thread_Executing->current_priority;
     337  LeavePrio = _Thread_Executing->Priority_node.current_priority;
    337338  LeaveCnt  = _Thread_Executing->resource_count;
    338339
Note: See TracChangeset for help on using the changeset viewer.