Changeset cfe457f in rtems


Ignore:
Timestamp:
Mar 6, 2014, 2:37:21 PM (6 years ago)
Author:
Jennifer Averett <jennifer.averett@…>
Branches:
4.11, master
Children:
56c396b
Parents:
1a6093d
git-author:
Jennifer Averett <jennifer.averett@…> (03/06/14 14:37:21)
git-committer:
Jennifer Averett <jennifer.averett@…> (04/03/14 15:46:24)
Message:

score: score: Add get/set affinity to Scheduler Framework.

Location:
cpukit/score
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r1a6093d rcfe457f  
    131131libscore_a_SOURCES += src/cpuset.c
    132132libscore_a_SOURCES += src/cpusetprintsupport.c
     133libscore_a_SOURCES += src/schedulerdefaultgetaffinity.c
     134libscore_a_SOURCES += src/schedulerdefaultsetaffinity.c
    133135endif
    134136
  • cpukit/score/include/rtems/score/cpusetimpl.h

    r1a6093d rcfe457f  
    3535 * valid cpu is set and that no invalid cpus are set.
    3636 */
    37 int _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize );
     37bool _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize );
    3838
    3939/**
  • cpukit/score/include/rtems/score/scheduler.h

    r1a6093d rcfe457f  
    2323#include <rtems/score/chain.h>
    2424#include <rtems/score/priority.h>
     25#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
     26  #include <sys/cpuset.h>
     27#endif
    2528
    2629#ifdef __cplusplus
     
    99102   */
    100103  void ( *start_idle )( Thread_Control *thread, Per_CPU_Control *processor );
     104
     105#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
     106  /**
     107   * @brief Obtain the processor affinity for a thread.
     108   *
     109   * @see _Scheduler_Get_affinity().
     110   */
     111  bool ( *get_affinity )( Thread_Control *thread, size_t cpusetsize, cpu_set_t *cpuset );
     112 
     113  /**
     114   * @brief Set the processor affinity for a thread.
     115   *
     116   * @see _Scheduler_Set_affinity().
     117   */
     118  bool ( *set_affinity )(
     119    Thread_Control  *thread,
     120    size_t           cpusetsize,
     121    const cpu_set_t *cpuset
     122  );
     123#endif
     124
    101125} Scheduler_Operations;
    102126
     
    191215extern const bool _Scheduler_FIXME_thread_priority_queues_are_broken;
    192216
     217#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
     218
     219  /**
     220   * @brief Get affinity for the default scheduler.
     221   *
     222   * @param[in] thread The associated thread.
     223   * @param[in] cpusetsize The size of the cpuset.
     224   * @param[out] cpuset Affinity set containing all CPUs.
     225   *
     226   * @retval 0 Successfully got cpuset
     227   * @retval -1 The cpusetsize is invalid for the system
     228   */
     229  bool _Scheduler_default_Get_affinity(
     230    Thread_Control *thread,
     231    size_t          cpusetsize,
     232    cpu_set_t      *cpuset
     233  );
     234
     235  /**
     236   * @brief Set affinity for the default scheduler.
     237   *
     238   * @param[in] thread The associated thread.
     239   * @param[in] cpusetsize The size of the cpuset.
     240   * @param[in] cpuset Affinity new affinity set.
     241   *
     242   * @retval 0 Successful
     243   *
     244   *  This method always returns successful and does not save
     245   *  the cpuset.
     246   */
     247  bool _Scheduler_default_Set_affinity(
     248    Thread_Control  *thread,
     249    size_t           cpusetsize,
     250    const cpu_set_t *cpuset
     251  );
     252#endif
     253
    193254/**@}*/
    194255
  • cpukit/score/include/rtems/score/schedulerimpl.h

    r1a6093d rcfe457f  
    241241}
    242242
     243#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
     244  /**
     245   * @brief Obtain the processor affinity for a thread.
     246   *
     247   * @param[in,out] thread The thread.
     248   * @parma[out] cpuset The processor affinity for this thread
     249   */
     250  RTEMS_INLINE_ROUTINE int _Scheduler_Get_affinity(
     251    Thread_Control *thread,
     252    size_t          cpusetsize,
     253    cpu_set_t      *cpuset
     254  )
     255  {
     256    return (*_Scheduler.Operations.get_affinity)( thread, cpusetsize, cpuset );
     257  }
     258
     259  /**
     260   * @brief Set the processor affinity for a thread.
     261   *
     262   * @param[in,out] thread The thread.
     263   * @parma[in] cpuset The processor affinity for this thread
     264   */
     265  RTEMS_INLINE_ROUTINE int _Scheduler_Set_affinity(
     266    Thread_Control   *thread,
     267    size_t            cpusetsize,
     268    const cpu_set_t  *cpuset
     269  )
     270  {
     271    return (*_Scheduler.Operations.set_affinity)( thread, cpusetsize, cpuset );
     272  }
     273#endif
     274
    243275RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir(
    244276  Thread_Control *heir,
  • cpukit/score/include/rtems/score/schedulerpriority.h

    r1a6093d rcfe457f  
    3434 */
    3535/**@{*/
     36
     37#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
     38  #define SCHEDULER_PRIORITY_ADDITIONAL_SMP_ENTRY_POINTS \
     39    _Scheduler_default_Get_affinity,     /* get affinity entry point */ \
     40    _Scheduler_default_Set_affinity      /* set affinity entry point */
     41#else
     42  #define SCHEDULER_PRIORITY_ADDITIONAL_SMP_ENTRY_POINTS
     43#endif
    3644
    3745/**
     
    5462    _Scheduler_default_Release_job,       /* new period of task */ \
    5563    _Scheduler_default_Tick,              /* tick entry point */ \
    56     _Scheduler_default_Start_idle         /* start idle entry point */ \
     64    _Scheduler_default_Start_idle,        /* start idle entry point */ \
     65    SCHEDULER_PRIORITY_ADDITIONAL_SMP_ENTRY_POINTS \
    5766  }
    5867
  • cpukit/score/include/rtems/score/schedulerprioritysmp.h

    r1a6093d rcfe457f  
    4949
    5050/**
    51  * @brief Entry points for the Simple SMP Scheduler.
     51 * @brief Entry points for the Priority SMP Scheduler.
    5252 */
    5353#define SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \
     
    6767    _Scheduler_default_Release_job, \
    6868    _Scheduler_default_Tick, \
    69     _Scheduler_priority_SMP_Start_idle \
     69    _Scheduler_priority_SMP_Start_idle, \
     70    _Scheduler_default_Get_affinity, \
     71    _Scheduler_default_Set_affinity \
    7072  }
    7173
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    r1a6093d rcfe457f  
    6969    _Scheduler_default_Release_job, \
    7070    _Scheduler_default_Tick, \
    71     _Scheduler_simple_smp_Start_idle \
     71    _Scheduler_simple_smp_Start_idle, \
     72    _Scheduler_default_Get_affinity, \
     73    _Scheduler_default_Set_affinity \
    7274  }
    7375
  • cpukit/score/src/cpuset.c

    r1a6093d rcfe457f  
    5858 * valid cpu is set and that no invalid cpus are set.
    5959 */
    60 int _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize )
     60bool _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize )
    6161{
    6262  cpu_set_t             temp;
    6363
    6464  if ( !cpuset )
    65     return -1;
     65    false;
    6666
    6767  if (setsize != cpuset_default.setsize )
    68     return -1;
     68    return false;
    6969
    7070  /* Validate at least 1 valid cpu is set in cpuset */
     
    7272
    7373  if ( CPU_COUNT_S( setsize, &temp ) == 0 )
    74     return -1;
     74    return false;
    7575
    7676  /* Validate that no invalid cpu's are set in cpuset */
    7777  if ( !CPU_EQUAL_S( setsize, &temp, cpuset ) )
    78     return -1;
     78    return false;
    7979
    80   return 0;
     80  return true;
    8181}
    8282
Note: See TracChangeset for help on using the changeset viewer.