diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-10 16:21:07 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-10 16:21:07 -0500 |
commit | 8d00682ce5ddaedfb62287773d21c727f08fda69 (patch) | |
tree | 61a4b7bac5960c6f0ab25fe087404e9ca1725e05 /include/litmus/rt_param.h | |
parent | fdf0a6b73001976c5d02d631ebdd0927819d7c91 (diff) | |
parent | 1235a665a5e00dc762e6646c01381b3ed5019d86 (diff) |
Merge branch 'wip-gpu-cleanup' into wip-2012.3-gpu
Conflicts:
include/litmus/fpmath.h
include/litmus/litmus.h
include/litmus/rt_param.h
include/litmus/trace.h
kernel/sched.c
kernel/softirq.c
litmus/edf_common.c
litmus/jobs.c
litmus/litmus.c
litmus/locking.c
litmus/preempt.c
litmus/sched_cedf.c
litmus/sched_gsn_edf.c
litmus/sched_litmus.c
litmus/sync.c
Diffstat (limited to 'include/litmus/rt_param.h')
-rw-r--r-- | include/litmus/rt_param.h | 200 |
1 files changed, 196 insertions, 4 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 4cd06dd32906..39685a351cb1 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -1,9 +1,11 @@ | |||
1 | #ifndef _LINUX_RT_PARAM_H_ | ||
2 | #define _LINUX_RT_PARAM_H_ | ||
1 | /* | 3 | /* |
2 | * Definition of the scheduler plugin interface. | 4 | * Definition of the scheduler plugin interface. |
3 | * | 5 | * |
4 | */ | 6 | */ |
5 | #ifndef _LINUX_RT_PARAM_H_ | 7 | |
6 | #define _LINUX_RT_PARAM_H_ | 8 | #include <litmus/fpmath.h> |
7 | 9 | ||
8 | /* Litmus time type. */ | 10 | /* Litmus time type. */ |
9 | typedef unsigned long long lt_t; | 11 | typedef unsigned long long lt_t; |
@@ -30,9 +32,43 @@ typedef enum { | |||
30 | typedef enum { | 32 | typedef enum { |
31 | NO_ENFORCEMENT, /* job may overrun unhindered */ | 33 | NO_ENFORCEMENT, /* job may overrun unhindered */ |
32 | QUANTUM_ENFORCEMENT, /* budgets are only checked on quantum boundaries */ | 34 | QUANTUM_ENFORCEMENT, /* budgets are only checked on quantum boundaries */ |
33 | PRECISE_ENFORCEMENT /* budgets are enforced with hrtimers */ | 35 | PRECISE_ENFORCEMENT, /* budgets are enforced with hrtimers */ |
34 | } budget_policy_t; | 36 | } budget_policy_t; |
35 | 37 | ||
38 | typedef enum { | ||
39 | NO_SIGNALS, /* job receives no signals when it exhausts its budget */ | ||
40 | QUANTUM_SIGNALS, /* budget signals are only sent on quantum boundaries */ | ||
41 | PRECISE_SIGNALS, /* budget signals are triggered with hrtimers */ | ||
42 | } budget_signal_policy_t; | ||
43 | |||
44 | typedef enum { | ||
45 | AUX_ENABLE = 0x1, | ||
46 | AUX_CURRENT = (AUX_ENABLE<<1), | ||
47 | AUX_FUTURE = (AUX_CURRENT<<2) | ||
48 | } aux_flags_t; | ||
49 | |||
50 | /* mirror of st_event_record_type_t | ||
51 | * Assume all are UNsupported, unless otherwise stated. */ | ||
52 | typedef enum { | ||
53 | ST_INJECT_NAME = 1, /* supported */ | ||
54 | ST_INJECT_PARAM, /* supported */ | ||
55 | ST_INJECT_RELEASE, /* supported */ | ||
56 | ST_INJECT_ASSIGNED, | ||
57 | ST_INJECT_SWITCH_TO, | ||
58 | ST_INJECT_SWITCH_AWAY, | ||
59 | ST_INJECT_COMPLETION, /* supported */ | ||
60 | ST_INJECT_BLOCK, | ||
61 | ST_INJECT_RESUME, | ||
62 | ST_INJECT_ACTION, | ||
63 | ST_INJECT_SYS_RELEASE, /* supported */ | ||
64 | } sched_trace_injection_events_t; | ||
65 | |||
66 | struct st_inject_args { | ||
67 | lt_t release; | ||
68 | lt_t deadline; | ||
69 | unsigned int job_no; | ||
70 | }; | ||
71 | |||
36 | /* We use the common priority interpretation "lower index == higher priority", | 72 | /* We use the common priority interpretation "lower index == higher priority", |
37 | * which is commonly used in fixed-priority schedulability analysis papers. | 73 | * which is commonly used in fixed-priority schedulability analysis papers. |
38 | * So, a numerically lower priority value implies higher scheduling priority, | 74 | * So, a numerically lower priority value implies higher scheduling priority, |
@@ -62,6 +98,7 @@ struct rt_task { | |||
62 | unsigned int priority; | 98 | unsigned int priority; |
63 | task_class_t cls; | 99 | task_class_t cls; |
64 | budget_policy_t budget_policy; /* ignored by pfair */ | 100 | budget_policy_t budget_policy; /* ignored by pfair */ |
101 | budget_signal_policy_t budget_signal_policy; /* currently ignored by pfair */ | ||
65 | }; | 102 | }; |
66 | 103 | ||
67 | union np_flag { | 104 | union np_flag { |
@@ -74,6 +111,19 @@ union np_flag { | |||
74 | } np; | 111 | } np; |
75 | }; | 112 | }; |
76 | 113 | ||
114 | struct affinity_observer_args | ||
115 | { | ||
116 | int lock_od; | ||
117 | }; | ||
118 | |||
119 | struct gpu_affinity_observer_args | ||
120 | { | ||
121 | struct affinity_observer_args obs; | ||
122 | int replica_to_gpu_offset; | ||
123 | int nr_simult_users; | ||
124 | int relaxed_rules; | ||
125 | }; | ||
126 | |||
77 | /* The definition of the data that is shared between the kernel and real-time | 127 | /* The definition of the data that is shared between the kernel and real-time |
78 | * tasks via a shared page (see litmus/ctrldev.c). | 128 | * tasks via a shared page (see litmus/ctrldev.c). |
79 | * | 129 | * |
@@ -115,6 +165,13 @@ struct control_page { | |||
115 | /* don't export internal data structures to user space (liblitmus) */ | 165 | /* don't export internal data structures to user space (liblitmus) */ |
116 | #ifdef __KERNEL__ | 166 | #ifdef __KERNEL__ |
117 | 167 | ||
168 | #include <litmus/binheap.h> | ||
169 | #include <linux/semaphore.h> | ||
170 | |||
171 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
172 | #include <linux/interrupt.h> | ||
173 | #endif | ||
174 | |||
118 | struct _rt_domain; | 175 | struct _rt_domain; |
119 | struct bheap_node; | 176 | struct bheap_node; |
120 | struct release_heap; | 177 | struct release_heap; |
@@ -142,10 +199,82 @@ struct rt_job { | |||
142 | * Increase this sequence number when a job is released. | 199 | * Increase this sequence number when a job is released. |
143 | */ | 200 | */ |
144 | unsigned int job_no; | 201 | unsigned int job_no; |
202 | |||
203 | /* bits: | ||
204 | * 0th: Set if a budget exhaustion signal has already been sent for | ||
205 | * the current job. */ | ||
206 | unsigned long flags; | ||
145 | }; | 207 | }; |
146 | 208 | ||
209 | #define RT_JOB_SIG_BUDGET_SENT 0 | ||
210 | |||
147 | struct pfair_param; | 211 | struct pfair_param; |
148 | 212 | ||
213 | enum klmirqd_sem_status | ||
214 | { | ||
215 | NEED_TO_REACQUIRE, | ||
216 | REACQUIRING, | ||
217 | NOT_HELD, | ||
218 | HELD | ||
219 | }; | ||
220 | |||
221 | typedef enum gpu_migration_dist | ||
222 | { | ||
223 | // TODO: Make this variable against NR_NVIDIA_GPUS | ||
224 | MIG_LOCAL = 0, | ||
225 | MIG_NEAR = 1, | ||
226 | MIG_MED = 2, | ||
227 | MIG_FAR = 3, // 8 GPUs in a binary tree hierarchy | ||
228 | MIG_NONE = 4, | ||
229 | |||
230 | MIG_LAST = MIG_NONE | ||
231 | } gpu_migration_dist_t; | ||
232 | |||
233 | typedef struct feedback_est{ | ||
234 | fp_t est; | ||
235 | fp_t accum_err; | ||
236 | } feedback_est_t; | ||
237 | |||
238 | |||
239 | #define AVG_EST_WINDOW_SIZE 20 | ||
240 | |||
241 | typedef int (*notify_rsrc_exit_t)(struct task_struct* tsk); | ||
242 | |||
243 | typedef struct avg_est{ | ||
244 | lt_t history[AVG_EST_WINDOW_SIZE]; | ||
245 | uint16_t count; | ||
246 | uint16_t idx; | ||
247 | lt_t sum; | ||
248 | lt_t std; | ||
249 | lt_t avg; | ||
250 | } avg_est_t; | ||
251 | |||
252 | |||
253 | |||
254 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
255 | struct klmirqd_info | ||
256 | { | ||
257 | struct task_struct* klmirqd; | ||
258 | struct task_struct* current_owner; | ||
259 | unsigned int terminating:1; | ||
260 | |||
261 | raw_spinlock_t lock; | ||
262 | |||
263 | u32 pending; | ||
264 | atomic_t num_hi_pending; | ||
265 | atomic_t num_low_pending; | ||
266 | atomic_t num_work_pending; | ||
267 | |||
268 | /* in order of priority */ | ||
269 | struct tasklet_head pending_tasklets_hi; | ||
270 | struct tasklet_head pending_tasklets; | ||
271 | struct list_head worklist; | ||
272 | |||
273 | struct list_head klmirqd_reg; | ||
274 | }; | ||
275 | #endif | ||
276 | |||
277 | |||
149 | /* RT task parameters for scheduling extensions | 278 | /* RT task parameters for scheduling extensions |
150 | * These parameters are inherited during clone and therefore must | 279 | * These parameters are inherited during clone and therefore must |
151 | * be explicitly set up before the task set is launched. | 280 | * be explicitly set up before the task set is launched. |
@@ -163,6 +292,40 @@ struct rt_param { | |||
163 | /* has the task completed? */ | 292 | /* has the task completed? */ |
164 | unsigned int completed:1; | 293 | unsigned int completed:1; |
165 | 294 | ||
295 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
296 | /* proxy threads have minimum priority by default */ | ||
297 | unsigned int is_interrupt_thread:1; | ||
298 | |||
299 | /* pointer to data used by klmirqd thread. | ||
300 | * | ||
301 | * ptr only valid if is_interrupt_thread == 1 | ||
302 | */ | ||
303 | struct klmirqd_info* klmirqd_info; | ||
304 | #endif | ||
305 | |||
306 | #ifdef CONFIG_LITMUS_NVIDIA | ||
307 | /* number of top-half interrupts handled on behalf of current job */ | ||
308 | atomic_t nv_int_count; | ||
309 | long unsigned int held_gpus; // bitmap of held GPUs. | ||
310 | struct binheap_node gpu_owner_node; // just one GPU for now... | ||
311 | unsigned int hide_from_gpu:1; | ||
312 | |||
313 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
314 | avg_est_t gpu_migration_est[MIG_LAST+1]; | ||
315 | |||
316 | gpu_migration_dist_t gpu_migration; | ||
317 | int last_gpu; | ||
318 | |||
319 | notify_rsrc_exit_t rsrc_exit_cb; | ||
320 | void* rsrc_exit_cb_args; | ||
321 | |||
322 | lt_t accum_gpu_time; | ||
323 | lt_t gpu_time_stamp; | ||
324 | |||
325 | unsigned int suspend_gpu_tracker_on_block:1; | ||
326 | #endif | ||
327 | #endif | ||
328 | |||
166 | #ifdef CONFIG_LITMUS_LOCKING | 329 | #ifdef CONFIG_LITMUS_LOCKING |
167 | /* Is the task being priority-boosted by a locking protocol? */ | 330 | /* Is the task being priority-boosted by a locking protocol? */ |
168 | unsigned int priority_boosted:1; | 331 | unsigned int priority_boosted:1; |
@@ -182,7 +345,26 @@ struct rt_param { | |||
182 | * could point to self if PI does not result in | 345 | * could point to self if PI does not result in |
183 | * an increased task priority. | 346 | * an increased task priority. |
184 | */ | 347 | */ |
185 | struct task_struct* inh_task; | 348 | struct task_struct* inh_task; |
349 | |||
350 | #ifdef CONFIG_LITMUS_NESTED_LOCKING | ||
351 | raw_spinlock_t hp_blocked_tasks_lock; | ||
352 | struct binheap hp_blocked_tasks; | ||
353 | |||
354 | /* pointer to lock upon which is currently blocked */ | ||
355 | struct litmus_lock* blocked_lock; | ||
356 | #endif | ||
357 | |||
358 | |||
359 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
360 | unsigned int is_aux_task:1; | ||
361 | unsigned int has_aux_tasks:1; | ||
362 | unsigned int hide_from_aux_tasks:1; | ||
363 | |||
364 | struct list_head aux_task_node; | ||
365 | struct binheap_node aux_task_owner_node; | ||
366 | #endif | ||
367 | |||
186 | 368 | ||
187 | #ifdef CONFIG_NP_SECTION | 369 | #ifdef CONFIG_NP_SECTION |
188 | /* For the FMLP under PSN-EDF, it is required to make the task | 370 | /* For the FMLP under PSN-EDF, it is required to make the task |
@@ -248,6 +430,16 @@ struct rt_param { | |||
248 | struct control_page * ctrl_page; | 430 | struct control_page * ctrl_page; |
249 | }; | 431 | }; |
250 | 432 | ||
433 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
434 | struct aux_data | ||
435 | { | ||
436 | struct list_head aux_tasks; | ||
437 | struct binheap aux_task_owners; | ||
438 | unsigned int initialized:1; | ||
439 | unsigned int aux_future:1; | ||
440 | }; | ||
251 | #endif | 441 | #endif |
252 | 442 | ||
443 | #endif /* __KERNEL */ | ||
444 | |||
253 | #endif | 445 | #endif |