RTEMS 6.1-rc5
Loading...
Searching...
No Matches
scheduleredfsmp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * Copyright (C) 2017, 2018 embedded brains GmbH & Co. KG
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_SCORE_SCHEDULEREDFSMP_H
38#define _RTEMS_SCORE_SCHEDULEREDFSMP_H
39
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
59typedef struct {
61
66 int64_t generation;
67
77
82
88
89typedef struct {
94
98 RBTree_Control Queue;
99
107
114
115typedef struct {
117
121 int64_t generations[ 2 ];
122
128
137
138#define SCHEDULER_EDF_SMP_ENTRY_POINTS \
139 { \
140 _Scheduler_EDF_SMP_Initialize, \
141 NULL, \
142 _Scheduler_EDF_SMP_Yield, \
143 _Scheduler_EDF_SMP_Block, \
144 _Scheduler_EDF_SMP_Unblock, \
145 _Scheduler_EDF_SMP_Update_priority, \
146 _Scheduler_EDF_Map_priority, \
147 _Scheduler_EDF_Unmap_priority, \
148 _Scheduler_EDF_SMP_Ask_for_help, \
149 _Scheduler_EDF_SMP_Reconsider_help_request, \
150 _Scheduler_EDF_SMP_Withdraw_node, \
151 _Scheduler_EDF_SMP_Make_sticky, \
152 _Scheduler_EDF_SMP_Clean_sticky, \
153 _Scheduler_EDF_SMP_Pin, \
154 _Scheduler_EDF_SMP_Unpin, \
155 _Scheduler_EDF_SMP_Add_processor, \
156 _Scheduler_EDF_SMP_Remove_processor, \
157 _Scheduler_EDF_SMP_Node_initialize, \
158 _Scheduler_default_Node_destroy, \
159 _Scheduler_EDF_Release_job, \
160 _Scheduler_EDF_Cancel_job, \
161 _Scheduler_EDF_SMP_Start_idle, \
162 _Scheduler_EDF_SMP_Set_affinity \
163 }
164
170void _Scheduler_EDF_SMP_Initialize( const Scheduler_Control *scheduler );
171
181 const Scheduler_Control *scheduler,
182 Scheduler_Node *node,
183 Thread_Control *the_thread,
184 Priority_Control priority
185);
186
195 const Scheduler_Control *scheduler,
196 Thread_Control *thread,
197 Scheduler_Node *node
198);
199
208 const Scheduler_Control *scheduler,
209 Thread_Control *thread,
210 Scheduler_Node *node
211);
212
221 const Scheduler_Control *scheduler,
222 Thread_Control *the_thread,
223 Scheduler_Node *node
224);
225
237 const Scheduler_Control *scheduler,
238 Thread_Control *the_thread,
239 Scheduler_Node *node
240);
241
251 const Scheduler_Control *scheduler,
252 Thread_Control *the_thread,
253 Scheduler_Node *node
254);
255
266 const Scheduler_Control *scheduler,
267 Thread_Control *the_thread,
268 Scheduler_Node *node,
269 Thread_Scheduler_state next_state
270);
271
282 const Scheduler_Control *scheduler,
283 Thread_Control *the_thread,
284 Scheduler_Node *node
285);
286
297 const Scheduler_Control *scheduler,
298 Thread_Control *the_thread,
299 Scheduler_Node *node
300);
301
311 const Scheduler_Control *scheduler,
312 Thread_Control *the_thread,
313 Scheduler_Node *node,
314 struct Per_CPU_Control *cpu
315);
316
326 const Scheduler_Control *scheduler,
327 Thread_Control *the_thread,
328 Scheduler_Node *node,
329 struct Per_CPU_Control *cpu
330);
331
339 const Scheduler_Control *scheduler,
340 Thread_Control *idle
341);
342
352 const Scheduler_Control *scheduler,
353 struct Per_CPU_Control *cpu
354);
355
364 const Scheduler_Control *scheduler,
365 Thread_Control *thread,
366 Scheduler_Node *node
367);
368
377 const Scheduler_Control *scheduler,
378 Thread_Control *idle,
379 struct Per_CPU_Control *cpu
380);
381
399 const Scheduler_Control *scheduler,
400 Thread_Control *thread,
401 Scheduler_Node *node,
402 const Processor_mask *affinity
403);
404
407#ifdef __cplusplus
408}
409#endif
410
411#endif /* _RTEMS_SCORE_SCHEDULEREDFSMP_H */
#define RTEMS_ZERO_LENGTH_ARRAY
This constant represents the element count of a zero-length array.
Definition: basedefs.h:1032
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:91
void _Scheduler_EDF_SMP_Yield(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Performs the yield of a thread.
Definition: scheduleredfsmp.c:804
void _Scheduler_EDF_SMP_Start_idle(const Scheduler_Control *scheduler, Thread_Control *idle, struct Per_CPU_Control *cpu)
Starts an idle thread.
Definition: scheduleredfsmp.c:837
void _Scheduler_EDF_SMP_Node_initialize(const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
Initializes the node with the given priority.
Definition: scheduleredfsmp.c:121
void _Scheduler_EDF_SMP_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Updates the priority of the node.
Definition: scheduleredfsmp.c:645
void _Scheduler_EDF_SMP_Unpin(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, struct Per_CPU_Control *cpu)
Unpin thread operation.
Definition: scheduleredfsmp.c:877
void _Scheduler_EDF_SMP_Clean_sticky(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Cleans the sticky property from the node.
Definition: scheduleredfsmp.c:731
void _Scheduler_EDF_SMP_Unblock(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Unblocks the thread.
Definition: scheduleredfsmp.c:607
void _Scheduler_EDF_SMP_Initialize(const Scheduler_Control *scheduler)
Initializes the context of the scheduler control.
Definition: scheduleredfsmp.c:111
void _Scheduler_EDF_SMP_Block(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Blocks the thread.
Definition: scheduleredfsmp.c:539
Thread_Control * _Scheduler_EDF_SMP_Remove_processor(const Scheduler_Control *scheduler, struct Per_CPU_Control *cpu)
Removes an idle thread from the given cpu.
Definition: scheduleredfsmp.c:786
void _Scheduler_EDF_SMP_Pin(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, struct Per_CPU_Control *cpu)
Pin thread operation.
Definition: scheduleredfsmp.c:855
bool _Scheduler_EDF_SMP_Ask_for_help(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Asks for help operation.
Definition: scheduleredfsmp.c:666
void _Scheduler_EDF_SMP_Reconsider_help_request(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Reconsiders help operation.
Definition: scheduleredfsmp.c:677
void _Scheduler_EDF_SMP_Add_processor(const Scheduler_Control *scheduler, Thread_Control *idle)
Adds processor.
Definition: scheduleredfsmp.c:770
void _Scheduler_EDF_SMP_Make_sticky(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Makes the node sticky.
Definition: scheduleredfsmp.c:716
void _Scheduler_EDF_SMP_Withdraw_node(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, Thread_Scheduler_state next_state)
Withdraws node operation.
Definition: scheduleredfsmp.c:693
Status_Control _Scheduler_EDF_SMP_Set_affinity(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node, const Processor_mask *affinity)
Checks if the processor set of the scheduler is the subset of the affinity set.
Definition: scheduleredfsmp.c:898
Status_Control
Status codes.
Definition: status.h:111
This header file provides interfaces of the EDF Scheduler which are used by the implementation and th...
This header file provides interfaces of the SMP Scheduler which are used by the implementation and th...
This header file provides interfaces of the Scheduler Handler which are used by the implementation an...
This structure represents a chain node.
Definition: chain.h:78
Per CPU Core Structure.
Definition: percpu.h:384
Definition: scheduleredfsmp.h:115
Chain_Control Affine_queues
Chain of ready queues with affine threads to determine the highest priority ready thread.
Definition: scheduleredfsmp.h:127
Definition: scheduleredfsmp.h:59
int64_t generation
Generation number to ensure FIFO/LIFO order for threads of the same priority across different ready q...
Definition: scheduleredfsmp.h:66
uint8_t affinity_ready_queue_index
Ready queue index according to thread affinity.
Definition: scheduleredfsmp.h:81
uint8_t pinning_ready_queue_index
Ready queue index according to thread pinning.
Definition: scheduleredfsmp.h:86
uint8_t ready_queue_index
The ready queue index depending on the processor affinity and pinning of the thread.
Definition: scheduleredfsmp.h:76
Definition: scheduleredfsmp.h:89
RBTree_Control Queue
The ready threads of the corresponding affinity.
Definition: scheduleredfsmp.h:98
Scheduler_EDF_SMP_Node * affine_scheduled
If this member is not NULL, then it references the scheduled thread affine only to the corresponding ...
Definition: scheduleredfsmp.h:106
Scheduler_EDF_SMP_Node * allocated
This member references the thread allocated to the corresponding processor.
Definition: scheduleredfsmp.h:112
Chain_Node Node
Chain node for Scheduler_SMP_Context::Affine_queues.
Definition: scheduleredfsmp.h:93
Scheduler node for per-thread data.
Definition: schedulernode.h:94
Scheduler context specialization for SMP schedulers.
Definition: schedulersmp.h:61
Scheduler node specialization for SMP schedulers.
Definition: schedulersmp.h:106
Scheduler control.
Definition: scheduler.h:337
Definition: thread.h:837
This union represents a chain control block.
Definition: chain.h:96