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_SMP_Block, \ |
---|
56 | _Scheduler_priority_SMP_Unblock, \ |
---|
57 | _Scheduler_priority_SMP_Change_priority, \ |
---|
58 | _Scheduler_priority_affinity_SMP_Allocate, \ |
---|
59 | _Scheduler_default_Free, \ |
---|
60 | _Scheduler_priority_SMP_Update, \ |
---|
61 | _Scheduler_priority_Priority_compare, \ |
---|
62 | _Scheduler_default_Release_job, \ |
---|
63 | _Scheduler_default_Tick, \ |
---|
64 | _Scheduler_SMP_Start_idle, \ |
---|
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 | * |
---|
74 | * @param[in] scheduler points to the scheduler specific information. |
---|
75 | * @param[in] the_thread is the thread the scheduler is allocating |
---|
76 | * management memory for. |
---|
77 | */ |
---|
78 | bool _Scheduler_priority_affinity_SMP_Allocate( |
---|
79 | const Scheduler_Control *scheduler, |
---|
80 | Thread_Control *the_thread |
---|
81 | ); |
---|
82 | |
---|
83 | /** |
---|
84 | * @brief Get affinity for the priority affinity smp scheduler. |
---|
85 | * |
---|
86 | * @param[in] scheduler The scheduler of the thread. |
---|
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( |
---|
95 | const Scheduler_Control *scheduler, |
---|
96 | Thread_Control *thread, |
---|
97 | size_t cpusetsize, |
---|
98 | cpu_set_t *cpuset |
---|
99 | ); |
---|
100 | |
---|
101 | /** |
---|
102 | * @brief Set affinity for the priority affinity smp scheduler. |
---|
103 | * |
---|
104 | * @param[in] scheduler The scheduler of the thread. |
---|
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( |
---|
112 | const Scheduler_Control *scheduler, |
---|
113 | Thread_Control *thread, |
---|
114 | size_t cpusetsize, |
---|
115 | cpu_set_t *cpuset |
---|
116 | ); |
---|
117 | |
---|
118 | /** |
---|
119 | * @brief Scheduler node specialization for Deterministic Priority Affinity SMP |
---|
120 | * schedulers. |
---|
121 | */ |
---|
122 | typedef struct { |
---|
123 | /** |
---|
124 | * @brief SMP priority scheduler node. |
---|
125 | */ |
---|
126 | Scheduler_priority_SMP_Node Base; |
---|
127 | |
---|
128 | /** |
---|
129 | * Structure containing affinity set data and size |
---|
130 | */ |
---|
131 | CPU_set_Control Affinity; |
---|
132 | } Scheduler_priority_affinity_SMP_Node; |
---|
133 | |
---|
134 | /** @} */ |
---|
135 | |
---|
136 | #ifdef __cplusplus |
---|
137 | } |
---|
138 | #endif /* __cplusplus */ |
---|
139 | |
---|
140 | #endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */ |
---|