aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorZelin Tong <ztong@ludwig.cs.unc.edu>2020-09-21 13:32:29 -0400
committerZelin Tong <ztong@ludwig.cs.unc.edu>2020-09-21 13:32:29 -0400
commitea90ac994afd39ec5899f663502502d47e060ae2 (patch)
tree2dd8f2ecfa7e99b45efbef858e80de18aa6034e5 /include/litmus
parentb665fac6de1744ce6aeb4cfdd81a2cff528484dc (diff)
Backup Commit 2
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/reservations/ext_reservation.h24
-rw-r--r--include/litmus/reservations/gedf_reservation.h14
-rw-r--r--include/litmus/reservations/reservation.h44
-rw-r--r--include/litmus/reservations/table_driven_ext_reservation.h58
-rw-r--r--include/litmus/reservations/task_reservation.h10
-rw-r--r--include/litmus/rt_domain.h17
6 files changed, 92 insertions, 75 deletions
diff --git a/include/litmus/reservations/ext_reservation.h b/include/litmus/reservations/ext_reservation.h
index b5fedf46a2cc..7ec326bd14bd 100644
--- a/include/litmus/reservations/ext_reservation.h
+++ b/include/litmus/reservations/ext_reservation.h
@@ -2,11 +2,8 @@
2#define LITMUS_EXT_RESERVATION_H 2#define LITMUS_EXT_RESERVATION_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/hrtimer.h>
6 5
7#include <litmus/debug_trace.h> 6#include <litmus/debug_trace.h>
8#include <litmus/bheap.h>
9#include <litmus/rt_domain.h>
10#include <litmus/reservations/budget-notifier.h> 7#include <litmus/reservations/budget-notifier.h>
11 8
12struct reservation_environment; 9struct reservation_environment;
@@ -52,7 +49,6 @@ struct reservation_ops {
52 49
53struct reservation { 50struct reservation {
54 unsigned int id; 51 unsigned int id;
55 unsigned int kind;
56 52
57 /* exact meaning defined by impl. */ 53 /* exact meaning defined by impl. */
58 lt_t priority; 54 lt_t priority;
@@ -86,7 +82,7 @@ void init_ext_reservation(struct reservation* res);
86void clean_up_ext_reservation(struct reservation* res); 82void clean_up_ext_reservation(struct reservation* res);
87 83
88/* ************************************************************************** */ 84/* ************************************************************************** */
89typedef void (*env_advance_time_t) ( 85typedef void (*env_update_time_t) (
90 struct reservation_environment* env, 86 struct reservation_environment* env,
91 lt_t how_much, 87 lt_t how_much,
92 int cpu); 88 int cpu);
@@ -106,17 +102,14 @@ typedef void (*env_suspend_t) (
106 int cpu); 102 int cpu);
107 103
108typedef void (*env_add_res_t) (struct reservation_environment* env, 104typedef void (*env_add_res_t) (struct reservation_environment* env,
109 struct reservation* res, 105 struct reservation* res);
110 int cpu);
111 106
112typedef void (*env_remove_res_t) (struct reservation_environment* env, 107typedef void (*env_remove_res_t) (struct reservation_environment* env,
113 struct reservation* res, 108 struct reservation* res,
114 int complete, 109 int complete);
115 int cpu);
116 110
117typedef void (*env_shutdown_t) ( 111typedef void (*env_shutdown_t) (
118 struct reservation_environment* env, 112 struct reservation_environment* env);
119 int cpu);
120 113
121struct reservation_environment_ops { 114struct reservation_environment_ops {
122 env_update_time_t update_time; 115 env_update_time_t update_time;
@@ -130,6 +123,15 @@ struct reservation_environment_ops {
130 123
131struct reservation_environment { 124struct reservation_environment {
132 struct reservation_environment_ops* ops; 125 struct reservation_environment_ops* ops;
126 struct reservation* res;
133}; 127};
134 128
129static inline void env_to_res_couple(
130 struct reservation_environment* env,
131 struct reservation* res)
132{
133 res->env = env;
134 env->res = res;
135}
136
135#endif 137#endif
diff --git a/include/litmus/reservations/gedf_reservation.h b/include/litmus/reservations/gedf_reservation.h
index f00c21e37fac..235591a0897b 100644
--- a/include/litmus/reservations/gedf_reservation.h
+++ b/include/litmus/reservations/gedf_reservation.h
@@ -1,6 +1,10 @@
1#ifndef LITMUS_GEDF_RESERVATION_H 1#ifndef LITMUS_GEDF_RESERVATION_H
2#define LITMUS_GEDF_RESERVATION_H 2#define LITMUS_GEDF_RESERVATION_H
3 3
4#include <linux/hrtimer.h>
5
6#include <litmus/bheap.h>
7#include <litmus/rt_domain.h>
4#include <litmus/reservations/ext_reservation.h> 8#include <litmus/reservations/ext_reservation.h>
5 9
6/* ************************************************************************** */ 10/* ************************************************************************** */
@@ -14,8 +18,8 @@ struct cpu_entry {
14 18
15struct gedf_reservation { 19struct gedf_reservation {
16 struct reservation res; 20 struct reservation res;
17 struct cpu_entry linked_on; 21 struct cpu_entry* linked_on;
18 struct cpu_entry scheduled_on; 22 struct cpu_entry* scheduled_on;
19 int will_remove; 23 int will_remove;
20 int blocked; 24 int blocked;
21 lt_t period; 25 lt_t period;
@@ -24,7 +28,7 @@ struct gedf_reservation {
24}; 28};
25 29
26long alloc_gedf_reservation( 30long alloc_gedf_reservation(
27 struct reservation** _res, 31 struct gedf_reservation** _res,
28 int id, 32 int id,
29 lt_t exec_cost, 33 lt_t exec_cost,
30 lt_t period, 34 lt_t period,
@@ -34,6 +38,7 @@ long alloc_gedf_reservation(
34/* environment for scheduling reservations via gedf */ 38/* environment for scheduling reservations via gedf */
35struct gedf_reservation_environment { 39struct gedf_reservation_environment {
36 struct reservation_environment env; 40 struct reservation_environment env;
41 struct list_head all_reservations;
37 /* number of active cpus in reservation */ 42 /* number of active cpus in reservation */
38 int num_cpus; 43 int num_cpus;
39 /* array of gedf cpu entries */ 44 /* array of gedf cpu entries */
@@ -45,9 +50,6 @@ struct gedf_reservation_environment {
45 struct bheap cpu_heap; 50 struct bheap cpu_heap;
46 struct bheap_node cpu_node[NR_CPUS]; 51 struct bheap_node cpu_node[NR_CPUS];
47 52
48 /* operations */
49 struct reservation_environment_ops ops;
50
51 rt_domain_t domain; 53 rt_domain_t domain;
52}; 54};
53 55
diff --git a/include/litmus/reservations/reservation.h b/include/litmus/reservations/reservation.h
index 3dce3a47a2fa..1752dac4e698 100644
--- a/include/litmus/reservations/reservation.h
+++ b/include/litmus/reservations/reservation.h
@@ -202,8 +202,6 @@ struct sup_reservation_environment {
202 lt_t next_scheduler_update; 202 lt_t next_scheduler_update;
203 /* set to true if a call to sup_dispatch() is imminent */ 203 /* set to true if a call to sup_dispatch() is imminent */
204 bool will_schedule; 204 bool will_schedule;
205
206 struct res_env_ops ops;
207}; 205};
208 206
209/* Contract: 207/* Contract:
@@ -223,46 +221,4 @@ struct task_struct* sup_dispatch(struct sup_reservation_environment* sup_env);
223struct reservation* sup_find_by_id(struct sup_reservation_environment* sup_env, 221struct reservation* sup_find_by_id(struct sup_reservation_environment* sup_env,
224 unsigned int id); 222 unsigned int id);
225 223
226/* ************************************************************************* */
227/* cpu_entry struct */
228typedef struct {
229 int cpu;
230 struct task_struct* linked;
231 struct task_struct* scheduled;
232 struct bheap_node* hn;
233 struct list_node* ln;
234} cpu_entry_t;
235
236/* Hierarchical reservation environment */
237struct ext_reservation_environment {
238 struct reservation environment env;
239
240 /* only used for global reservation environments */
241 raw_spinlock_t lock;
242
243 /* ordered by priority */
244 struct list_head active_reservations;
245
246 /* ordered by next_replenishment */
247 struct list_head depleted_reservations;
248
249 /* unordered */
250 struct list_head inactive_reservations;
251
252 /* list of all reservations */
253 struct list_head all_reservations;
254
255 lt_t next_scheduler_update;
256 bool will_scheduled;
257}
258
259/* Hierarchical reservation */
260struct ext_reservation {
261 /* reservation data */
262 struct reservation res;
263
264 /* reservation environment for child reservations */
265 struct list_head child_envs;
266};
267
268#endif 224#endif
diff --git a/include/litmus/reservations/table_driven_ext_reservation.h b/include/litmus/reservations/table_driven_ext_reservation.h
new file mode 100644
index 000000000000..414791ee9261
--- /dev/null
+++ b/include/litmus/reservations/table_driven_ext_reservation.h
@@ -0,0 +1,58 @@
1#ifndef LITMUS_TD_RESERVATION_H
2#define LITMUS_TD_RESERVATION_H
3
4#include <litmus/reservations/ext_reservation.h>
5
6/* ************************************************************************** */
7struct cpu_entry {
8 int id;
9 struct hrtimer timer;
10 struct bheap_node* hn;
11 struct reservation* linked;
12 struct reservation* scheduled;
13};
14
15struct gedf_reservation {
16 struct reservation res;
17 struct cpu_entry linked_on;
18 struct cpu_entry scheduled_on;
19 int will_remove;
20 int blocked;
21 lt_t period;
22 lt_t relative_deadline;
23 lt_t exec_cost;
24};
25
26long alloc_gedf_reservation(
27 struct reservation** _res,
28 int id,
29 lt_t exec_cost,
30 lt_t period,
31 lt_t relative_deadline
32);
33
34/* environment for scheduling reservations via gedf */
35struct td_reservation_environment {
36 struct reservation_environment env;
37 /* number of active cpus in reservation */
38 int num_cpus;
39 /* array of gedf cpu entries */
40 struct cpu_entry cpu_entries[NR_CPUS];
41 /* smp_processor_id to environment cpu array offset mapping */
42 int cpu_mapping[NR_CPUS];
43
44 /* used to order cpus for gedf purposes */
45 struct bheap cpu_heap;
46 struct bheap_node cpu_node[NR_CPUS];
47
48 /* operations */
49 struct reservation_environment_ops ops;
50
51 rt_domain_t domain;
52};
53
54long alloc_td_reservation_environment(
55 struct td_reservation_environment** _env
56);
57
58#endif
diff --git a/include/litmus/reservations/task_reservation.h b/include/litmus/reservations/task_reservation.h
index d54a789ff3e2..0e0ef74591b6 100644
--- a/include/litmus/reservations/task_reservation.h
+++ b/include/litmus/reservations/task_reservation.h
@@ -1,15 +1,15 @@
1#ifndef LITMUS_GEDF_RESERVATION_H 1#ifndef LITMUS_TASK_RESERVATION_H
2#define LITMUS_GEDF_RESERVATION_H 2#define LITMUS_TASK_RESERVATION_H
3 3
4#include <litmus/reservations/ext_reservation.h> 4#include <litmus/reservations/ext_reservation.h>
5 5
6struct task_reservation_environment { 6struct task_reservation_environment {
7 struct reservation_environment res; 7 struct reservation_environment env;
8 struct task_struct* task; 8 struct task_struct* task;
9}; 9};
10 10
11void task_reservation_environment_init( 11long alloc_task_reservation_environment(
12 struct task_reservation_environment* task_env, 12 struct task_reservation_environment** _env,
13 struct task_struct* task 13 struct task_struct* task
14); 14);
15 15
diff --git a/include/litmus/rt_domain.h b/include/litmus/rt_domain.h
index 5a7fb59bd750..0fabd7e6ea55 100644
--- a/include/litmus/rt_domain.h
+++ b/include/litmus/rt_domain.h
@@ -5,8 +5,6 @@
5#ifndef __UNC_RT_DOMAIN_H__ 5#ifndef __UNC_RT_DOMAIN_H__
6#define __UNC_RT_DOMAIN_H__ 6#define __UNC_RT_DOMAIN_H__
7 7
8#include <linux/rbtree.h>
9
10#include <litmus/bheap.h> 8#include <litmus/bheap.h>
11#include <litmus/binheap.h> 9#include <litmus/binheap.h>
12#include <litmus/reservations/ext_reservation.h> 10#include <litmus/reservations/ext_reservation.h>
@@ -69,8 +67,8 @@ struct release_heap {
69 struct list_head list_head; 67 struct list_head list_head;
70}; 68};
71 69
72static void suspend_releases(rt_domain_t* rt); 70void suspend_releases(rt_domain_t* rt);
73static void resume_releases(rt_domain_t* rt); 71void resume_releases(rt_domain_t* rt);
74 72
75static inline struct task_struct* __next_ready(rt_domain_t* rt) 73static inline struct task_struct* __next_ready(rt_domain_t* rt)
76{ 74{
@@ -83,7 +81,7 @@ static inline struct task_struct* __next_ready(rt_domain_t* rt)
83 81
84static inline struct reservation* __next_ready_res(rt_domain_t* rt) 82static inline struct reservation* __next_ready_res(rt_domain_t* rt)
85{ 83{
86 struct bheap_node *n = bheap_peek(rt->order, &rt->ready_queue); 84 struct bheap_node *hn = bheap_peek(rt->order, &rt->ready_queue);
87 if (hn) 85 if (hn)
88 return bheap2res(hn); 86 return bheap2res(hn);
89 else 87 else
@@ -98,9 +96,10 @@ void __add_ready(rt_domain_t* rt, struct task_struct *new);
98void __merge_ready(rt_domain_t* rt, struct bheap *tasks); 96void __merge_ready(rt_domain_t* rt, struct bheap *tasks);
99void __add_release(rt_domain_t* rt, struct task_struct *task); 97void __add_release(rt_domain_t* rt, struct task_struct *task);
100 98
101void __add_ready_res(rt_domain* rt, struct reservation* new); 99void __add_ready_res(rt_domain_t* rt, struct reservation* new);
102void __merge_ready_res(rt_domain_t* rt, struct bheap *res); 100void __merge_ready_res(rt_domain_t* rt, struct bheap *res);
103void __add_release_res(rt_domain_t* rt, struct reservation* res); 101void __add_release_res(rt_domain_t* rt, struct reservation* res);
102void __add_release_res_no_timer(rt_domain_t* rt, struct reservation* res);
104 103
105static inline struct task_struct* __take_ready(rt_domain_t* rt) 104static inline struct task_struct* __take_ready(rt_domain_t* rt)
106{ 105{
@@ -146,7 +145,7 @@ static inline int is_queued(struct task_struct *t)
146 145
147static inline int is_queued_res(struct reservation* res) 146static inline int is_queued_res(struct reservation* res)
148{ 147{
149 BUG_ON(!cres->heap_node); 148 BUG_ON(!res->heap_node);
150 return bheap_node_in_heap(res->heap_node); 149 return bheap_node_in_heap(res->heap_node);
151} 150}
152 151
@@ -228,8 +227,8 @@ static inline void add_release_res(rt_domain_t* rt, struct reservation* res)
228{ 227{
229 unsigned long flags; 228 unsigned long flags;
230 raw_spin_lock_irqsave(&rt->tobe_lock, flags); 229 raw_spin_lock_irqsave(&rt->tobe_lock, flags);
231 __add_release_res(rt, task); 230 __add_release_res(rt, res);
232 raw_spin_unlock_irqstore(&rt->tobe_lock, flags); 231 raw_spin_unlock_irqrestore(&rt->tobe_lock, flags);
233} 232}
234 233
235#ifdef CONFIG_RELEASE_MASTER 234#ifdef CONFIG_RELEASE_MASTER