Changeset 77ff5599 in rtems


Ignore:
Timestamp:
Jun 10, 2016, 6:48:54 AM (3 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.

Files:
5 added
31 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/monitor/mon-sema.c

    rb8f76fa r77ff5599  
    6262    switch ( rtems_sema->variant ) {
    6363      case SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING:
    64         canonical_sema->priority_ceiling =
    65           rtems_sema->Core_control.Mutex.priority_ceiling;
     64        canonical_sema->priority_ceiling = _Scheduler_Unmap_priority(
     65          _CORE_ceiling_mutex_Get_scheduler( &rtems_sema->Core_control.Mutex ),
     66          _CORE_ceiling_mutex_Get_priority( &rtems_sema->Core_control.Mutex )
     67        );
    6668        /* Fall through */
    6769      case SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY:
  • cpukit/posix/include/rtems/posix/priorityimpl.h

    rb8f76fa r77ff5599  
    8989 * @return The corresponding POSIX API priority.
    9090 */
    91 RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
     91int _POSIX_Priority_From_core(
    9292  const Scheduler_Control *scheduler,
    9393  Priority_Control         priority
    94 )
    95 {
    96   return (int) ( scheduler->maximum_priority - priority );
    97 }
     94);
    9895
    9996/** @} */
  • cpukit/posix/src/mutexgetprioceiling.c

    rb8f76fa r77ff5599  
    4646  _POSIX_Mutex_Acquire_critical( the_mutex, &queue_context );
    4747
    48   *prioceiling = _POSIX_Priority_From_core(
    49     &_Scheduler_Table[ 0 ],
    50     the_mutex->Mutex.priority_ceiling
    51   );
     48  if ( the_mutex->protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
     49    *prioceiling = _POSIX_Priority_From_core(
     50      _CORE_ceiling_mutex_Get_scheduler( &the_mutex->Mutex ),
     51      _CORE_ceiling_mutex_Get_priority( &the_mutex->Mutex )
     52    );
     53  } else {
     54    *prioceiling = 0;
     55  }
    5256
    5357  _POSIX_Mutex_Release( the_mutex, &queue_context );
  • cpukit/posix/src/mutexinit.c

    rb8f76fa r77ff5599  
    136136  switch ( protocol ) {
    137137    case POSIX_MUTEX_PRIORITY_CEILING:
    138       _CORE_ceiling_mutex_Initialize(
    139         &the_mutex->Mutex,
    140         priority
    141       );
     138      _CORE_ceiling_mutex_Initialize( &the_mutex->Mutex, scheduler, priority );
    142139      break;
    143140    default:
     
    146143          || the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT
    147144      );
    148       _CORE_recursive_mutex_Initialize(
    149         &the_mutex->Mutex.Recursive
    150       );
     145      _CORE_recursive_mutex_Initialize( &the_mutex->Mutex.Recursive );
    151146      break;
    152147  }
  • cpukit/posix/src/mutexsetprioceiling.c

    rb8f76fa r77ff5599  
    3232)
    3333{
    34   POSIX_Mutex_Control     *the_mutex;
    35   const Scheduler_Control *scheduler;
    36   bool                     valid;
    37   Priority_Control         priority;
    38   int                      error;
    39   int                      unlock_error;
     34  POSIX_Mutex_Control *the_mutex;
     35  int                  error;
     36  int                  unlock_error;
    4037
    41   if ( !old_ceiling )
     38  if ( old_ceiling == NULL ) {
    4239    return EINVAL;
     40  }
    4341
    4442  /*
     
    5553  _Assert( the_mutex != NULL );
    5654
    57   scheduler = &_Scheduler_Table[ 0 ];
     55  if ( the_mutex->protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
     56    const Scheduler_Control *scheduler;
     57    bool                     valid;
     58    Priority_Control         new_priority;
     59    Priority_Control         old_priority;
    5860
    59   *old_ceiling = _POSIX_Priority_From_core(
    60     scheduler,
    61     the_mutex->Mutex.priority_ceiling
    62   );
     61    scheduler = _CORE_ceiling_mutex_Get_scheduler( &the_mutex->Mutex );
     62    old_priority = _CORE_ceiling_mutex_Get_priority( &the_mutex->Mutex );
     63    *old_ceiling = _POSIX_Priority_From_core( scheduler, old_priority );
    6364
    64   priority = _POSIX_Priority_To_core( scheduler, prioceiling, &valid );
    65   if ( valid ) {
    66     the_mutex->Mutex.priority_ceiling = priority;
     65    new_priority = _POSIX_Priority_To_core( scheduler, prioceiling, &valid );
     66    if ( valid ) {
     67      _CORE_ceiling_mutex_Set_priority( &the_mutex->Mutex, new_priority );
     68      error = 0;
     69    } else {
     70      error = EINVAL;
     71    }
     72  } else {
     73    *old_ceiling = 0;
    6774    error = 0;
    68   } else {
    69     error = EINVAL;
    7075  }
    7176
  • cpukit/posix/src/psxpriorityisvalid.c

    rb8f76fa r77ff5599  
    2020
    2121#include <rtems/posix/priorityimpl.h>
     22#include <rtems/score/schedulerimpl.h>
    2223
    2324int _POSIX_Priority_Get_maximum( const Scheduler_Control *scheduler )
     
    4546    && core_posix_priority < scheduler->maximum_priority );
    4647
    47   return core_priority;
     48  return _Scheduler_Map_priority( scheduler, core_priority );
    4849}
     50
     51int _POSIX_Priority_From_core(
     52  const Scheduler_Control *scheduler,
     53  Priority_Control         core_priority
     54)
     55{
     56  core_priority = _Scheduler_Unmap_priority( scheduler, core_priority );
     57
     58  return (int) ( scheduler->maximum_priority - core_priority );
     59}
  • cpukit/posix/src/pthreadcreate.c

    rb8f76fa r77ff5599  
    104104
    105105  executing = _Thread_Get_executing();
     106  scheduler = _Scheduler_Get_own( executing );
    106107
    107108  /*
     
    198199    &_POSIX_Threads_Information,
    199200    the_thread,
    200     _Scheduler_Get( executing ),
     201    scheduler,
    201202    the_attr->stackaddr,
    202203    _POSIX_Threads_Ensure_minimum_stack(the_attr->stacksize),
  • 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}
  • cpukit/score/Makefile.am

    rb8f76fa r77ff5599  
    228228libscore_a_SOURCES += src/schedulergetaffinity.c
    229229libscore_a_SOURCES += src/schedulersetaffinity.c
     230libscore_a_SOURCES += src/schedulerdefaultmappriority.c
    230231libscore_a_SOURCES += src/schedulerdefaultnodedestroy.c
    231232libscore_a_SOURCES += src/schedulerdefaultnodeinit.c
  • cpukit/score/include/rtems/score/coremutex.h

    rb8f76fa r77ff5599  
    2727#include <rtems/score/watchdog.h>
    2828#include <rtems/score/interr.h>
     29
     30struct Scheduler_Control;
    2931
    3032#ifdef __cplusplus
     
    8486   */
    8587  Priority_Control priority_ceiling;
     88
     89#if defined(RTEMS_SMP)
     90  /**
     91   * @brief The scheduler instance for this priority ceiling mutex.
     92   */
     93  const struct Scheduler_Control *scheduler;
     94#endif
    8695} CORE_ceiling_mutex_Control;
    8796
  • cpukit/score/include/rtems/score/coremuteximpl.h

    rb8f76fa r77ff5599  
    2121#include <rtems/score/coremutex.h>
    2222#include <rtems/score/chainimpl.h>
     23#include <rtems/score/schedulerimpl.h>
    2324#include <rtems/score/status.h>
    2425#include <rtems/score/threadimpl.h>
     
    359360RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Initialize(
    360361  CORE_ceiling_mutex_Control *the_mutex,
     362  const Scheduler_Control    *scheduler,
    361363  Priority_Control            priority_ceiling
    362364)
     
    364366  _CORE_recursive_mutex_Initialize( &the_mutex->Recursive );
    365367  the_mutex->priority_ceiling = priority_ceiling;
     368#if defined(RTEMS_SMP)
     369  the_mutex->scheduler = scheduler;
     370#endif
     371}
     372
     373RTEMS_INLINE_ROUTINE const Scheduler_Control *
     374_CORE_ceiling_mutex_Get_scheduler(
     375  const CORE_ceiling_mutex_Control *the_mutex
     376)
     377{
     378#if defined(RTEMS_SMP)
     379  return the_mutex->scheduler;
     380#else
     381  return _Scheduler_Get_by_CPU_index( 0 );
     382#endif
     383}
     384
     385RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Set_priority(
     386  CORE_ceiling_mutex_Control *the_mutex,
     387  Priority_Control            priority_ceiling
     388)
     389{
     390  the_mutex->priority_ceiling = priority_ceiling;
     391}
     392
     393RTEMS_INLINE_ROUTINE Priority_Control _CORE_ceiling_mutex_Get_priority(
     394  const CORE_ceiling_mutex_Control *the_mutex
     395)
     396{
     397  return the_mutex->priority_ceiling;
    366398}
    367399
     
    415447
    416448  if ( owner == NULL ) {
     449#if defined(RTEMS_SMP)
     450    if (
     451      _Scheduler_Get_own( executing )
     452        != _CORE_ceiling_mutex_Get_scheduler( the_mutex )
     453    ) {
     454      _CORE_mutex_Release( &the_mutex->Recursive.Mutex, queue_context );
     455      return STATUS_NOT_DEFINED;
     456    }
     457#endif
     458
    417459    return _CORE_ceiling_mutex_Set_owner(
    418460      the_mutex,
  • cpukit/score/include/rtems/score/mrspimpl.h

    rb8f76fa r77ff5599  
    139139
    140140RTEMS_INLINE_ROUTINE Status_Control _MRSP_Initialize(
    141   MRSP_Control     *mrsp,
    142   Priority_Control  ceiling_priority,
    143   Thread_Control   *executing,
    144   bool              initially_locked
     141  MRSP_Control            *mrsp,
     142  const Scheduler_Control *scheduler,
     143  Priority_Control         ceiling_priority,
     144  Thread_Control          *executing,
     145  bool                     initially_locked
    145146)
    146147{
     
    160161
    161162  for ( i = 0 ; i < scheduler_count ; ++i ) {
    162     mrsp->ceiling_priorities[ i ] = ceiling_priority;
     163    const Scheduler_Control *scheduler_of_cpu;
     164
     165    scheduler_of_cpu = _Scheduler_Get_by_CPU_index( i );
     166
     167    if ( scheduler != scheduler_of_cpu ) {
     168      mrsp->ceiling_priorities[ i ] =
     169        _Scheduler_Map_priority( scheduler_of_cpu, 0 );
     170    } else {
     171      mrsp->ceiling_priorities[ i ] = ceiling_priority;
     172    }
    163173  }
    164174
     
    170180}
    171181
    172 RTEMS_INLINE_ROUTINE Priority_Control _MRSP_Get_ceiling_priority(
    173   MRSP_Control *mrsp,
    174   uint32_t      scheduler_index
    175 )
    176 {
     182RTEMS_INLINE_ROUTINE Priority_Control _MRSP_Get_priority(
     183  const MRSP_Control      *mrsp,
     184  const Scheduler_Control *scheduler
     185)
     186{
     187  uint32_t scheduler_index;
     188
     189  scheduler_index = _Scheduler_Get_index( scheduler );
    177190  return mrsp->ceiling_priorities[ scheduler_index ];
    178191}
    179192
    180 RTEMS_INLINE_ROUTINE void _MRSP_Set_ceiling_priority(
    181   MRSP_Control      *mrsp,
    182   uint32_t           scheduler_index,
    183   Priority_Control   ceiling_priority
    184 )
    185 {
    186   mrsp->ceiling_priorities[ scheduler_index ] = ceiling_priority;
     193RTEMS_INLINE_ROUTINE void _MRSP_Set_priority(
     194  MRSP_Control            *mrsp,
     195  const Scheduler_Control *scheduler,
     196  Priority_Control         new_priority
     197)
     198{
     199  uint32_t scheduler_index;
     200
     201  scheduler_index = _Scheduler_Get_index( scheduler );
     202  mrsp->ceiling_priorities[ scheduler_index ] = new_priority;
    187203}
    188204
     
    308324  Status_Control status;
    309325  const Scheduler_Control *scheduler = _Scheduler_Get_own( executing );
    310   uint32_t scheduler_index = _Scheduler_Get_index( scheduler );
    311326  Priority_Control initial_priority = executing->current_priority;
    312   Priority_Control ceiling_priority =
    313     _MRSP_Get_ceiling_priority( mrsp, scheduler_index );
     327  Priority_Control ceiling_priority = _MRSP_Get_priority( mrsp, scheduler );
    314328  bool priority_ok = !_Thread_Priority_less_than(
    315329    ceiling_priority,
  • cpukit/score/include/rtems/score/scheduler.h

    rb8f76fa r77ff5599  
    9090    Priority_Control,
    9191    bool
     92  );
     93
     94  /** @see _Scheduler_Map_priority() */
     95  Priority_Control ( *map_priority )(
     96    const Scheduler_Control *,
     97    Priority_Control
     98  );
     99
     100  /** @see _Scheduler_Unmap_priority() */
     101  Priority_Control ( *unmap_priority )(
     102    const Scheduler_Control *,
     103    Priority_Control
    92104  );
    93105
     
    404416#endif
    405417
     418/**
     419 * @brief Returns the thread priority.
     420 *
     421 * @param[in] scheduler Unused.
     422 * @param[in] priority The thread priority.
     423 *
     424 * @return priority The thread priority.
     425 */
     426Priority_Control _Scheduler_default_Map_priority(
     427  const Scheduler_Control *scheduler,
     428  Priority_Control         priority
     429);
     430
     431#define _Scheduler_default_Unmap_priority _Scheduler_default_Map_priority
     432
    406433#if defined(RTEMS_SMP)
    407434  /**
  • cpukit/score/include/rtems/score/schedulercbs.h

    rb8f76fa r77ff5599  
    5656    _Scheduler_CBS_Unblock,          /* unblock entry point */ \
    5757    _Scheduler_EDF_Change_priority,  /* change priority entry point */ \
     58    _Scheduler_EDF_Map_priority,     /* map priority entry point */ \
     59    _Scheduler_EDF_Unmap_priority,   /* unmap priority entry point */ \
    5860    SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
    5961    _Scheduler_CBS_Node_initialize,  /* node initialize entry point */ \
  • cpukit/score/include/rtems/score/scheduleredf.h

    rb8f76fa r77ff5599  
    4949    _Scheduler_EDF_Unblock,          /* unblock entry point */ \
    5050    _Scheduler_EDF_Change_priority,  /* change priority entry point */ \
     51    _Scheduler_EDF_Map_priority,     /* map priority entry point */ \
     52    _Scheduler_EDF_Unmap_priority,   /* unmap priority entry point */ \
    5153    SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
    5254    _Scheduler_EDF_Node_initialize,  /* node initialize entry point */ \
     
    204206);
    205207
     208Priority_Control _Scheduler_EDF_Map_priority(
     209  const Scheduler_Control *scheduler,
     210  Priority_Control         priority
     211);
     212
     213Priority_Control _Scheduler_EDF_Unmap_priority(
     214  const Scheduler_Control *scheduler,
     215  Priority_Control         priority
     216);
     217
    206218/**
    207219 *  @brief invoked when a thread wishes to voluntarily
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rb8f76fa r77ff5599  
    418418
    419419  _Scheduler_Release_critical( own_scheduler, &lock_context );
     420}
     421
     422/**
     423 * @brief Maps a thread priority from the user domain to the scheduler domain.
     424 *
     425 * Let M be the maximum scheduler priority.  The mapping must be bijective in
     426 * the closed interval [0, M], e.g. _Scheduler_Unmap_priority( scheduler,
     427 * _Scheduler_Map_priority( scheduler, p ) ) == p for all p in [0, M].  For
     428 * other values the mapping is undefined.
     429 *
     430 * @param[in] scheduler The scheduler instance.
     431 * @param[in] priority The user domain thread priority.
     432 *
     433 * @return The corresponding thread priority of the scheduler domain is returned.
     434 */
     435RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Map_priority(
     436  const Scheduler_Control *scheduler,
     437  Priority_Control         priority
     438)
     439{
     440  return ( *scheduler->Operations.map_priority )( scheduler, priority );
     441}
     442
     443/**
     444 * @brief Unmaps a thread priority from the scheduler domain to the user domain.
     445 *
     446 * @param[in] scheduler The scheduler instance.
     447 * @param[in] priority The scheduler domain thread priority.
     448 *
     449 * @return The corresponding thread priority of the user domain is returned.
     450 */
     451RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Unmap_priority(
     452  const Scheduler_Control *scheduler,
     453  Priority_Control         priority
     454)
     455{
     456  return ( *scheduler->Operations.unmap_priority )( scheduler, priority );
    420457}
    421458
  • cpukit/score/include/rtems/score/schedulerpriority.h

    rb8f76fa r77ff5599  
    4646    _Scheduler_priority_Unblock,          /* unblock entry point */ \
    4747    _Scheduler_priority_Change_priority,  /* change priority entry point */ \
     48    _Scheduler_default_Map_priority,      /* map priority entry point */ \
     49    _Scheduler_default_Unmap_priority,    /* unmap priority entry point */ \
    4850    SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
    4951    _Scheduler_default_Node_initialize,   /* node initialize entry point */ \
  • cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h

    rb8f76fa r77ff5599  
    5656    _Scheduler_priority_affinity_SMP_Unblock, \
    5757    _Scheduler_priority_affinity_SMP_Change_priority, \
     58    _Scheduler_default_Map_priority, \
     59    _Scheduler_default_Unmap_priority, \
    5860    _Scheduler_priority_affinity_SMP_Ask_for_help, \
    5961    _Scheduler_priority_affinity_SMP_Node_initialize, \
  • cpukit/score/include/rtems/score/schedulerprioritysmp.h

    rb8f76fa r77ff5599  
    8585    _Scheduler_priority_SMP_Unblock, \
    8686    _Scheduler_priority_SMP_Change_priority, \
     87    _Scheduler_default_Map_priority, \
     88    _Scheduler_default_Unmap_priority, \
    8789    _Scheduler_priority_SMP_Ask_for_help, \
    8890    _Scheduler_priority_SMP_Node_initialize, \
  • cpukit/score/include/rtems/score/schedulersimple.h

    rb8f76fa r77ff5599  
    4646    _Scheduler_simple_Unblock,            /* unblock entry point */ \
    4747    _Scheduler_simple_Change_priority,    /* change priority entry point */ \
     48    _Scheduler_default_Map_priority,      /* map priority entry point */ \
     49    _Scheduler_default_Unmap_priority,    /* unmap priority entry point */ \
    4850    SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
    4951    _Scheduler_default_Node_initialize,   /* node initialize entry point */ \
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    rb8f76fa r77ff5599  
    6868    _Scheduler_simple_SMP_Unblock, \
    6969    _Scheduler_simple_SMP_Change_priority, \
     70    _Scheduler_default_Map_priority, \
     71    _Scheduler_default_Unmap_priority, \
    7072    _Scheduler_simple_SMP_Ask_for_help, \
    7173    _Scheduler_simple_SMP_Node_initialize, \
  • cpukit/score/include/rtems/score/schedulerstrongapa.h

    rb8f76fa r77ff5599  
    8585    _Scheduler_strong_APA_Unblock, \
    8686    _Scheduler_strong_APA_Change_priority, \
     87    _Scheduler_default_Map_priority, \
     88    _Scheduler_default_Unmap_priority, \
    8789    _Scheduler_strong_APA_Ask_for_help, \
    8890    _Scheduler_strong_APA_Node_initialize, \
  • cpukit/score/include/rtems/score/status.h

    rb8f76fa r77ff5599  
    3939  STATUS_CLASSIC_INVALID_SIZE = 8,
    4040  STATUS_CLASSIC_NO_MEMORY = 26,
     41  STATUS_CLASSIC_NOT_DEFINED = 11,
    4142  STATUS_CLASSIC_NOT_OWNER_OF_RESOURCE = 23,
    4243  STATUS_CLASSIC_OBJECT_WAS_DELETED = 7,
     
    105106  STATUS_NO_MEMORY =
    106107    STATUS_BUILD( STATUS_CLASSIC_NO_MEMORY, EINVAL ),
     108  STATUS_NOT_DEFINED =
     109    STATUS_BUILD( STATUS_CLASSIC_NOT_DEFINED, EINVAL ),
    107110  STATUS_NOT_OWNER =
    108111    STATUS_BUILD( STATUS_CLASSIC_NOT_OWNER_OF_RESOURCE, EPERM ),
  • cpukit/score/src/scheduleredfchangepriority.c

    rb8f76fa r77ff5599  
    2020
    2121#include <rtems/score/scheduleredfimpl.h>
     22
     23Priority_Control _Scheduler_EDF_Map_priority(
     24  const Scheduler_Control *scheduler,
     25  Priority_Control         priority
     26)
     27{
     28  return SCHEDULER_EDF_PRIO_MSB | priority;
     29}
     30
     31Priority_Control _Scheduler_EDF_Unmap_priority(
     32  const Scheduler_Control *scheduler,
     33  Priority_Control         priority
     34)
     35{
     36  return priority & ~SCHEDULER_EDF_PRIO_MSB;
     37}
    2238
    2339Scheduler_Void_or_thread _Scheduler_EDF_Change_priority(
  • cpukit/score/src/threadcreateidle.c

    rb8f76fa r77ff5599  
    2020
    2121#include <rtems/score/threadimpl.h>
     22#include <rtems/score/assert.h>
    2223#include <rtems/score/schedulerimpl.h>
    2324#include <rtems/score/stackimpl.h>
     
    4849   */
    4950  idle = _Thread_Internal_allocate();
     51  _Assert( idle != NULL );
    5052
    5153  _Thread_Initialize(
     
    5658    _Stack_Ensure_minimum( rtems_configuration_get_idle_task_stack_size() ),
    5759    CPU_IDLE_TASK_IS_FP,
    58     scheduler->maximum_priority,
     60    _Scheduler_Map_priority( scheduler, scheduler->maximum_priority ),
    5961    true,        /* preemptable */
    6062    THREAD_CPU_BUDGET_ALGORITHM_NONE,
  • testsuites/psxtests/psxautoinit01/init.c

    rb8f76fa r77ff5599  
    5555  mutex2 = PTHREAD_MUTEX_INITIALIZER;
    5656  puts( "Init - pthread_mutex_getprioceiling - auto initialize - OK" );
     57  prioceiling = 1;
    5758  sc = pthread_mutex_getprioceiling( &mutex1, &prioceiling );
    5859  fatal_posix_service_status( sc, 0, "mutex getprioceiling OK" );
     60  rtems_test_assert( prioceiling == 0 );
    5961
    6062  puts( "Init - pthread_mutex_getprioceiling - auto initialize - EINVAL" );
     63  prioceiling = 1;
    6164  sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling );
    6265  fatal_posix_service_status( sc, EINVAL, "mutex getprioceiling EINVAL" );
     66  rtems_test_assert( prioceiling == 1 );
    6367
    6468  puts( "Init - pthread_mutex_destroy - OK" );
  • testsuites/smptests/Makefile.am

    rb8f76fa r77ff5599  
    4646SUBDIRS += smppsxaffinity01
    4747SUBDIRS += smppsxaffinity02
     48SUBDIRS += smppsxmutex01
    4849SUBDIRS += smppsxsignal01
    4950endif
  • testsuites/smptests/configure.ac

    rb8f76fa r77ff5599  
    5858# Explicitly list all Makefiles here
    5959AC_CONFIG_FILES([Makefile
     60smppsxmutex01/Makefile
    6061smpstrongapa01/Makefile
    6162smp01/Makefile
  • testsuites/smptests/smpscheduler02/init.c

    rb8f76fa r77ff5599  
    3636static rtems_id main_task_id;
    3737
     38static rtems_id sema_id;
     39
    3840static void task(rtems_task_argument arg)
    3941{
     
    4547  rtems_test_assert(sched_get_priority_min(SCHED_RR) == 1);
    4648  rtems_test_assert(sched_get_priority_max(SCHED_RR) == 126);
     49
     50  sc = rtems_semaphore_obtain(sema_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     51  rtems_test_assert(sc == RTEMS_NOT_DEFINED);
    4752
    4853  sc = rtems_event_transient_send(main_task_id);
     
    6267  rtems_id scheduler_b_id;
    6368  rtems_id scheduler_c_id;
     69  rtems_task_priority prio;
    6470  cpu_set_t cpuset;
    6571  cpu_set_t first_cpu;
     
    95101  sc = rtems_scheduler_ident(SCHED_C, &scheduler_c_id);
    96102  rtems_test_assert(sc == RTEMS_UNSATISFIED);
     103
     104  sc = rtems_semaphore_create(
     105    SCHED_A,
     106    1,
     107    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
     108    1,
     109    &sema_id
     110  );
     111  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     112
     113  prio = 2;
     114  sc = rtems_semaphore_set_priority(sema_id, scheduler_a_id, prio, &prio);
     115  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     116  rtems_test_assert(prio == 1);
     117
     118  if (cpu_count > 1) {
     119    prio = 1;
     120    sc = rtems_semaphore_set_priority(sema_id, scheduler_b_id, prio, &prio);
     121    rtems_test_assert(sc == RTEMS_NOT_DEFINED);
     122    rtems_test_assert(prio == 2);
     123  }
    97124
    98125  CPU_ZERO(&cpuset);
     
    183210  sc = rtems_task_delete(task_id);
    184211  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     212
     213  sc = rtems_semaphore_delete(sema_id);
     214  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    185215}
    186216
     
    213243#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
    214244
     245#define CONFIGURE_MAXIMUM_TASKS 2
     246#define CONFIGURE_MAXIMUM_SEMAPHORES 1
     247
    215248#define CONFIGURE_SMP_APPLICATION
    216249
     
    270303  RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL)
    271304
    272 #define CONFIGURE_MAXIMUM_TASKS 2
    273 
    274305#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
    275306
Note: See TracChangeset for help on using the changeset viewer.