diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus/budget.h | 27 | ||||
-rw-r--r-- | include/litmus/litmus.h | 6 | ||||
-rw-r--r-- | include/litmus/locking.h | 8 | ||||
-rw-r--r-- | include/litmus/rt_param.h | 30 | ||||
-rw-r--r-- | include/litmus/sched_trace.h | 9 |
5 files changed, 60 insertions, 20 deletions
diff --git a/include/litmus/budget.h b/include/litmus/budget.h index 2a3511245f7a..72f04777e0b0 100644 --- a/include/litmus/budget.h +++ b/include/litmus/budget.h | |||
@@ -54,15 +54,17 @@ struct enforcement_timer | |||
54 | 54 | ||
55 | typedef void (*scheduled_t)(struct task_struct* t); | 55 | typedef void (*scheduled_t)(struct task_struct* t); |
56 | typedef void (*blocked_t)(struct task_struct* t); | 56 | typedef void (*blocked_t)(struct task_struct* t); |
57 | typedef void (*preempt_or_sleep_t)(struct task_struct* t); | 57 | typedef void (*preempt_t)(struct task_struct* t); |
58 | typedef void (*exhausted_t)(struct task_struct* t); | 58 | typedef void (*sleep_t)(struct task_struct* t); |
59 | typedef enum hrtimer_restart (*exhausted_t)(struct task_struct* t); | ||
59 | typedef void (*exit_t)(struct task_struct* t); | 60 | typedef void (*exit_t)(struct task_struct* t); |
60 | 61 | ||
61 | struct budget_tracker_ops | 62 | struct budget_tracker_ops |
62 | { | 63 | { |
63 | scheduled_t on_scheduled; /* called from litmus_schedule(). */ | 64 | scheduled_t on_scheduled; /* called from litmus_schedule(). */ |
64 | blocked_t on_blocked; /* called from plugin::schedule() */ | 65 | blocked_t on_blocked; /* called from plugin::schedule() */ |
65 | preempt_or_sleep_t on_preempt_or_sleep; /* called from plugin::schedule() */ | 66 | preempt_t on_preempt; /* called from plugin::schedule() */ |
67 | sleep_t on_sleep; /* called from plugin::schedule() */ | ||
66 | 68 | ||
67 | exit_t on_exit; /* task exiting rt mode */ | 69 | exit_t on_exit; /* task exiting rt mode */ |
68 | 70 | ||
@@ -84,15 +86,30 @@ enum BT_FLAGS | |||
84 | }; | 86 | }; |
85 | 87 | ||
86 | /* Functions for simple DRAIN_SIMPLE policy common | 88 | /* Functions for simple DRAIN_SIMPLE policy common |
87 | * to every scheduler. Scheduler must provided | 89 | * to every scheduler. Scheduler must provide |
88 | * implementation for simple_on_exhausted(). | 90 | * implementation for simple_on_exhausted(). |
89 | */ | 91 | */ |
90 | void simple_on_scheduled(struct task_struct* t); | 92 | void simple_on_scheduled(struct task_struct* t); |
91 | void simple_on_blocked(struct task_struct* t); | 93 | void simple_on_blocked(struct task_struct* t); |
92 | void simple_on_preempt_or_sleep(struct task_struct* t); | 94 | void simple_on_preempt(struct task_struct* t); |
95 | void simple_on_sleep(struct task_struct* t); | ||
93 | void simple_on_exit(struct task_struct* t); | 96 | void simple_on_exit(struct task_struct* t); |
94 | 97 | ||
95 | 98 | ||
99 | /* Functions for DRAIN_SOBLIV policy common | ||
100 | * to every scheduler. Scheduler must provide | ||
101 | * implementation for sobliv_on_exhausted(). | ||
102 | * | ||
103 | * Limitation: Quantum budget tracking is unsupported. | ||
104 | */ | ||
105 | void sobliv_on_scheduled(struct task_struct* t); | ||
106 | void sobliv_on_blocked(struct task_struct* t); | ||
107 | void sobliv_on_sleep(struct task_struct* t); | ||
108 | /* Use the DRAIN_SIMPLE implementations */ | ||
109 | #define sobliv_on_preempt simple_on_preempt | ||
110 | #define sobliv_on_exit simple_on_exit | ||
111 | |||
112 | |||
96 | void init_budget_tracker(struct budget_tracker* bt, | 113 | void init_budget_tracker(struct budget_tracker* bt, |
97 | const struct budget_tracker_ops* ops); | 114 | const struct budget_tracker_ops* ops); |
98 | 115 | ||
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index f6ea5f6e80ee..ce24e62eee81 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
@@ -70,7 +70,11 @@ void litmus_exit_task(struct task_struct *tsk); | |||
70 | #define get_period(t) (tsk_rt(t)->task_params.period) | 70 | #define get_period(t) (tsk_rt(t)->task_params.period) |
71 | #define get_release(t) (tsk_rt(t)->job_params.release) | 71 | #define get_release(t) (tsk_rt(t)->job_params.release) |
72 | #define get_lateness(t) (tsk_rt(t)->job_params.lateness) | 72 | #define get_lateness(t) (tsk_rt(t)->job_params.lateness) |
73 | #define get_budget_timer(t) (tsk_rt(t)->job_params.budget_timer) | 73 | #define get_backlog(t) (tsk_rt(t)->job_params.backlog) |
74 | |||
75 | #define has_backlog(t) (get_backlog(t) != 0) | ||
76 | |||
77 | #define get_budget_timer(t) (tsk_rt(t)->budget) | ||
74 | 78 | ||
75 | #define effective_priority(t) ((!(tsk_rt(t)->inh_task)) ? t : tsk_rt(t)->inh_task) | 79 | #define effective_priority(t) ((!(tsk_rt(t)->inh_task)) ? t : tsk_rt(t)->inh_task) |
76 | #define base_priority(t) (t) | 80 | #define base_priority(t) (t) |
diff --git a/include/litmus/locking.h b/include/litmus/locking.h index 3ae6692dbe95..962ad5e6726a 100644 --- a/include/litmus/locking.h +++ b/include/litmus/locking.h | |||
@@ -229,5 +229,13 @@ struct litmus_lock_ops { | |||
229 | void suspend_for_lock(void); | 229 | void suspend_for_lock(void); |
230 | int wake_up_for_lock(struct task_struct* t); | 230 | int wake_up_for_lock(struct task_struct* t); |
231 | 231 | ||
232 | /* thread safe?? */ | ||
233 | #ifndef CONFIG_LITMUS_NESTED_LOCKING | ||
234 | #define holds_locks(tsk) \ | ||
235 | (tsk_rt(t)->num_locks_held || tsk_rt(t)->num_local_locks_held) | ||
236 | #else | ||
237 | #define holds_locks(tsk) \ | ||
238 | (tsk_rt(t)->num_locks_held || tsk_rt(t)->num_local_locks_held || !binheap_empty(&tsk_rt(t)->hp_blocked_tasks)) | ||
232 | #endif | 239 | #endif |
233 | 240 | ||
241 | #endif | ||
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index 887075b908ca..499ecd899fcd 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -257,6 +257,19 @@ struct rt_job { | |||
257 | * Increase this sequence number when a job is released. | 257 | * Increase this sequence number when a job is released. |
258 | */ | 258 | */ |
259 | unsigned int job_no; | 259 | unsigned int job_no; |
260 | |||
261 | /* Increments each time a job is forced to complete by | ||
262 | * budget exhaustion. If a job completes without remaining | ||
263 | * budget, the next job will be early-released _without_ | ||
264 | * pushing back its deadline. job_backlog is decremented once | ||
265 | * per early release. This behavior continues until | ||
266 | * backlog == 0. | ||
267 | */ | ||
268 | unsigned int backlog; | ||
269 | |||
270 | /* denotes if the current job is a backlogged job that was caused | ||
271 | * by an earlier budget exhaustion */ | ||
272 | unsigned int is_backlogged_job:1; | ||
260 | }; | 273 | }; |
261 | 274 | ||
262 | struct pfair_param; | 275 | struct pfair_param; |
@@ -387,6 +400,14 @@ struct rt_param { | |||
387 | unsigned int num_local_locks_held; | 400 | unsigned int num_local_locks_held; |
388 | #endif | 401 | #endif |
389 | 402 | ||
403 | #ifdef CONFIG_LITMUS_NESTED_LOCKING | ||
404 | raw_spinlock_t hp_blocked_tasks_lock; | ||
405 | struct binheap hp_blocked_tasks; | ||
406 | |||
407 | /* pointer to lock upon which is currently blocked */ | ||
408 | struct litmus_lock* blocked_lock; | ||
409 | #endif | ||
410 | |||
390 | /* user controlled parameters */ | 411 | /* user controlled parameters */ |
391 | struct rt_task task_params; | 412 | struct rt_task task_params; |
392 | 413 | ||
@@ -401,15 +422,6 @@ struct rt_param { | |||
401 | */ | 422 | */ |
402 | struct task_struct* inh_task; | 423 | struct task_struct* inh_task; |
403 | 424 | ||
404 | #ifdef CONFIG_LITMUS_NESTED_LOCKING | ||
405 | raw_spinlock_t hp_blocked_tasks_lock; | ||
406 | struct binheap hp_blocked_tasks; | ||
407 | |||
408 | /* pointer to lock upon which is currently blocked */ | ||
409 | struct litmus_lock* blocked_lock; | ||
410 | #endif | ||
411 | |||
412 | |||
413 | #ifdef CONFIG_REALTIME_AUX_TASKS | 425 | #ifdef CONFIG_REALTIME_AUX_TASKS |
414 | unsigned int is_aux_task:1; | 426 | unsigned int is_aux_task:1; |
415 | unsigned int aux_ready:1; | 427 | unsigned int aux_ready:1; |
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index 0785db39b2fc..9a7e6fa1e6b6 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
@@ -52,11 +52,10 @@ struct st_switch_away_data { /* A process was switched away from on a given CPU. | |||
52 | 52 | ||
53 | struct st_completion_data { /* A job completed. */ | 53 | struct st_completion_data { /* A job completed. */ |
54 | u64 when; | 54 | u64 when; |
55 | u8 forced:1; /* Set to 1 if job overran and kernel advanced to the | 55 | u64 backlog_remaining:62; |
56 | * next task automatically; set to 0 otherwise. | 56 | u8 was_backlog_job:1; |
57 | */ | 57 | u8 forced:1; /* Set to 1 if job overran and kernel advanced to the |
58 | u8 __uflags:7; | 58 | * next task automatically; set to 0 otherwise. */ |
59 | u8 __unused[7]; | ||
60 | } __attribute__((packed)); | 59 | } __attribute__((packed)); |
61 | 60 | ||
62 | struct st_block_data { /* A task blocks. */ | 61 | struct st_block_data { /* A task blocks. */ |