RTEMS  5.0.0
scheduleredfsmp.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2017, 2018 embedded brains GmbH.
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifndef _RTEMS_SCORE_SCHEDULEREDFSMP_H
18 #define _RTEMS_SCORE_SCHEDULEREDFSMP_H
19 
20 #include <rtems/score/scheduler.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
36 typedef struct {
37  Scheduler_SMP_Node Base;
38 
43  int64_t generation;
44 
54 
59 
65 
66 typedef struct {
71 
75  RBTree_Control Queue;
76 
82 
83 typedef struct {
85 
89  int64_t generations[ 2 ];
90 
96 
103  Scheduler_EDF_SMP_Ready_queue Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
105 
106 #define SCHEDULER_EDF_SMP_ENTRY_POINTS \
107  { \
108  _Scheduler_EDF_SMP_Initialize, \
109  _Scheduler_default_Schedule, \
110  _Scheduler_EDF_SMP_Yield, \
111  _Scheduler_EDF_SMP_Block, \
112  _Scheduler_EDF_SMP_Unblock, \
113  _Scheduler_EDF_SMP_Update_priority, \
114  _Scheduler_EDF_Map_priority, \
115  _Scheduler_EDF_Unmap_priority, \
116  _Scheduler_EDF_SMP_Ask_for_help, \
117  _Scheduler_EDF_SMP_Reconsider_help_request, \
118  _Scheduler_EDF_SMP_Withdraw_node, \
119  _Scheduler_EDF_SMP_Pin, \
120  _Scheduler_EDF_SMP_Unpin, \
121  _Scheduler_EDF_SMP_Add_processor, \
122  _Scheduler_EDF_SMP_Remove_processor, \
123  _Scheduler_EDF_SMP_Node_initialize, \
124  _Scheduler_default_Node_destroy, \
125  _Scheduler_EDF_Release_job, \
126  _Scheduler_EDF_Cancel_job, \
127  _Scheduler_default_Tick, \
128  _Scheduler_EDF_SMP_Start_idle, \
129  _Scheduler_EDF_SMP_Set_affinity \
130  }
131 
132 void _Scheduler_EDF_SMP_Initialize( const Scheduler_Control *scheduler );
133 
134 void _Scheduler_EDF_SMP_Node_initialize(
135  const Scheduler_Control *scheduler,
136  Scheduler_Node *node,
137  Thread_Control *the_thread,
138  Priority_Control priority
139 );
140 
141 void _Scheduler_EDF_SMP_Block(
142  const Scheduler_Control *scheduler,
143  Thread_Control *thread,
144  Scheduler_Node *node
145 );
146 
147 void _Scheduler_EDF_SMP_Unblock(
148  const Scheduler_Control *scheduler,
149  Thread_Control *thread,
150  Scheduler_Node *node
151 );
152 
153 void _Scheduler_EDF_SMP_Update_priority(
154  const Scheduler_Control *scheduler,
155  Thread_Control *the_thread,
156  Scheduler_Node *node
157 );
158 
159 bool _Scheduler_EDF_SMP_Ask_for_help(
160  const Scheduler_Control *scheduler,
161  Thread_Control *the_thread,
162  Scheduler_Node *node
163 );
164 
165 void _Scheduler_EDF_SMP_Reconsider_help_request(
166  const Scheduler_Control *scheduler,
167  Thread_Control *the_thread,
168  Scheduler_Node *node
169 );
170 
171 void _Scheduler_EDF_SMP_Withdraw_node(
172  const Scheduler_Control *scheduler,
173  Thread_Control *the_thread,
174  Scheduler_Node *node,
175  Thread_Scheduler_state next_state
176 );
177 
178 void _Scheduler_EDF_SMP_Pin(
179  const Scheduler_Control *scheduler,
180  Thread_Control *the_thread,
181  Scheduler_Node *node,
182  struct Per_CPU_Control *cpu
183 );
184 
185 void _Scheduler_EDF_SMP_Unpin(
186  const Scheduler_Control *scheduler,
187  Thread_Control *the_thread,
188  Scheduler_Node *node,
189  struct Per_CPU_Control *cpu
190 );
191 
192 void _Scheduler_EDF_SMP_Add_processor(
193  const Scheduler_Control *scheduler,
194  Thread_Control *idle
195 );
196 
197 Thread_Control *_Scheduler_EDF_SMP_Remove_processor(
198  const Scheduler_Control *scheduler,
199  struct Per_CPU_Control *cpu
200 );
201 
202 void _Scheduler_EDF_SMP_Yield(
203  const Scheduler_Control *scheduler,
204  Thread_Control *thread,
205  Scheduler_Node *node
206 );
207 
208 void _Scheduler_EDF_SMP_Start_idle(
209  const Scheduler_Control *scheduler,
210  Thread_Control *idle,
211  struct Per_CPU_Control *cpu
212 );
213 
214 bool _Scheduler_EDF_SMP_Set_affinity(
215  const Scheduler_Control *scheduler,
216  Thread_Control *thread,
217  Scheduler_Node *node,
218  const Processor_mask *affinity
219 );
220 
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 #endif /* _RTEMS_SCORE_SCHEDULEREDFSMP_H */
uint8_t ready_queue_index
The ready queue index depending on the processor affinity and pinning of the thread.
Definition: scheduleredfsmp.h:53
Scheduler context specialization for SMP schedulers.
Definition: schedulersmp.h:44
uint8_t pinning_ready_queue_index
Ready queue index according to thread pinning.
Definition: scheduleredfsmp.h:63
Definition: chain.h:65
Chain_Control Affine_queues
Chain of ready queues with affine threads to determine the highest priority ready thread...
Definition: scheduleredfsmp.h:95
Definition: scheduleredfsmp.h:83
SMP Scheduler API.
Definition: chain.h:83
Data Related to the Manipulation of Threads for the EDF Scheduler.
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:66
Definition: scheduleredfsmp.h:36
Definition: thread.h:728
Per CPU Core Structure.
Definition: percpu.h:290
Scheduler node specialization for SMP schedulers.
Definition: schedulersmp.h:98
Definition: scheduleredfsmp.h:66
int64_t generation
Generation number to ensure FIFO/LIFO order for threads of the same priority across different ready q...
Definition: scheduleredfsmp.h:43
Scheduler_EDF_SMP_Node * scheduled
The scheduled thread of the corresponding processor.
Definition: scheduleredfsmp.h:80
RBTree_Control Queue
The ready threads of the corresponding affinity.
Definition: scheduleredfsmp.h:75
Scheduler control.
Definition: scheduler.h:266
Scheduler node for per-thread data.
Definition: schedulernode.h:65
Chain_Node Node
Chain node for Scheduler_SMP_Context::Affine_queues.
Definition: scheduleredfsmp.h:70
Constants and Structures Associated with the Scheduler.
uint8_t affinity_ready_queue_index
Ready queue index according to thread affinity.
Definition: scheduleredfsmp.h:58