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 | * |
---|
34 | * @ingroup ScoreSchedulerPrioritySMP |
---|
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, \ |
---|
53 | _Scheduler_default_Schedule, \ |
---|
54 | _Scheduler_priority_SMP_Yield, \ |
---|
55 | _Scheduler_priority_affinity_SMP_Block, \ |
---|
56 | _Scheduler_priority_affinity_SMP_Unblock, \ |
---|
57 | _Scheduler_priority_affinity_SMP_Update_priority, \ |
---|
58 | _Scheduler_default_Map_priority, \ |
---|
59 | _Scheduler_default_Unmap_priority, \ |
---|
60 | _Scheduler_priority_affinity_SMP_Ask_for_help, \ |
---|
61 | _Scheduler_priority_affinity_SMP_Reconsider_help_request, \ |
---|
62 | _Scheduler_priority_affinity_SMP_Withdraw_node, \ |
---|
63 | _Scheduler_priority_affinity_SMP_Node_initialize, \ |
---|
64 | _Scheduler_default_Node_destroy, \ |
---|
65 | _Scheduler_default_Release_job, \ |
---|
66 | _Scheduler_default_Cancel_job, \ |
---|
67 | _Scheduler_default_Tick, \ |
---|
68 | _Scheduler_SMP_Start_idle, \ |
---|
69 | _Scheduler_priority_affinity_SMP_Get_affinity, \ |
---|
70 | _Scheduler_priority_affinity_SMP_Set_affinity \ |
---|
71 | } |
---|
72 | |
---|
73 | /** |
---|
74 | * @brief Initializes per thread scheduler information |
---|
75 | * |
---|
76 | * This routine allocates @a thread->scheduler. |
---|
77 | * |
---|
78 | * @param[in] scheduler points to the scheduler specific information. |
---|
79 | * @param[in] node is the node the scheduler is allocating |
---|
80 | * management memory for. |
---|
81 | * @param[in] the_thread the thread of the node. |
---|
82 | * @param[in] priority is the thread priority. |
---|
83 | */ |
---|
84 | void _Scheduler_priority_affinity_SMP_Node_initialize( |
---|
85 | const Scheduler_Control *scheduler, |
---|
86 | Scheduler_Node *node, |
---|
87 | Thread_Control *the_thread, |
---|
88 | Priority_Control priority |
---|
89 | ); |
---|
90 | |
---|
91 | void _Scheduler_priority_affinity_SMP_Block( |
---|
92 | const Scheduler_Control *scheduler, |
---|
93 | Thread_Control *thread, |
---|
94 | Scheduler_Node *node |
---|
95 | ); |
---|
96 | |
---|
97 | Thread_Control *_Scheduler_priority_affinity_SMP_Unblock( |
---|
98 | const Scheduler_Control *scheduler, |
---|
99 | Thread_Control *thread, |
---|
100 | Scheduler_Node *node |
---|
101 | ); |
---|
102 | |
---|
103 | /** |
---|
104 | * @brief Get affinity for the priority affinity SMP scheduler. |
---|
105 | * |
---|
106 | * @param[in] scheduler The scheduler of the thread. |
---|
107 | * @param[in] thread The associated thread. |
---|
108 | * @param[in] cpusetsize The size of the cpuset. |
---|
109 | * @param[in,out] cpuset The associated affinity set. |
---|
110 | * |
---|
111 | * @retval 0 Successfully got cpuset |
---|
112 | * @retval -1 The cpusetsize is invalid for the system |
---|
113 | */ |
---|
114 | bool _Scheduler_priority_affinity_SMP_Get_affinity( |
---|
115 | const Scheduler_Control *scheduler, |
---|
116 | Thread_Control *thread, |
---|
117 | size_t cpusetsize, |
---|
118 | cpu_set_t *cpuset |
---|
119 | ); |
---|
120 | |
---|
121 | void _Scheduler_priority_affinity_SMP_Update_priority( |
---|
122 | const Scheduler_Control *scheduler, |
---|
123 | Thread_Control *the_thread, |
---|
124 | Scheduler_Node *node |
---|
125 | ); |
---|
126 | |
---|
127 | bool _Scheduler_priority_affinity_SMP_Ask_for_help( |
---|
128 | const Scheduler_Control *scheduler, |
---|
129 | Thread_Control *the_thread, |
---|
130 | Scheduler_Node *node |
---|
131 | ); |
---|
132 | |
---|
133 | void _Scheduler_priority_affinity_SMP_Reconsider_help_request( |
---|
134 | const Scheduler_Control *scheduler, |
---|
135 | Thread_Control *the_thread, |
---|
136 | Scheduler_Node *node |
---|
137 | ); |
---|
138 | |
---|
139 | void _Scheduler_priority_affinity_SMP_Withdraw_node( |
---|
140 | const Scheduler_Control *scheduler, |
---|
141 | Thread_Control *the_thread, |
---|
142 | Scheduler_Node *node, |
---|
143 | Thread_Scheduler_state next_state |
---|
144 | ); |
---|
145 | |
---|
146 | /** |
---|
147 | * @brief Set affinity for the priority affinity SMP scheduler. |
---|
148 | * |
---|
149 | * @param[in] scheduler The scheduler of the thread. |
---|
150 | * @param[in] thread The associated thread. |
---|
151 | * @param[in] cpusetsize The size of the cpuset. |
---|
152 | * @param[in] cpuset Affinity new affinity set. |
---|
153 | * |
---|
154 | * @retval true if successful |
---|
155 | * @retval false if unsuccessful |
---|
156 | */ |
---|
157 | bool _Scheduler_priority_affinity_SMP_Set_affinity( |
---|
158 | const Scheduler_Control *scheduler, |
---|
159 | Thread_Control *thread, |
---|
160 | size_t cpusetsize, |
---|
161 | const cpu_set_t *cpuset |
---|
162 | ); |
---|
163 | |
---|
164 | /** |
---|
165 | * @brief Scheduler node specialization for Deterministic Priority Affinity SMP |
---|
166 | * schedulers. |
---|
167 | * |
---|
168 | * This is a per thread structure. |
---|
169 | */ |
---|
170 | typedef struct { |
---|
171 | /** |
---|
172 | * @brief SMP priority scheduler node. |
---|
173 | */ |
---|
174 | Scheduler_priority_SMP_Node Base; |
---|
175 | |
---|
176 | /** |
---|
177 | * Structure containing affinity set data and size |
---|
178 | */ |
---|
179 | CPU_set_Control Affinity; |
---|
180 | } Scheduler_priority_affinity_SMP_Node; |
---|
181 | |
---|
182 | /** @} */ |
---|
183 | |
---|
184 | #ifdef __cplusplus |
---|
185 | } |
---|
186 | #endif /* __cplusplus */ |
---|
187 | |
---|
188 | #endif /* _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H */ |
---|