[56c396b] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup ScoreSchedulerPriorityAffinitySMP |
---|
| 5 | * |
---|
| 6 | * @brief Deterministic Priority Affinity SMP Scheduler API |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * COPYRIGHT (c) 2014. |
---|
| 11 | * On-Line Applications Research Corporation (OAR). |
---|
| 12 | * |
---|
| 13 | * The license and distribution terms for this file may be |
---|
| 14 | * found in the file LICENSE in this distribution or at |
---|
| 15 | * http://www.rtems.org/license/LICENSE. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #ifndef _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H |
---|
| 19 | #define _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H |
---|
| 20 | |
---|
| 21 | #include <rtems/score/scheduler.h> |
---|
| 22 | #include <rtems/score/schedulerpriority.h> |
---|
| 23 | #include <rtems/score/schedulersmp.h> |
---|
| 24 | #include <rtems/score/schedulerprioritysmp.h> |
---|
| 25 | #include <rtems/score/cpuset.h> |
---|
| 26 | |
---|
| 27 | #ifdef __cplusplus |
---|
| 28 | extern "C" { |
---|
| 29 | #endif /* __cplusplus */ |
---|
| 30 | |
---|
| 31 | /** |
---|
| 32 | * @defgroup ScoreSchedulerPriorityAffinitySMP Deterministic Priority Affinity SMP Scheduler |
---|
| 33 | * |
---|
[5b1ff71a] | 34 | * @ingroup ScoreSchedulerPrioritySMP |
---|
[56c396b] | 35 | * |
---|
| 36 | * This is an extension of the Deterministic Priority SMP Scheduler. which |
---|
| 37 | * is an implementation of the global fixed priority scheduler (G-FP). |
---|
| 38 | * It adds thread to core affinity support. |
---|
| 39 | * |
---|
| 40 | * @note This is the first iteration of this scheduler. It currently tracks |
---|
| 41 | * the requested affinity to exercise the Scheduler Framework but it |
---|
| 42 | * does not honor that affinity in assigning threads to cores. This |
---|
| 43 | * will be added in a subsequent revision. |
---|
| 44 | * @{ |
---|
| 45 | */ |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * @brief Entry points for the Deterministic Priority Affinity SMP Scheduler. |
---|
| 49 | */ |
---|
| 50 | #define SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \ |
---|
| 51 | { \ |
---|
| 52 | _Scheduler_priority_SMP_Initialize, \ |
---|
[3733b224] | 53 | _Scheduler_default_Schedule, \ |
---|
[56c396b] | 54 | _Scheduler_priority_SMP_Yield, \ |
---|
| 55 | _Scheduler_priority_SMP_Block, \ |
---|
[f39f667a] | 56 | _Scheduler_priority_SMP_Unblock, \ |
---|
| 57 | _Scheduler_priority_SMP_Change_priority, \ |
---|
[8e467384] | 58 | _Scheduler_priority_affinity_SMP_Node_initialize, \ |
---|
| 59 | _Scheduler_default_Node_destroy, \ |
---|
[4d1f500] | 60 | _Scheduler_priority_SMP_Update_priority, \ |
---|
[56c396b] | 61 | _Scheduler_priority_Priority_compare, \ |
---|
| 62 | _Scheduler_default_Release_job, \ |
---|
| 63 | _Scheduler_default_Tick, \ |
---|
[6359b68] | 64 | _Scheduler_SMP_Start_idle, \ |
---|
[56c396b] | 65 | _Scheduler_priority_affinity_SMP_Get_affinity, \ |
---|
| 66 | _Scheduler_priority_affinity_SMP_Set_affinity \ |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | /** |
---|
| 70 | * @brief Allocates @a the_thread->scheduler. |
---|
| 71 | * |
---|
| 72 | * This routine allocates @a the_thread->scheduler. |
---|
| 73 | * |
---|
[c6f0a4b7] | 74 | * @param[in] scheduler points to the scheduler specific information. |
---|
[56c396b] | 75 | * @param[in] the_thread is the thread the scheduler is allocating |
---|
[c6f0a4b7] | 76 | * management memory for. |
---|
[56c396b] | 77 | */ |
---|
[8e467384] | 78 | void _Scheduler_priority_affinity_SMP_Node_initialize( |
---|
[e1598a6] | 79 | const Scheduler_Control *scheduler, |
---|
| 80 | Thread_Control *the_thread |
---|
[c6f0a4b7] | 81 | ); |
---|
[56c396b] | 82 | |
---|
| 83 | /** |
---|
| 84 | * @brief Get affinity for the priority affinity smp scheduler. |
---|
| 85 | * |
---|
[24934e36] | 86 | * @param[in] scheduler The scheduler of the thread. |
---|
[56c396b] | 87 | * @param[in] thread The associated thread. |
---|
| 88 | * @param[in] cpusetsize The size of the cpuset. |
---|
| 89 | * @param[in,out] cpuset The associated affinity set. |
---|
| 90 | * |
---|
| 91 | * @retval 0 Successfully got cpuset |
---|
| 92 | * @retval -1 The cpusetsize is invalid for the system |
---|
| 93 | */ |
---|
| 94 | bool _Scheduler_priority_affinity_SMP_Get_affinity( |
---|
[e1598a6] | 95 | const Scheduler_Control *scheduler, |
---|
| 96 | Thread_Control *thread, |
---|
| 97 | size_t cpusetsize, |
---|
| 98 | cpu_set_t *cpuset |
---|
[56c396b] | 99 | ); |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * @brief Set affinity for the priority affinity smp scheduler. |
---|
| 103 | * |
---|
[24934e36] | 104 | * @param[in] scheduler The scheduler of the thread. |
---|
[56c396b] | 105 | * @param[in] thread The associated thread. |
---|
| 106 | * @param[in] cpusetsize The size of the cpuset. |
---|
| 107 | * @param[in] cpuset Affinity new affinity set. |
---|
| 108 | * |
---|
| 109 | * @retval 0 Successful |
---|
| 110 | */ |
---|
| 111 | bool _Scheduler_priority_affinity_SMP_Set_affinity( |
---|
[e1598a6] | 112 | const Scheduler_Control *scheduler, |
---|
| 113 | Thread_Control *thread, |
---|
| 114 | size_t cpusetsize, |
---|
| 115 | cpu_set_t *cpuset |
---|
[56c396b] | 116 | ); |
---|
| 117 | |
---|
| 118 | /** |
---|
[beab7329] | 119 | * @brief Scheduler node specialization for Deterministic Priority Affinity SMP |
---|
| 120 | * schedulers. |
---|
[56c396b] | 121 | */ |
---|
| 122 | typedef struct { |
---|
| 123 | /** |
---|
[beab7329] | 124 | * @brief SMP priority scheduler node. |
---|
[56c396b] | 125 | */ |
---|
[beab7329] | 126 | Scheduler_priority_SMP_Node Base; |
---|
[56c396b] | 127 | |
---|
| 128 | /** |
---|
| 129 | * Structure containing affinity set data and size |
---|
| 130 | */ |
---|
| 131 | CPU_set_Control Affinity; |
---|
[beab7329] | 132 | } Scheduler_priority_affinity_SMP_Node; |
---|
[56c396b] | 133 | |
---|
| 134 | /** @} */ |
---|
| 135 | |
---|
| 136 | #ifdef __cplusplus |
---|
| 137 | } |
---|
| 138 | #endif /* __cplusplus */ |
---|
| 139 | |
---|
| 140 | #endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */ |
---|