diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-10-28 18:07:23 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2014-03-03 10:07:31 -0500 |
commit | 3962195280fa0694d04db975120c499adf5ea79d (patch) | |
tree | b316e78a7c46aeb0e00f88a5c510d7a620f4ec02 /litmus/sched_plugin.c | |
parent | a34cfefd7e22f2acfcd5a2f857f6a17f57b4e249 (diff) |
Extend sched_plugin API for GPUSync.
Patch adds new interfaces to the sched_plugin struct/API.
New interfaces expose task prioritization and inheritance
routines of a scheduler to external components. For example,
a single locking protocol implementation can support both FIFO
and EDF prioritization via this API ("litmus->compare(a, b)").
Diffstat (limited to 'litmus/sched_plugin.c')
-rw-r--r-- | litmus/sched_plugin.c | 113 |
1 files changed, 112 insertions, 1 deletions
diff --git a/litmus/sched_plugin.c b/litmus/sched_plugin.c index ab5b0c306a9a..c0b0bca23727 100644 --- a/litmus/sched_plugin.c +++ b/litmus/sched_plugin.c | |||
@@ -122,15 +122,88 @@ static long litmus_dummy_get_domain_proc_info(struct domain_proc_info **d) | |||
122 | } | 122 | } |
123 | 123 | ||
124 | #ifdef CONFIG_LITMUS_LOCKING | 124 | #ifdef CONFIG_LITMUS_LOCKING |
125 | static int litmus_dummy_compare(struct task_struct* a, struct task_struct* b) | ||
126 | { | ||
127 | TRACE_CUR("WARNING: Dummy compare function called!\n"); | ||
128 | return 0; | ||
129 | } | ||
125 | 130 | ||
126 | static long litmus_dummy_allocate_lock(struct litmus_lock **lock, int type, | 131 | static long litmus_dummy_allocate_lock(struct litmus_lock **lock, int type, |
127 | void* __user config) | 132 | void* __user config) |
128 | { | 133 | { |
129 | return -ENXIO; | 134 | return -ENXIO; |
130 | } | 135 | } |
131 | 136 | ||
137 | static void litmus_dummy_increase_prio(struct task_struct* t, | ||
138 | struct task_struct* prio_inh) | ||
139 | { | ||
140 | } | ||
141 | |||
142 | static void litmus_dummy_decrease_prio(struct task_struct* t, | ||
143 | struct task_struct* prio_inh, int budget_triggered) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | static int litmus_dummy___increase_prio(struct task_struct* t, | ||
148 | struct task_struct* prio_inh) | ||
149 | { | ||
150 | TRACE_CUR("WARNING: Dummy litmus_dummy___increase_prio called!\n"); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static int litmus_dummy___decrease_prio(struct task_struct* t, | ||
155 | struct task_struct* prio_inh, int budget_triggered) | ||
156 | { | ||
157 | TRACE_CUR("WARNING: Dummy litmus_dummy___decrease_prio called!\n"); | ||
158 | return 0; | ||
159 | } | ||
132 | #endif | 160 | #endif |
133 | 161 | ||
162 | #ifdef CONFIG_LITMUS_NESTED_LOCKING | ||
163 | static void litmus_dummy_nested_increase_prio(struct task_struct* t, | ||
164 | struct task_struct* prio_inh, | ||
165 | raw_spinlock_t *to_unlock, unsigned long irqflags) | ||
166 | { | ||
167 | } | ||
168 | |||
169 | static void litmus_dummy_nested_decrease_prio(struct task_struct* t, | ||
170 | struct task_struct* prio_inh, | ||
171 | raw_spinlock_t *to_unlock, unsigned long irqflags, | ||
172 | int budget_triggered) | ||
173 | { | ||
174 | } | ||
175 | |||
176 | static int litmus_dummy___compare( | ||
177 | struct task_struct* a, comparison_mode_t a_mod, | ||
178 | struct task_struct* b, comparison_mode_t b_mode) | ||
179 | { | ||
180 | TRACE_CUR("WARNING: Dummy compare function called!\n"); | ||
181 | return 0; | ||
182 | } | ||
183 | #endif | ||
184 | |||
185 | #ifdef CONFIG_LITMUS_DGL_SUPPORT | ||
186 | static raw_spinlock_t* litmus_dummy_get_dgl_spinlock(struct task_struct *t) | ||
187 | { | ||
188 | return NULL; | ||
189 | } | ||
190 | #endif | ||
191 | |||
192 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
193 | static long litmus_dummy_allocate_aff_obs(struct affinity_observer **aff_obs, | ||
194 | int type, | ||
195 | void* __user config) | ||
196 | { | ||
197 | return -ENXIO; | ||
198 | } | ||
199 | #endif | ||
200 | |||
201 | #if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD) | ||
202 | static int litmus_dummy_map_gpu_to_cpu(int gpu) | ||
203 | { | ||
204 | return 0; | ||
205 | } | ||
206 | #endif | ||
134 | 207 | ||
135 | /* The default scheduler plugin. It doesn't do anything and lets Linux do its | 208 | /* The default scheduler plugin. It doesn't do anything and lets Linux do its |
136 | * job. | 209 | * job. |
@@ -149,7 +222,26 @@ struct sched_plugin linux_sched_plugin = { | |||
149 | .deactivate_plugin = litmus_dummy_deactivate_plugin, | 222 | .deactivate_plugin = litmus_dummy_deactivate_plugin, |
150 | .get_domain_proc_info = litmus_dummy_get_domain_proc_info, | 223 | .get_domain_proc_info = litmus_dummy_get_domain_proc_info, |
151 | #ifdef CONFIG_LITMUS_LOCKING | 224 | #ifdef CONFIG_LITMUS_LOCKING |
225 | .compare = litmus_dummy_compare, | ||
152 | .allocate_lock = litmus_dummy_allocate_lock, | 226 | .allocate_lock = litmus_dummy_allocate_lock, |
227 | .increase_prio = litmus_dummy_increase_prio, | ||
228 | .decrease_prio = litmus_dummy_decrease_prio, | ||
229 | .__increase_prio = litmus_dummy___increase_prio, | ||
230 | .__decrease_prio = litmus_dummy___decrease_prio, | ||
231 | #endif | ||
232 | #ifdef CONFIG_LITMUS_NESTED_LOCKING | ||
233 | .nested_increase_prio = litmus_dummy_nested_increase_prio, | ||
234 | .nested_decrease_prio = litmus_dummy_nested_decrease_prio, | ||
235 | .__compare = litmus_dummy___compare, | ||
236 | #endif | ||
237 | #ifdef CONFIG_LITMUS_DGL_SUPPORT | ||
238 | .get_dgl_spinlock = litmus_dummy_get_dgl_spinlock, | ||
239 | #endif | ||
240 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
241 | .allocate_aff_obs = litmus_dummy_allocate_aff_obs, | ||
242 | #endif | ||
243 | #if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD) | ||
244 | .map_gpu_to_cpu = litmus_dummy_map_gpu_to_cpu, | ||
153 | #endif | 245 | #endif |
154 | .admit_task = litmus_dummy_admit_task | 246 | .admit_task = litmus_dummy_admit_task |
155 | }; | 247 | }; |
@@ -189,7 +281,26 @@ int register_sched_plugin(struct sched_plugin* plugin) | |||
189 | CHECK(deactivate_plugin); | 281 | CHECK(deactivate_plugin); |
190 | CHECK(get_domain_proc_info); | 282 | CHECK(get_domain_proc_info); |
191 | #ifdef CONFIG_LITMUS_LOCKING | 283 | #ifdef CONFIG_LITMUS_LOCKING |
284 | CHECK(compare); | ||
192 | CHECK(allocate_lock); | 285 | CHECK(allocate_lock); |
286 | CHECK(increase_prio); | ||
287 | CHECK(decrease_prio); | ||
288 | CHECK(__increase_prio); | ||
289 | CHECK(__decrease_prio); | ||
290 | #endif | ||
291 | #ifdef CONFIG_LITMUS_NESTED_LOCKING | ||
292 | CHECK(nested_increase_prio); | ||
293 | CHECK(nested_decrease_prio); | ||
294 | CHECK(__compare); | ||
295 | #endif | ||
296 | #ifdef CONFIG_LITMUS_DGL_SUPPORT | ||
297 | CHECK(get_dgl_spinlock); | ||
298 | #endif | ||
299 | #ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
300 | CHECK(allocate_aff_obs); | ||
301 | #endif | ||
302 | #if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD) | ||
303 | CHECK(map_gpu_to_cpu); | ||
193 | #endif | 304 | #endif |
194 | CHECK(admit_task); | 305 | CHECK(admit_task); |
195 | 306 | ||