Changeset 77ff5599 in rtems for cpukit/rtems


Ignore:
Timestamp:
Jun 10, 2016, 6:48:54 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7ec66e08
Parents:
b8f76fa
git-author:
Sebastian Huber <sebastian.huber@…> (06/10/16 06:48:54)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/22/16 12:36:40)
Message:

score: Introduce map priority scheduler operation

Introduce map/unmap priority scheduler operations to map thread priority
values from/to the user domain to/from the scheduler domain. Use the
map priority operation to validate the thread priority. The EDF
schedulers use this new operation to distinguish between normal
priorities and priorities obtain through a job release.

Update #2173.
Update #2556.

Location:
cpukit/rtems
Files:
3 edited

Legend:

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

    rb8f76fa r77ff5599  
    2020#include <rtems/rtems/tasks.h>
    2121#include <rtems/score/objectimpl.h>
    22 #include <rtems/score/scheduler.h>
     22#include <rtems/score/schedulerimpl.h>
    2323#include <rtems/score/threadimpl.h>
    2424
     
    9797  *valid = ( priority <= scheduler->maximum_priority );
    9898
    99   return (Priority_Control) priority;
     99  return _Scheduler_Map_priority( scheduler, (Priority_Control) priority );
    100100}
    101101
     
    114114)
    115115{
    116   return (rtems_task_priority) priority;
     116  return (rtems_task_priority)
     117    _Scheduler_Unmap_priority( scheduler, priority );
    117118}
    118119
  • cpukit/rtems/src/semcreate.c

    rb8f76fa r77ff5599  
    164164        _CORE_ceiling_mutex_Initialize(
    165165          &the_semaphore->Core_control.Mutex,
     166          scheduler,
    166167          priority
    167168        );
     
    201202        status = _MRSP_Initialize(
    202203          &the_semaphore->Core_control.MRSP,
     204          scheduler,
    203205          priority,
    204206          executing,
  • cpukit/rtems/src/semsetpriority.c

    rb8f76fa r77ff5599  
    2121#include <rtems/score/schedulerimpl.h>
    2222
     23static rtems_status_code _Semaphore_Is_scheduler_valid(
     24  const CORE_ceiling_mutex_Control *the_mutex,
     25  const Scheduler_Control          *scheduler
     26)
     27{
     28#if defined(RTEMS_SMP)
     29  if ( scheduler != _CORE_ceiling_mutex_Get_scheduler( the_mutex ) ) {
     30    return RTEMS_NOT_DEFINED;
     31  }
     32#endif
     33
     34  return RTEMS_SUCCESSFUL;
     35}
     36
    2337static rtems_status_code _Semaphore_Set_priority(
    2438  Semaphore_Control       *the_semaphore,
     
    3347  Priority_Control     core_priority;
    3448  Priority_Control     old_priority;
    35 #if defined(RTEMS_SMP)
    36   MRSP_Control        *mrsp;
    37   uint32_t             scheduler_index;
    38 #endif
    3949
    4050  core_priority = _RTEMS_Priority_To_core( scheduler, new_priority, &valid );
     
    4353  }
    4454
     55  _Thread_queue_Acquire_critical(
     56    &the_semaphore->Core_control.Wait_queue,
     57    &queue_context->Lock_context
     58  );
     59
    4560  switch ( the_semaphore->variant ) {
    4661    case SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING:
    47       _CORE_mutex_Acquire_critical(
    48         &the_semaphore->Core_control.Mutex.Recursive.Mutex,
    49         queue_context
     62      sc = _Semaphore_Is_scheduler_valid(
     63        &the_semaphore->Core_control.Mutex,
     64        scheduler
    5065      );
    5166
    52       old_priority = the_semaphore->Core_control.Mutex.priority_ceiling;
     67      old_priority = _CORE_ceiling_mutex_Get_priority(
     68        &the_semaphore->Core_control.Mutex
     69      );
    5370
    54       if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
    55         the_semaphore->Core_control.Mutex.priority_ceiling = core_priority;
     71      if ( sc == RTEMS_SUCCESSFUL && new_priority != RTEMS_CURRENT_PRIORITY ) {
     72        _CORE_ceiling_mutex_Set_priority(
     73          &the_semaphore->Core_control.Mutex,
     74          core_priority
     75        );
    5676      }
    5777
    58       _CORE_mutex_Release(
    59         &the_semaphore->Core_control.Mutex.Recursive.Mutex,
    60         queue_context
    61       );
    62       sc = RTEMS_SUCCESSFUL;
    6378      break;
    6479#if defined(RTEMS_SMP)
    6580    case SEMAPHORE_VARIANT_MRSP:
    66       mrsp = &the_semaphore->Core_control.MRSP;
    67       scheduler_index = _Scheduler_Get_index( scheduler );
    68 
    69       _MRSP_Acquire_critical( mrsp, queue_context );
    70 
    71       old_priority = _MRSP_Get_ceiling_priority( mrsp, scheduler_index );
     81      old_priority = _MRSP_Get_priority(
     82        &the_semaphore->Core_control.MRSP,
     83        scheduler
     84      );
    7285
    7386      if ( new_priority != RTEMS_CURRENT_PRIORITY ) {
    74         _MRSP_Set_ceiling_priority( mrsp, scheduler_index, core_priority );
     87        _MRSP_Set_priority(
     88          &the_semaphore->Core_control.MRSP,
     89          scheduler,
     90          core_priority
     91        );
    7592      }
    7693
    77       _MRSP_Release( mrsp, queue_context );
    7894      sc = RTEMS_SUCCESSFUL;
    7995      break;
     
    86102          || the_semaphore->variant == SEMAPHORE_VARIANT_COUNTING
    87103      );
    88       _ISR_lock_ISR_enable( &queue_context->Lock_context );
    89104      old_priority = 0;
    90105      sc = RTEMS_NOT_DEFINED;
     
    92107  }
    93108
     109  _Thread_queue_Release(
     110    &the_semaphore->Core_control.Wait_queue,
     111    &queue_context->Lock_context
     112  );
     113
    94114  *old_priority_p = _RTEMS_Priority_From_core( scheduler, old_priority );
    95 
    96115  return sc;
    97116}
Note: See TracChangeset for help on using the changeset viewer.