Changeset 3f3f4248 in rtems


Ignore:
Timestamp:
Oct 17, 2017, 7:20:20 AM (17 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
37eb717
Parents:
2be22d4
git-author:
Sebastian Huber <sebastian.huber@…> (10/17/17 07:20:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/17/17 09:10:00)
Message:

posix: Remove POSIX_API_Control::schedparam

Move sporadic server scheduler parameters to
POSIX_API_Control::Sporadic. Remove redundant scheduler priority
parameter.

Update #2514.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/include/rtems/posix/pthreadattrimpl.h

    r2be22d4 r3f3f4248  
    2525#include <rtems/score/basedefs.h>
    2626#include <rtems/score/assert.h>
     27#include <rtems/posix/priorityimpl.h>
     28#include <rtems/posix/threadsup.h>
    2729
    2830#ifdef __cplusplus
     
    6264}
    6365
     66RTEMS_INLINE_ROUTINE void _POSIX_Threads_Get_sched_param_sporadic(
     67  const Thread_Control    *the_thread,
     68  const POSIX_API_Control *api,
     69  const Scheduler_Control *scheduler,
     70  struct sched_param      *param
     71)
     72{
     73  param->sched_ss_low_priority = _POSIX_Priority_From_core(
     74    scheduler,
     75    api->Sporadic.Low_priority.priority
     76  );
     77  param->sched_ss_repl_period = api->Sporadic.sched_ss_repl_period;
     78  param->sched_ss_init_budget = api->Sporadic.sched_ss_init_budget;
     79  param->sched_ss_max_repl = api->Sporadic.sched_ss_max_repl;
     80}
     81
    6482/** @} */
    6583
  • cpukit/posix/include/rtems/posix/pthreadimpl.h

    r2be22d4 r3f3f4248  
    5555{
    5656  the_thread->cpu_time_budget =
    57     _Timespec_To_ticks( &api->schedparam.sched_ss_init_budget );
     57    _Timespec_To_ticks( &api->Sporadic.sched_ss_init_budget );
    5858
    5959  _Watchdog_Per_CPU_insert_ticks(
    6060    &api->Sporadic.Timer,
    6161    _Per_CPU_Get(),
    62     _Timespec_To_ticks( &api->schedparam.sched_ss_repl_period )
     62    _Timespec_To_ticks( &api->Sporadic.sched_ss_repl_period )
    6363  );
    6464}
  • cpukit/posix/include/rtems/posix/threadsup.h

    r2be22d4 r3f3f4248  
    4747  int schedpolicy;
    4848
    49   /** The scheduler parameters */
    50   struct sched_param schedparam;
    51 
    5249  /**
    5350   * @brief Control block for the sporadic server scheduling policy.
     
    6865     */
    6966    Priority_Node Low_priority;
     67
     68    /**
     69     * @brief Replenishment period for sporadic server.
     70     */
     71    struct timespec sched_ss_repl_period;
     72
     73    /**
     74     * @brief Initial budget for sporadic server.
     75     */
     76    struct timespec sched_ss_init_budget;
     77
     78    /**
     79     * @brief Maximum pending replenishments.
     80     *
     81     * Only used by pthread_getschedparam() and pthread_getattr_np().
     82    */
     83    int sched_ss_max_repl;
    7084  } Sporadic;
    7185
  • cpukit/posix/src/pthread.c

    r2be22d4 r3f3f4248  
    127127  api = created->API_Extensions[ THREAD_API_POSIX ];
    128128
    129   /* XXX check all fields are touched */
    130   api->schedparam.sched_priority = _POSIX_Priority_From_core(
    131     _Thread_Scheduler_get_home( created ),
    132     _Thread_Get_priority( created )
    133   );
    134 
    135129  /*
    136130   *  If the thread is not a posix thread, then all posix signals are blocked
  • cpukit/posix/src/pthreadcreate.c

    r2be22d4 r3f3f4248  
    242242    ( the_attr->inheritsched == PTHREAD_EXPLICIT_SCHED );
    243243  api->schedpolicy = the_attr->schedpolicy;
    244   api->schedparam = the_attr->schedparam;
     244
    245245  _Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
     246  api->Sporadic.sched_ss_repl_period =
     247    the_attr->schedparam.sched_ss_repl_period;
     248  api->Sporadic.sched_ss_init_budget =
     249    the_attr->schedparam.sched_ss_init_budget;
     250  api->Sporadic.sched_ss_max_repl =
     251    the_attr->schedparam.sched_ss_max_repl;
    246252
    247253  if ( schedpolicy == SCHED_SPORADIC ) {
  • cpukit/posix/src/pthreadgetattrnp.c

    r2be22d4 r3f3f4248  
    2525
    2626#include <rtems/posix/pthreadimpl.h>
     27#include <rtems/posix/pthreadattrimpl.h>
     28#include <rtems/posix/priorityimpl.h>
    2729#include <rtems/score/schedulerimpl.h>
    2830#include <rtems/score/threadimpl.h>
     
    3335)
    3436{
    35   Thread_Control    *the_thread;
    36   ISR_lock_Context   lock_context;
    37   POSIX_API_Control *api;
    38   bool               ok;
     37  Thread_Control          *the_thread;
     38  ISR_lock_Context         lock_context;
     39  POSIX_API_Control       *api;
     40  const Scheduler_Control *scheduler;
     41  bool                     ok;
    3942
    4043  if ( attr == NULL ) {
     
    6669
    6770  attr->schedpolicy = api->schedpolicy;
    68   attr->schedparam = api->schedparam;
     71
     72  scheduler = _Thread_Scheduler_get_home( the_thread );
     73  attr->schedparam.sched_priority = _POSIX_Priority_From_core(
     74    scheduler,
     75    _Thread_Get_priority( the_thread )
     76  );
     77  _POSIX_Threads_Get_sched_param_sporadic(
     78    the_thread,
     79    api,
     80    scheduler,
     81    &attr->schedparam
     82  );
    6983  attr->cputime_clock_allowed = 1;
    7084
  • cpukit/posix/src/pthreadgetschedparam.c

    r2be22d4 r3f3f4248  
    2626
    2727#include <rtems/posix/pthreadimpl.h>
     28#include <rtems/posix/pthreadattrimpl.h>
    2829#include <rtems/posix/priorityimpl.h>
    2930#include <rtems/score/schedulerimpl.h>
     
    5859
    5960  *policy = api->schedpolicy;
    60   *param  = api->schedparam;
    61 
    6261  scheduler = _Thread_Scheduler_get_home( the_thread );
     62  _POSIX_Threads_Get_sched_param_sporadic( the_thread, api, scheduler, param );
    6363  priority = the_thread->Real_priority.priority;
    6464
  • cpukit/posix/src/pthreadsetschedparam.c

    r2be22d4 r3f3f4248  
    4242  const Scheduler_Control *scheduler;
    4343  POSIX_API_Control       *api;
     44  int                      normal_prio;
    4445  int                      low_prio;
    45   int                      high_prio;
    4646  bool                     valid;
    4747  Priority_Control         core_normal_prio;
    4848  Priority_Control         core_low_prio;
    4949
    50   if ( policy == SCHED_SPORADIC ) {
    51     low_prio = param->sched_ss_low_priority;
    52     high_prio = param->sched_priority;
    53   } else {
    54     low_prio = param->sched_priority;
    55     high_prio = low_prio;
    56   }
     50  normal_prio = param->sched_priority;
    5751
    5852  scheduler = _Thread_Scheduler_get_home( the_thread );
    5953
    60   core_normal_prio = _POSIX_Priority_To_core( scheduler, low_prio, &valid );
     54  core_normal_prio = _POSIX_Priority_To_core( scheduler, normal_prio, &valid );
    6155  if ( !valid ) {
    6256    return EINVAL;
    6357  }
    6458
    65   core_low_prio = _POSIX_Priority_To_core( scheduler, high_prio, &valid );
     59  if ( policy == SCHED_SPORADIC ) {
     60    low_prio = param->sched_ss_low_priority;
     61  } else {
     62    low_prio = normal_prio;
     63  }
     64
     65  core_low_prio = _POSIX_Priority_To_core( scheduler, low_prio, &valid );
    6666  if ( !valid ) {
    6767    return EINVAL;
     
    9696
    9797  api->schedpolicy = policy;
    98   api->schedparam  = *param;
    9998
    10099  the_thread->budget_algorithm = budget_algorithm;
    101100  the_thread->budget_callout   = budget_callout;
    102101
     102  _Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
     103  api->Sporadic.sched_ss_repl_period = param->sched_ss_repl_period;
     104  api->Sporadic.sched_ss_init_budget = param->sched_ss_init_budget;
     105  api->Sporadic.sched_ss_max_repl = param->sched_ss_max_repl;
     106
    103107  if ( policy == SCHED_SPORADIC ) {
    104     _Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );
    105108    _POSIX_Threads_Sporadic_timer_insert( the_thread, api );
    106109  } else {
  • testsuites/psxtests/psxgetattrnp01/init.c

    r2be22d4 r3f3f4248  
    6363    return 1;
    6464
    65   if (memcmp(
    66     &attr1->schedparam,
    67     &attr2->schedparam,
    68     sizeof(struct sched_param)
    69   ))
     65  if ( attr1->schedparam.sched_priority != attr2->schedparam.sched_priority )
    7066    return 1;
    7167
Note: See TracChangeset for help on using the changeset viewer.