aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZelin Tong <ztong@ludwig.cs.unc.edu>2020-09-22 17:32:46 -0400
committerZelin Tong <ztong@ludwig.cs.unc.edu>2020-09-22 17:32:46 -0400
commit5eacf27747940e3a33f2b48f6335c6fa255598f5 (patch)
treef09a05b0ebacbec3986af6ea47ecb7894155cdf8
parentea90ac994afd39ec5899f663502502d47e060ae2 (diff)
Checkpoint1 modified to support Checkpoint2 work.
Works under preliminary tests
-rw-r--r--include/litmus/reservations/gedf_reservation.h3
-rw-r--r--litmus/reservations/ext_reservation.c4
-rw-r--r--litmus/reservations/gedf_reservation.c104
-rw-r--r--litmus/reservations/task_reservation.c30
-rw-r--r--litmus/sched_ext_res.c5
-rwxr-xr-xrun_vm12
6 files changed, 88 insertions, 60 deletions
diff --git a/include/litmus/reservations/gedf_reservation.h b/include/litmus/reservations/gedf_reservation.h
index 235591a0897b..e2a4a3dc5968 100644
--- a/include/litmus/reservations/gedf_reservation.h
+++ b/include/litmus/reservations/gedf_reservation.h
@@ -54,7 +54,8 @@ struct gedf_reservation_environment {
54}; 54};
55 55
56long alloc_gedf_reservation_environment( 56long alloc_gedf_reservation_environment(
57 struct gedf_reservation_environment** _env 57 struct gedf_reservation_environment** _env,
58 int num_cpus
58); 59);
59 60
60#endif 61#endif
diff --git a/litmus/reservations/ext_reservation.c b/litmus/reservations/ext_reservation.c
index 7d80491fd7b2..9623ec520e98 100644
--- a/litmus/reservations/ext_reservation.c
+++ b/litmus/reservations/ext_reservation.c
@@ -2,8 +2,8 @@
2#include <litmus/reservations/ext_reservation.h> 2#include <litmus/reservations/ext_reservation.h>
3 3
4/* allocated in litmus.c */ 4/* allocated in litmus.c */
5struct kmem_cache* bheap_node_cache; 5extern struct kmem_cache* bheap_node_cache;
6struct kmem_cache* release_heap_cache; 6extern struct kmem_cache* release_heap_cache;
7 7
8void init_ext_reservation(struct reservation* res) 8void init_ext_reservation(struct reservation* res)
9{ 9{
diff --git a/litmus/reservations/gedf_reservation.c b/litmus/reservations/gedf_reservation.c
index b813544cc1bf..aa1878e208b8 100644
--- a/litmus/reservations/gedf_reservation.c
+++ b/litmus/reservations/gedf_reservation.c
@@ -1,3 +1,4 @@
1#include <linux/list.h>
1#include <linux/sched.h> 2#include <linux/sched.h>
2#include <linux/smp.h> 3#include <linux/smp.h>
3#include <linux/slab.h> 4#include <linux/slab.h>
@@ -39,7 +40,7 @@ static int higher_prio(struct reservation* first,
39} 40}
40 41
41/* returns 1 if res of a has earlier deadline than res of b */ 42/* returns 1 if res of a has earlier deadline than res of b */
42static int edf_ready_order(struct bheap_node* a, bheap_node* b) 43static int edf_ready_order(struct bheap_node* a, struct bheap_node* b)
43{ 44{
44 return higher_prio(bheap2res(b), bheap2res(a)); 45 return higher_prio(bheap2res(b), bheap2res(a));
45} 46}
@@ -74,7 +75,7 @@ static struct cpu_entry* lowest_prio_cpu(struct bheap* cpu_heap)
74 return hn->value; 75 return hn->value;
75} 76}
76 77
77int edf_preemption_needed(rt_domain_t* rt, struct gedf_reservation* res) 78static int edf_preemption_needed(rt_domain_t* rt, struct reservation* res)
78{ 79{
79 /* we need the read lock for edf_ready_queue */ 80 /* we need the read lock for edf_ready_queue */
80 /* no need to preempt if there is nothing pending */ 81 /* no need to preempt if there is nothing pending */
@@ -89,7 +90,7 @@ int edf_preemption_needed(rt_domain_t* rt, struct gedf_reservation* res)
89 */ 90 */
90 91
91 /* reversed */ 92 /* reversed */
92 return higher_prio(&res->res, __next_ready_res(rt)); 93 return higher_prio(res, __next_ready_res(rt));
93} 94}
94 95
95/* ******************************************************************************** */ 96/* ******************************************************************************** */
@@ -103,9 +104,10 @@ static void preempt(struct cpu_entry* entry)
103 } 104 }
104} 105}
105 106
106static void timer_callback(struct hrtimer* timer) 107static enum hrtimer_restart timer_callback(struct hrtimer* timer)
107{ 108{
108 litmus_reschedule_local(); 109 litmus_reschedule_local();
110 return HRTIMER_NORESTART;
109} 111}
110 112
111static void requeue(rt_domain_t* domain, struct reservation* res) { 113static void requeue(rt_domain_t* domain, struct reservation* res) {
@@ -158,7 +160,7 @@ static void unlink(struct gedf_reservation* res)
158 if (res->linked_on) { 160 if (res->linked_on) {
159 link_task_to_cpu(NULL, res->linked_on); 161 link_task_to_cpu(NULL, res->linked_on);
160 res->linked_on = NULL; 162 res->linked_on = NULL;
161 } else if (is_queued_res(res)) { 163 } else if (is_queued_res(&res->res)) {
162 remove_res(&gedf_env->domain, &res->res); 164 remove_res(&gedf_env->domain, &res->res);
163 } 165 }
164} 166}
@@ -203,7 +205,7 @@ static void gedf_on_schedule(
203 res->env->ops->resume(res->env, now, cpu); 205 res->env->ops->resume(res->env, now, cpu);
204} 206}
205 207
206static void replenish_budget( 208static void gedf_replenish_budget(
207 struct reservation* res, 209 struct reservation* res,
208 int cpu) 210 int cpu)
209{ 211{
@@ -230,7 +232,7 @@ static void gedf_drain_budget(
230 res->env->ops->update_time(res->env, how_much, cpu); 232 res->env->ops->update_time(res->env, how_much, cpu);
231} 233}
232 234
233static struct gedf_reservation_ops gedf_ops = 235static struct reservation_ops gedf_ops =
234{ 236{
235 .drain_budget = gedf_drain_budget, 237 .drain_budget = gedf_drain_budget,
236 .replenish_budget = gedf_replenish_budget, 238 .replenish_budget = gedf_replenish_budget,
@@ -251,8 +253,9 @@ long alloc_gedf_reservation(
251 if (!gedf_res) 253 if (!gedf_res)
252 return -ENOMEM; 254 return -ENOMEM;
253 255
254 init_ext_reservation(&gedf_res.res); 256 init_ext_reservation(&gedf_res->res);
255 gedf_res->res.id = id; 257 gedf_res->res.id = id;
258 gedf_res->res.ops = &gedf_ops;
256 *_res = gedf_res; 259 *_res = gedf_res;
257 260
258 gedf_res->linked_on = NULL; 261 gedf_res->linked_on = NULL;
@@ -271,21 +274,23 @@ static void gedf_env_shutdown(
271 struct reservation_environment* env) 274 struct reservation_environment* env)
272{ 275{
273 struct gedf_reservation_environment* gedf_env; 276 struct gedf_reservation_environment* gedf_env;
277 struct reservation* res;
274 int i; 278 int i;
275 struct gedf_reservation gedf_res; 279 unsigned long flags;
276 gedf_env = container_of(env, struct gedf_reservation_environment* gedf_env); 280
281 gedf_env = container_of(env, struct gedf_reservation_environment, env);
277 suspend_releases(&gedf_env->domain); 282 suspend_releases(&gedf_env->domain);
278 raw_spin_lock_irqsave(&gedf_env->domain.ready_lock, flags); 283 raw_spin_lock_irqsave(&gedf_env->domain.ready_lock, flags);
279 for_each_online_cpu(i) { 284 for_each_online_cpu(i) {
280 hrtimer_cancel(&cpu_entries[i]); 285 hrtimer_cancel(&gedf_env->cpu_entries[i].timer);
281 } 286 }
282 while (!list_empty(&gedf_env->all_reservations)) { 287 while (!list_empty(&gedf_env->all_reservations)) {
283 gedf_res = list_first_entry(&gedf_env->all_reservations, 288 res = list_first_entry(&gedf_env->all_reservations,
284 struct gedf_reservation, all_list); 289 struct reservation, all_list);
285 list_del(&gedf_res->res.all_list); 290 list_del(&res->all_list);
286 res->ops->shutdown(res); 291 res->ops->shutdown(res);
287 } 292 }
288 raw_spin_unlock_irqsave(&gedf_env->domain.ready_lock, flags); 293 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags);
289 kfree(env); 294 kfree(env);
290} 295}
291 296
@@ -298,15 +303,16 @@ static void gedf_env_remove_res(
298 int complete) 303 int complete)
299{ 304{
300 struct gedf_reservation_environment* gedf_env; 305 struct gedf_reservation_environment* gedf_env;
301 struct gedf_reservation gedf_res; 306 struct gedf_reservation* gedf_res;
302 unsigned long flags; 307 unsigned long flags;
308
303 gedf_env = container_of(env, struct gedf_reservation_environment, env); 309 gedf_env = container_of(env, struct gedf_reservation_environment, env);
304 gedf_res = container_of(res, struct gedf_reservation, res); 310 gedf_res = container_of(res, struct gedf_reservation, res);
305 gedf_res->will_remove = complete; 311 gedf_res->will_remove = complete;
306 gedf_res->blocked = !complete; 312 gedf_res->blocked = !complete;
307 raw_spin_lock_irqsave(&gedf_env->domain.ready_lock, flags); 313 raw_spin_lock_irqsave(&gedf_env->domain.ready_lock, flags);
308 list_del_init(&gedf_res->res.all_list, &gedf_env->all_reservations); 314 list_del_init(&gedf_res->res.all_list);
309 unlink(res); 315 unlink(gedf_res);
310 preempt(gedf_res->scheduled_on); 316 preempt(gedf_res->scheduled_on);
311 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags); 317 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags);
312 /* After preempt is called, schedule will update budget tracking. 318 /* After preempt is called, schedule will update budget tracking.
@@ -324,7 +330,7 @@ static void gedf_env_add_res(
324 struct reservation* res) 330 struct reservation* res)
325{ 331{
326 struct gedf_reservation_environment* gedf_env; 332 struct gedf_reservation_environment* gedf_env;
327 struct gedf_reservation gedf_res; 333 struct gedf_reservation* gedf_res;
328 unsigned long flags; 334 unsigned long flags;
329 gedf_env = container_of(env, struct gedf_reservation_environment, env); 335 gedf_env = container_of(env, struct gedf_reservation_environment, env);
330 gedf_res = container_of(res, struct gedf_reservation, res); 336 gedf_res = container_of(res, struct gedf_reservation, res);
@@ -339,7 +345,7 @@ static void gedf_env_add_res(
339 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags); 345 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags);
340} 346}
341 347
342static gedf_env_suspend( 348static void gedf_env_suspend(
343 struct reservation_environment* env, 349 struct reservation_environment* env,
344 int cpu) 350 int cpu)
345{ 351{
@@ -350,9 +356,9 @@ static gedf_env_suspend(
350 356
351 gedf_env = container_of(env, struct gedf_reservation_environment, env); 357 gedf_env = container_of(env, struct gedf_reservation_environment, env);
352 env_cpu = gedf_env->cpu_mapping[cpu]; 358 env_cpu = gedf_env->cpu_mapping[cpu];
353 entry = gedf_env->cpu_entries[env_cpu]; 359 entry = &gedf_env->cpu_entries[env_cpu];
354 360
355 if (res_cpu == 0) 361 if (env_cpu == 0)
356 suspend_releases(&gedf_env->domain); 362 suspend_releases(&gedf_env->domain);
357 363
358 /* this essentially removes the cpu from scheduling consideration */ 364 /* this essentially removes the cpu from scheduling consideration */
@@ -369,7 +375,7 @@ static gedf_env_suspend(
369 hrtimer_try_to_cancel(&entry->timer); 375 hrtimer_try_to_cancel(&entry->timer);
370} 376}
371 377
372static gedf_env_resume( 378static void gedf_env_resume(
373 struct reservation_environment* env, 379 struct reservation_environment* env,
374 lt_t now, 380 lt_t now,
375 int cpu) 381 int cpu)
@@ -381,7 +387,7 @@ static gedf_env_resume(
381 387
382 gedf_env = container_of(env, struct gedf_reservation_environment, env); 388 gedf_env = container_of(env, struct gedf_reservation_environment, env);
383 env_cpu = gedf_env->cpu_mapping[cpu]; 389 env_cpu = gedf_env->cpu_mapping[cpu];
384 entry = gedf_env->cpu_entries[env_cpu]; 390 entry = &gedf_env->cpu_entries[env_cpu];
385 391
386 if (env_cpu == 0) 392 if (env_cpu == 0)
387 resume_releases(&gedf_env->domain); 393 resume_releases(&gedf_env->domain);
@@ -394,7 +400,10 @@ static gedf_env_resume(
394 */ 400 */
395 401
396 if (entry->scheduled) 402 if (entry->scheduled)
397 hrtimer_start(&entry->timer, ns_to_ktime(now + entry->scheduled->cur_budget)); 403 hrtimer_start(
404 &entry->timer,
405 ns_to_ktime(now + entry->scheduled->cur_budget),
406 HRTIMER_MODE_ABS_PINNED);
398} 407}
399 408
400static struct task_struct* gedf_env_dispatch( 409static struct task_struct* gedf_env_dispatch(
@@ -405,7 +414,7 @@ static struct task_struct* gedf_env_dispatch(
405 struct gedf_reservation_environment* gedf_env; 414 struct gedf_reservation_environment* gedf_env;
406 struct cpu_entry* entry; 415 struct cpu_entry* entry;
407 int env_cpu; 416 int env_cpu;
408 struct task_struct* next; 417 struct task_struct* next = NULL;
409 unsigned long flags; 418 unsigned long flags;
410 419
411 gedf_env = container_of(env, struct gedf_reservation_environment, env); 420 gedf_env = container_of(env, struct gedf_reservation_environment, env);
@@ -417,16 +426,21 @@ static struct task_struct* gedf_env_dispatch(
417 check_for_preemptions(gedf_env); 426 check_for_preemptions(gedf_env);
418 if (entry->scheduled != entry->linked) { 427 if (entry->scheduled != entry->linked) {
419 if (entry->scheduled) 428 if (entry->scheduled)
420 entry->scheduled->op->on_preempt(entry->scheduled, cpu); 429 entry->scheduled->ops->on_preempt(entry->scheduled, cpu);
421 if (entry->linked) 430 if (entry->linked)
422 entry->linked->op->on_schedule(entry->linked, now, cpu); 431 entry->linked->ops->on_schedule(entry->linked, now, cpu);
423 entry->scheduled = entry->linked; 432 entry->scheduled = entry->linked;
424 } 433 }
425 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags); 434 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags);
426 435
427 next = entry->scheduled->env->op->dispatch(next, time_slice, cpu); 436 //TODO: Think about possible problems with entry->scheduled being changed
437 if (entry->scheduled) {
438 next = entry->scheduled->env->ops->dispatch(entry->scheduled->env, now, cpu);
428 439
429 hrtimer_start(&entry->timer, ns_to_ktime(now + entry->scheduled->cur_budget); 440 hrtimer_start(&entry->timer,
441 ns_to_ktime(now + entry->scheduled->cur_budget),
442 HRTIMER_MODE_ABS_PINNED);
443 }
430 444
431 return next; 445 return next;
432} 446}
@@ -445,6 +459,10 @@ static void gedf_env_update_time(
445 entry = &gedf_env->cpu_entries[env_cpu]; 459 entry = &gedf_env->cpu_entries[env_cpu];
446 460
447 BUG_ON(entry->id != cpu); 461 BUG_ON(entry->id != cpu);
462
463 if (!entry->scheduled)
464 return;
465
448 entry->scheduled->ops->drain_budget(entry->scheduled, how_much, cpu); 466 entry->scheduled->ops->drain_budget(entry->scheduled, how_much, cpu);
449 gedf_res = container_of(entry->scheduled, struct gedf_reservation, res); 467 gedf_res = container_of(entry->scheduled, struct gedf_reservation, res);
450 /* if flagged for removal from environment, invoke shutdown callback */ 468 /* if flagged for removal from environment, invoke shutdown callback */
@@ -453,13 +471,13 @@ static void gedf_env_update_time(
453 entry->scheduled->ops->shutdown(entry->scheduled); 471 entry->scheduled->ops->shutdown(entry->scheduled);
454 entry->scheduled = NULL; 472 entry->scheduled = NULL;
455 } else if (!entry->scheduled->cur_budget) { 473 } else if (!entry->scheduled->cur_budget) {
456 entry->scheduled->ops->replenish(entry->scheduled, cpu); 474 entry->scheduled->ops->replenish_budget(entry->scheduled, cpu);
457 /* unlink and requeue if not blocked */ 475 /* unlink and requeue if not blocked */
458 if (!gedf_res->blocked) { 476 if (!gedf_res->blocked) {
459 raw_spin_lock_irqsave(&gedf_env->domain.ready_lock, flags); 477 raw_spin_lock_irqsave(&gedf_env->domain.ready_lock, flags);
460 unlink(entry->scheduled); 478 unlink((struct gedf_reservation*)entry->scheduled);
461 requeue(&gedf_env->domain, entry->scheduled); 479 requeue(&gedf_env->domain, entry->scheduled);
462 check_for_preemption(); 480 check_for_preemptions(gedf_env);
463 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags); 481 raw_spin_unlock_irqrestore(&gedf_env->domain.ready_lock, flags);
464 } 482 }
465 } 483 }
@@ -468,16 +486,16 @@ static void gedf_env_update_time(
468static void gedf_env_release_jobs(rt_domain_t* rt, struct bheap* res) 486static void gedf_env_release_jobs(rt_domain_t* rt, struct bheap* res)
469{ 487{
470 unsigned long flags; 488 unsigned long flags;
471 struct gedf_reservation_environment gedf_env 489 struct gedf_reservation_environment* gedf_env
472 = container_of(rt, struct gedf_reservation_environment, domain); 490 = container_of(rt, struct gedf_reservation_environment, domain);
473 491
474 raw_spin_lock_irqsave(&rt->ready_lock); 492 raw_spin_lock_irqsave(&rt->ready_lock, flags);
475 __merge_ready_res(rt, tasks); 493 __merge_ready_res(rt, res);
476 check_for_preemptions(gedf_env); 494 check_for_preemptions(gedf_env);
477 raw_spin_unlock_irqrestore(&rt->ready_lock); 495 raw_spin_unlock_irqrestore(&rt->ready_lock, flags);
478} 496}
479 497
480static struct gedf_reservation_environment_ops gedf_env_ops { 498static struct reservation_environment_ops gedf_env_ops = {
481 .update_time = gedf_env_update_time, 499 .update_time = gedf_env_update_time,
482 .dispatch = gedf_env_dispatch, 500 .dispatch = gedf_env_dispatch,
483 .resume = gedf_env_resume, 501 .resume = gedf_env_resume,
@@ -488,9 +506,12 @@ static struct gedf_reservation_environment_ops gedf_env_ops {
488}; 506};
489 507
490long alloc_gedf_reservation_environment( 508long alloc_gedf_reservation_environment(
491 struct gedf_reservation_environment** _env) 509 struct gedf_reservation_environment** _env,
510 int num_cpus)
492{ 511{
493 struct gedf_reservation_environment* gedf_env; 512 struct gedf_reservation_environment* gedf_env;
513 int i;
514
494 gedf_env = kzalloc(sizeof(struct gedf_reservation_environment), GFP_KERNEL); 515 gedf_env = kzalloc(sizeof(struct gedf_reservation_environment), GFP_KERNEL);
495 if (!gedf_env) 516 if (!gedf_env)
496 return -ENOMEM; 517 return -ENOMEM;
@@ -500,11 +521,12 @@ long alloc_gedf_reservation_environment(
500 INIT_LIST_HEAD(&gedf_env->all_reservations); 521 INIT_LIST_HEAD(&gedf_env->all_reservations);
501 gedf_env->num_cpus = 0; 522 gedf_env->num_cpus = 0;
502 bheap_init(&gedf_env->cpu_heap); 523 bheap_init(&gedf_env->cpu_heap);
503 for_each_online_cpu(i) { 524 for (i = 0; i < num_cpus; i++) {
504 gedf_env->cpu_entries[i].hn = &gedf_env->cpu_node[i]; 525 gedf_env->cpu_entries[i].hn = &gedf_env->cpu_node[i];
505 hrtimer_init(&gedf_env->cpu_entries[i].timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED); 526 hrtimer_init(&gedf_env->cpu_entries[i].timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
506 gedf_env->cpu_entires[i].timer.function = timer_callback; 527 gedf_env->cpu_entries[i].timer.function = timer_callback;
507 bheap_node_init(&gedf_env->cpu_entries[i].hn, &gedf_env->cpu_entries[i]); 528 bheap_node_init(&gedf_env->cpu_entries[i].hn, &gedf_env->cpu_entries[i]);
529 bheap_insert(cpu_lower_prio, &gedf_env->cpu_heap, gedf_env->cpu_entries[i].hn);
508 } 530 }
509 rt_domain_init(&gedf_env->domain, edf_ready_order, NULL, gedf_env_release_jobs); 531 rt_domain_init(&gedf_env->domain, edf_ready_order, NULL, gedf_env_release_jobs);
510 532
diff --git a/litmus/reservations/task_reservation.c b/litmus/reservations/task_reservation.c
index 8a8fe4237882..ee4bbbc5ed07 100644
--- a/litmus/reservations/task_reservation.c
+++ b/litmus/reservations/task_reservation.c
@@ -1,10 +1,11 @@
1#include <linux/slab.h> 1#include <linux/slab.h>
2
3#include <litmus/litmus.h>
2#include <litmus/reservations/ext_reservation.h> 4#include <litmus/reservations/ext_reservation.h>
3#include <litmus/reservations/task_reservation.h> 5#include <litmus/reservations/task_reservation.h>
4 6
5static void task_env_shutdown( 7static void task_env_shutdown(
6 struct reservation_environment* env, 8 struct reservation_environment* env)
7 int cpu)
8{ 9{
9 struct task_reservation_environment* task_env = 10 struct task_reservation_environment* task_env =
10 container_of(env, struct task_reservation_environment, env); 11 container_of(env, struct task_reservation_environment, env);
@@ -16,15 +17,14 @@ static void task_env_shutdown(
16static void task_env_remove_res( 17static void task_env_remove_res(
17 struct reservation_environment* env, 18 struct reservation_environment* env,
18 struct reservation* res, 19 struct reservation* res,
19 int cpu) 20 int complete)
20{ 21{
21 return; 22 return;
22} 23}
23 24
24static void task_env_add_res( 25static void task_env_add_res(
25 struct reservation_environment* env, 26 struct reservation_environment* env,
26 struct reservation* res, 27 struct reservation* res)
27 int cpu)
28{ 28{
29 return; 29 return;
30} 30}
@@ -53,7 +53,7 @@ static struct task_struct* task_env_dispatch(
53 return task_env->task; 53 return task_env->task;
54} 54}
55 55
56static void task_env_advance_time( 56static void task_env_update_time(
57 struct reservation_environment* env, 57 struct reservation_environment* env,
58 lt_t how_much, 58 lt_t how_much,
59 int cpu) 59 int cpu)
@@ -61,14 +61,14 @@ static void task_env_advance_time(
61 return; 61 return;
62} 62}
63 63
64static struct task_reservation_environment_ops task_env_ops { 64static struct reservation_environment_ops task_env_ops = {
65 .advance_time = gedf_env_advance_time, 65 .update_time = task_env_update_time,
66 .dispatch = gedf_env_dispatch, 66 .dispatch = task_env_dispatch,
67 .resume = gedf_env_resume, 67 .resume = task_env_resume,
68 .suspend = gedf_env_suspend, 68 .suspend = task_env_suspend,
69 .add_res = gedf_env_add_res, 69 .add_res = task_env_add_res,
70 .remove_res = gedf_env_remove_res, 70 .remove_res = task_env_remove_res,
71 .shutdown = gedf_env_shutdown 71 .shutdown = task_env_shutdown
72}; 72};
73 73
74long alloc_task_reservation_environment( 74long alloc_task_reservation_environment(
@@ -81,7 +81,9 @@ long alloc_task_reservation_environment(
81 return -ENOMEM; 81 return -ENOMEM;
82 82
83 task_env->task = task; 83 task_env->task = task;
84 task_env->env.ops = &task_env_ops;
84 tsk_rt(task)->plugin_state = task_env; 85 tsk_rt(task)->plugin_state = task_env;
85 86
86 *_env = task_env; 87 *_env = task_env;
88 return 0;
87} 89}
diff --git a/litmus/sched_ext_res.c b/litmus/sched_ext_res.c
index 60f3c4bdd7df..3c34985bba85 100644
--- a/litmus/sched_ext_res.c
+++ b/litmus/sched_ext_res.c
@@ -325,15 +325,16 @@ static void ext_res_setup_domain_proc(void)
325static long ext_res_activate_plugin(void) 325static long ext_res_activate_plugin(void)
326{ 326{
327 int cpu; 327 int cpu;
328 int num_cpus = num_online_cpus();
328 329
329 alloc_gedf_reservation_environment(&gedf_env); 330 alloc_gedf_reservation_environment(&gedf_env, num_cpus);
330 331
331 for_each_online_cpu(cpu) { 332 for_each_online_cpu(cpu) {
332 TRACE("Initializing CPU%d...\n", cpu); 333 TRACE("Initializing CPU%d...\n", cpu);
333 gedf_env->cpu_mapping[cpu] = cpu; 334 gedf_env->cpu_mapping[cpu] = cpu;
334 gedf_env->cpu_entries[cpu].id = cpu; 335 gedf_env->cpu_entries[cpu].id = cpu;
335 } 336 }
336 gedf_env->num_cpus = cpu; 337 gedf_env->num_cpus = num_cpus;
337 338
338 ext_res_setup_domain_proc(); 339 ext_res_setup_domain_proc();
339 340
diff --git a/run_vm1 b/run_vm1
new file mode 100755
index 000000000000..514834a993cb
--- /dev/null
+++ b/run_vm1
@@ -0,0 +1,2 @@
1#!/bin/sh
2qemu-system-x86_64 -kernel arch/x86/boot/bzImage -serial mon:stdio -display none -append "root=/dev/mapper/virtualboy--vg-root console=ttyS0 nokalsr kgdboc=ttyS1,115200" -m 24576 --enable-kvm -cpu host -smp 8 -hda /home/ztong/ubuntu.qcow2.img -initrd arch/x86/boot/initrd.img -net nic,model=e1000 -net user,hostfwd=tcp::22223-:22 -serial tcp::22224,server,nowait -rtc base=localtime,clock=vm,driftfix=none -s