diff options
-rw-r--r-- | include/litmus/color_queue.h | 2 | ||||
-rw-r--r-- | include/litmus/trace.h | 3 | ||||
-rw-r--r-- | litmus/color_queue.c | 4 | ||||
-rw-r--r-- | litmus/dgl.c | 11 | ||||
-rw-r--r-- | litmus/sched_mc.c | 24 | ||||
-rw-r--r-- | litmus/sched_psn_edf.c | 10 | ||||
-rw-r--r-- | litmus/way_tracker.c | 2 |
7 files changed, 39 insertions, 17 deletions
diff --git a/include/litmus/color_queue.h b/include/litmus/color_queue.h index 7386b0f569db..62d862c3e2b0 100644 --- a/include/litmus/color_queue.h +++ b/include/litmus/color_queue.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * Size of color queue work in bytes. | 9 | * Size of color queue work in bytes. |
10 | * This should divide the PAGE_SIZE evenly! | 10 | * This should divide the PAGE_SIZE evenly! |
11 | */ | 11 | */ |
12 | #define COLOR_QUEUE_REQ_SIZE 2048 | 12 | #define COLOR_QUEUE_REQ_SIZE 1024 |
13 | 13 | ||
14 | enum color_queue_request_type { | 14 | enum color_queue_request_type { |
15 | COLOR_QUEUE_IDLE, | 15 | COLOR_QUEUE_IDLE, |
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index 61332b5f7c50..c0842247ad8e 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -129,6 +129,9 @@ feather_callback void save_task_latency(unsigned long event, unsigned long when_ | |||
129 | #define TS_UNLOCK_START TIMESTAMP(180) | 129 | #define TS_UNLOCK_START TIMESTAMP(180) |
130 | #define TS_UNLOCK_END TIMESTAMP(181) | 130 | #define TS_UNLOCK_END TIMESTAMP(181) |
131 | 131 | ||
132 | /* #define TS_SCHED3_START(t) TTIMESTAMP(182, t) */ | ||
133 | /* #define TS_SCHED3_END(t) TTIMESTAMP(103, t) */ | ||
134 | |||
132 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) | 135 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) |
133 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) | 136 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) |
134 | 137 | ||
diff --git a/litmus/color_queue.c b/litmus/color_queue.c index a1030f5dc194..78177572da51 100644 --- a/litmus/color_queue.c +++ b/litmus/color_queue.c | |||
@@ -104,7 +104,7 @@ static void color_page_info_add_work(struct color_page_info *info, void *vaddr_s | |||
104 | for (i = 0; i < COLOR_REQUESTS_PER_PAGE; i++) { | 104 | for (i = 0; i < COLOR_REQUESTS_PER_PAGE; i++) { |
105 | struct color_queue_request *req = &info->requests[i]; | 105 | struct color_queue_request *req = &info->requests[i]; |
106 | void *work_vaddr = vaddr_start + i * COLOR_QUEUE_REQ_SIZE; | 106 | void *work_vaddr = vaddr_start + i * COLOR_QUEUE_REQ_SIZE; |
107 | 107 | ||
108 | WARN(req->request_type != COLOR_QUEUE_IDLE, | 108 | WARN(req->request_type != COLOR_QUEUE_IDLE, |
109 | "request was not idle!\n"); | 109 | "request was not idle!\n"); |
110 | 110 | ||
@@ -253,7 +253,7 @@ static void wait_next_phase(void) | |||
253 | color_queue.phase++; | 253 | color_queue.phase++; |
254 | QTRACE(color_queue, "bumped the phase and way\n"); | 254 | QTRACE(color_queue, "bumped the phase and way\n"); |
255 | raw_spin_unlock(&color_queue.lock); | 255 | raw_spin_unlock(&color_queue.lock); |
256 | } if (color_queue.nr_cpus < color_queue.at_barrier) { | 256 | } else if (color_queue.nr_cpus < color_queue.at_barrier) { |
257 | BUG(); | 257 | BUG(); |
258 | } else { | 258 | } else { |
259 | /* Wait for work from the last phase to complete. */ | 259 | /* Wait for work from the last phase to complete. */ |
diff --git a/litmus/dgl.c b/litmus/dgl.c index 983703797efb..7cb13a51e7be 100644 --- a/litmus/dgl.c +++ b/litmus/dgl.c | |||
@@ -620,8 +620,6 @@ static void will_wait_to_waiting(struct dgl *dgl, struct dgl_group_req *greq) | |||
620 | */ | 620 | */ |
621 | static void pull_prio(struct dgl *dgl, struct dgl_resource *resource) | 621 | static void pull_prio(struct dgl *dgl, struct dgl_resource *resource) |
622 | { | 622 | { |
623 | int check = 0; | ||
624 | unsigned long long check_prio = 0; | ||
625 | struct dgl_req *next; | 623 | struct dgl_req *next; |
626 | struct dgl_group_req *greq; | 624 | struct dgl_group_req *greq; |
627 | struct list_head *tmp_a, *tmp_b; | 625 | struct list_head *tmp_a, *tmp_b; |
@@ -631,8 +629,6 @@ static void pull_prio(struct dgl *dgl, struct dgl_resource *resource) | |||
631 | while ((next = next_waiting(resource, &tmp_a, &tmp_b, 0))) { | 629 | while ((next = next_waiting(resource, &tmp_a, &tmp_b, 0))) { |
632 | greq = next->greq; | 630 | greq = next->greq; |
633 | 631 | ||
634 | BUG_DUMP(dgl, check_prio && check_prio > greq->priority); | ||
635 | |||
636 | if (!arr_to_bool(dgl, greq->need_prio)) { | 632 | if (!arr_to_bool(dgl, greq->need_prio)) { |
637 | if (dgl->acquired[greq->cpu] == greq) { | 633 | if (dgl->acquired[greq->cpu] == greq) { |
638 | will_wait_to_acquire(dgl, greq); | 634 | will_wait_to_acquire(dgl, greq); |
@@ -640,9 +636,6 @@ static void pull_prio(struct dgl *dgl, struct dgl_resource *resource) | |||
640 | waiting_to_will_acquire(dgl, greq); | 636 | waiting_to_will_acquire(dgl, greq); |
641 | } | 637 | } |
642 | } | 638 | } |
643 | |||
644 | BUG_DUMP(dgl, ++check > dgl->requests); | ||
645 | check_prio = greq->priority; | ||
646 | } | 639 | } |
647 | } | 640 | } |
648 | 641 | ||
@@ -699,6 +692,8 @@ void add_group_req(struct dgl *dgl, struct dgl_group_req *greq, int cpu) | |||
699 | } | 692 | } |
700 | } | 693 | } |
701 | } | 694 | } |
695 | |||
696 | print_state(dgl); | ||
702 | } | 697 | } |
703 | 698 | ||
704 | /** | 699 | /** |
@@ -718,6 +713,7 @@ void update_group_req(struct dgl *dgl, struct dgl_group_req *greq) | |||
718 | 713 | ||
719 | BUG_DUMP(dgl, arr_to_bool(dgl, greq->blocked) && | 714 | BUG_DUMP(dgl, arr_to_bool(dgl, greq->blocked) && |
720 | dgl->acquired[greq->cpu] == greq); | 715 | dgl->acquired[greq->cpu] == greq); |
716 | print_state(dgl); | ||
721 | } | 717 | } |
722 | 718 | ||
723 | /** | 719 | /** |
@@ -775,6 +771,7 @@ void remove_group_req(struct dgl *dgl, struct dgl_group_req *greq) | |||
775 | } | 771 | } |
776 | 772 | ||
777 | --dgl->requests; | 773 | --dgl->requests; |
774 | print_state(dgl); | ||
778 | } | 775 | } |
779 | 776 | ||
780 | /** | 777 | /** |
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c index 85be5e17ad04..b19d7d208b51 100644 --- a/litmus/sched_mc.c +++ b/litmus/sched_mc.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <litmus/sched_mc.h> | 28 | #include <litmus/sched_mc.h> |
29 | #include <litmus/ce_domain.h> | 29 | #include <litmus/ce_domain.h> |
30 | #include <litmus/dgl.h> | 30 | #include <litmus/dgl.h> |
31 | #include <litmus/color.h> | ||
31 | 32 | ||
32 | struct mc_signal { | 33 | struct mc_signal { |
33 | int update:1; | 34 | int update:1; |
@@ -983,7 +984,7 @@ static void mc_task_new(struct task_struct *t, int on_rq, int running) | |||
983 | get_exec_cost(t), get_rt_period(t)); | 984 | get_exec_cost(t), get_rt_period(t)); |
984 | server_init(&tsk_rt(t)->server, -t->pid, | 985 | server_init(&tsk_rt(t)->server, -t->pid, |
985 | &tsk_rt(t)->job_params.job_no, | 986 | &tsk_rt(t)->job_params.job_no, |
986 | &tsk_rt(t)->linked_on); | 987 | NO_CPU); |
987 | tsk_rt(t)->task_params.budget_policy = PRECISE_ENFORCEMENT; | 988 | tsk_rt(t)->task_params.budget_policy = PRECISE_ENFORCEMENT; |
988 | 989 | ||
989 | BUG_ON(!tsk_rt(t)->server.job); | 990 | BUG_ON(!tsk_rt(t)->server.job); |
@@ -1071,6 +1072,10 @@ static void mc_task_exit(struct task_struct *task) | |||
1071 | BUG_ON(!is_realtime(task)); | 1072 | BUG_ON(!is_realtime(task)); |
1072 | TRACE(TS " RIP\n", TA(task)); | 1073 | TRACE(TS " RIP\n", TA(task)); |
1073 | 1074 | ||
1075 | if (tsk_mc_crit(task) == CRIT_LEVEL_B) { | ||
1076 | color_sched_out_task(task); | ||
1077 | } | ||
1078 | |||
1074 | remove_from_all(task); | 1079 | remove_from_all(task); |
1075 | if (tsk_rt(task)->scheduled_on != NO_CPU) { | 1080 | if (tsk_rt(task)->scheduled_on != NO_CPU) { |
1076 | per_cpu(cpus, tsk_rt(task)->scheduled_on).scheduled = NULL; | 1081 | per_cpu(cpus, tsk_rt(task)->scheduled_on).scheduled = NULL; |
@@ -1275,13 +1280,10 @@ static void process_signals(struct cpu_entry *entry) | |||
1275 | */ | 1280 | */ |
1276 | static struct task_struct* mc_schedule(struct task_struct* prev) | 1281 | static struct task_struct* mc_schedule(struct task_struct* prev) |
1277 | { | 1282 | { |
1278 | unsigned long flags; | ||
1279 | int out_of_time, sleep, preempt, exists, blocks, global, lower; | 1283 | int out_of_time, sleep, preempt, exists, blocks, global, lower; |
1280 | struct cpu_entry* entry = &__get_cpu_var(cpus); | 1284 | struct cpu_entry* entry = &__get_cpu_var(cpus); |
1281 | struct task_struct *next = NULL; | 1285 | struct task_struct *next = NULL; |
1282 | 1286 | ||
1283 | local_irq_save(flags); | ||
1284 | |||
1285 | /* Litmus gave up because it couldn't access the stack of the CPU | 1287 | /* Litmus gave up because it couldn't access the stack of the CPU |
1286 | * on which will_schedule was migrating from. Requeue it. | 1288 | * on which will_schedule was migrating from. Requeue it. |
1287 | * This really only happens in VMs | 1289 | * This really only happens in VMs |
@@ -1302,6 +1304,12 @@ static struct task_struct* mc_schedule(struct task_struct* prev) | |||
1302 | update_server_time(entry->scheduled); | 1304 | update_server_time(entry->scheduled); |
1303 | } | 1305 | } |
1304 | 1306 | ||
1307 | if (prev && tsk_mc_crit(prev) == CRIT_LEVEL_B && | ||
1308 | is_realtime(prev) && get_rt_job(prev) > 1) { | ||
1309 | color_sched_out_task(prev); | ||
1310 | } | ||
1311 | |||
1312 | |||
1305 | /* Determine state */ | 1313 | /* Determine state */ |
1306 | exists = entry->scheduled != NULL; | 1314 | exists = entry->scheduled != NULL; |
1307 | blocks = exists && !is_running(entry->scheduled); | 1315 | blocks = exists && !is_running(entry->scheduled); |
@@ -1356,7 +1364,13 @@ static struct task_struct* mc_schedule(struct task_struct* prev) | |||
1356 | } | 1364 | } |
1357 | entry->will_schedule = next; | 1365 | entry->will_schedule = next; |
1358 | 1366 | ||
1359 | raw_spin_unlock_irqrestore(&entry->lock, flags); | 1367 | raw_spin_unlock(&entry->lock); |
1368 | |||
1369 | if (next != prev) { | ||
1370 | if (next && tsk_mc_crit(next) == CRIT_LEVEL_B) { | ||
1371 | color_sched_in_task(next); | ||
1372 | } | ||
1373 | } | ||
1360 | 1374 | ||
1361 | if (next) { | 1375 | if (next) { |
1362 | tsk_rt(next)->last_exec_time = litmus_clock(); | 1376 | tsk_rt(next)->last_exec_time = litmus_clock(); |
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c index b26a5ff439ce..05b9a776e2f0 100644 --- a/litmus/sched_psn_edf.c +++ b/litmus/sched_psn_edf.c | |||
@@ -164,6 +164,7 @@ static void job_completion(struct task_struct* t, int forced) | |||
164 | 164 | ||
165 | set_rt_flags(t, RT_F_SLEEP); | 165 | set_rt_flags(t, RT_F_SLEEP); |
166 | prepare_for_next_period(t); | 166 | prepare_for_next_period(t); |
167 | setup_user_release(current, get_user_deadline(current)); | ||
167 | } | 168 | } |
168 | 169 | ||
169 | static void psnedf_tick(struct task_struct *t) | 170 | static void psnedf_tick(struct task_struct *t) |
@@ -193,6 +194,7 @@ static void psnedf_tick(struct task_struct *t) | |||
193 | 194 | ||
194 | static struct task_struct* psnedf_schedule(struct task_struct * prev) | 195 | static struct task_struct* psnedf_schedule(struct task_struct * prev) |
195 | { | 196 | { |
197 | unsigned long flags; | ||
196 | psnedf_domain_t* pedf = local_pedf; | 198 | psnedf_domain_t* pedf = local_pedf; |
197 | rt_domain_t* edf = &pedf->domain; | 199 | rt_domain_t* edf = &pedf->domain; |
198 | struct task_struct* next; | 200 | struct task_struct* next; |
@@ -273,6 +275,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev) | |||
273 | TRACE("becoming idle at %llu\n", litmus_clock()); | 275 | TRACE("becoming idle at %llu\n", litmus_clock()); |
274 | } | 276 | } |
275 | 277 | ||
278 | local_irq_save(flags); | ||
276 | if (prev && next != prev && is_realtime(prev) && get_rt_job(prev) > 1) { | 279 | if (prev && next != prev && is_realtime(prev) && get_rt_job(prev) > 1) { |
277 | color_sched_out_task(prev); | 280 | color_sched_out_task(prev); |
278 | } | 281 | } |
@@ -280,6 +283,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev) | |||
280 | if (next && next != prev && is_realtime(next)) { | 283 | if (next && next != prev && is_realtime(next)) { |
281 | color_sched_in_task(next); | 284 | color_sched_in_task(next); |
282 | } | 285 | } |
286 | local_irq_restore(flags); | ||
283 | 287 | ||
284 | pedf->scheduled = next; | 288 | pedf->scheduled = next; |
285 | sched_state_task_picked(); | 289 | sched_state_task_picked(); |
@@ -366,7 +370,6 @@ static void psnedf_task_block(struct task_struct *t) | |||
366 | { | 370 | { |
367 | /* only running tasks can block, thus t is in no queue */ | 371 | /* only running tasks can block, thus t is in no queue */ |
368 | TRACE_TASK(t, "block at %llu, state=%d\n", litmus_clock(), t->state); | 372 | TRACE_TASK(t, "block at %llu, state=%d\n", litmus_clock(), t->state); |
369 | |||
370 | BUG_ON(!is_realtime(t)); | 373 | BUG_ON(!is_realtime(t)); |
371 | BUG_ON(is_queued(t)); | 374 | BUG_ON(is_queued(t)); |
372 | } | 375 | } |
@@ -389,7 +392,10 @@ static void psnedf_task_exit(struct task_struct * t) | |||
389 | TRACE_TASK(t, "RIP, now reschedule\n"); | 392 | TRACE_TASK(t, "RIP, now reschedule\n"); |
390 | 393 | ||
391 | preempt(pedf); | 394 | preempt(pedf); |
392 | raw_spin_unlock_irqrestore(&pedf->slock, flags); | 395 | |
396 | raw_spin_unlock(&pedf->slock); | ||
397 | color_sched_out_task(t); | ||
398 | local_irq_restore(flags); | ||
393 | } | 399 | } |
394 | 400 | ||
395 | #ifdef CONFIG_LITMUS_LOCKING | 401 | #ifdef CONFIG_LITMUS_LOCKING |
diff --git a/litmus/way_tracker.c b/litmus/way_tracker.c index eb7e1f48d327..6afccc7ea5f7 100644 --- a/litmus/way_tracker.c +++ b/litmus/way_tracker.c | |||
@@ -36,6 +36,7 @@ static int take_next_way(unsigned int color) | |||
36 | idx = peek_next_way(color); | 36 | idx = peek_next_way(color); |
37 | if (idx != -1) { | 37 | if (idx != -1) { |
38 | clear_bit(idx, &ways[color]); | 38 | clear_bit(idx, &ways[color]); |
39 | TRACE("Took, now %lu free of color %d\n", hweight_long(ways[color]), color); | ||
39 | } else { | 40 | } else { |
40 | /* Seriously bad. */ | 41 | /* Seriously bad. */ |
41 | BUG(); | 42 | BUG(); |
@@ -49,6 +50,7 @@ static void release_way(unsigned int color, int way) | |||
49 | BUG_ON(way < 0 || way > color_cache_info.ways); | 50 | BUG_ON(way < 0 || way > color_cache_info.ways); |
50 | raw_spin_lock(&lock); | 51 | raw_spin_lock(&lock); |
51 | __set_bit(way, &ways[color]); | 52 | __set_bit(way, &ways[color]); |
53 | TRACE("Released, now %lu free of color %d\n", hweight_long(ways[color]), color); | ||
52 | raw_spin_unlock(&lock); | 54 | raw_spin_unlock(&lock); |
53 | } | 55 | } |
54 | 56 | ||