aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-04-23 13:23:34 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-04-23 13:23:34 -0400
commitd7bc8dd1465068da165342cdc0e4e44b53a576a1 (patch)
tree017de7113348fcfe358899ae768d866ca5905c95
parenta1dcb10eb16d6e71a755124376de16e2bba44339 (diff)
Fixed bug where tasks which finished under slack prevented a plugin switch.
-rw-r--r--litmus/litmus.c2
-rw-r--r--litmus/sched_edf_hsb.c25
2 files changed, 5 insertions, 22 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 38f276d67095..657b4eda96e6 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -371,9 +371,9 @@ void litmus_exit_task(struct task_struct* tsk)
371 if (!bheap_node_in_heap(tsk_rt(tsk)->heap_node)) { 371 if (!bheap_node_in_heap(tsk_rt(tsk)->heap_node)) {
372 bheap_node_free(tsk_rt(tsk)->heap_node); 372 bheap_node_free(tsk_rt(tsk)->heap_node);
373 release_heap_free(tsk_rt(tsk)->rel_heap); 373 release_heap_free(tsk_rt(tsk)->rel_heap);
374 atomic_dec(&rt_task_count);
375 reinit_litmus_state(tsk, 1); 374 reinit_litmus_state(tsk, 1);
376 } 375 }
376 atomic_dec(&rt_task_count);
377 } 377 }
378} 378}
379 379
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c
index 7fd3d545234d..6d0e8a74e4ae 100644
--- a/litmus/sched_edf_hsb.c
+++ b/litmus/sched_edf_hsb.c
@@ -62,8 +62,6 @@
62#define SLACK_DONATED_ACTION 8 62#define SLACK_DONATED_ACTION 8
63#define CANDIDATE_ADDED_ACTION 9 63#define CANDIDATE_ADDED_ACTION 9
64 64
65atomic_t servers_running = ATOMIC_INIT(0); /* TODO should be unnecessary */
66
67/* Uncomment for human readable time */ 65/* Uncomment for human readable time */
68#define TIME(x) \ 66#define TIME(x) \
69 (x) 67 (x)
@@ -1820,7 +1818,7 @@ static void servers_released(struct list_head *servers)
1820 TRACE_SERVER_SUB(server, "inserting BE server"); 1818 TRACE_SERVER_SUB(server, "inserting BE server");
1821 bheap_insert(server_order, &be_ready_servers, 1819 bheap_insert(server_order, &be_ready_servers,
1822 server->hn); 1820 server->hn);
1823 check_donate_slack(server); 1821 check_donate_slack(server, NULL);
1824 } else { /* HRT server */ 1822 } else { /* HRT server */
1825 hrt_server_released(server); 1823 hrt_server_released(server);
1826 } 1824 }
@@ -1889,10 +1887,6 @@ static void stop_be_servers(void)
1889 server_t *be_server; 1887 server_t *be_server;
1890 struct list_head *pos, *safe; 1888 struct list_head *pos, *safe;
1891 1889
1892 //atomic_set(&servers_running, 0);
1893
1894 TRACE_SUB("stopping BE servers");
1895
1896 list_for_each_safe(pos, safe, &be_servers) { 1890 list_for_each_safe(pos, safe, &be_servers) {
1897 be_server = list_entry(pos, server_t, list); 1891 be_server = list_entry(pos, server_t, list);
1898 1892
@@ -1960,8 +1954,6 @@ static void stop_hrt_servers(void)
1960 cpu_entry_t *entry; 1954 cpu_entry_t *entry;
1961 hrt_server_t *hrt_server; 1955 hrt_server_t *hrt_server;
1962 1956
1963 //atomic_set(&servers_running, 0);
1964
1965 for_each_online_cpu(cpu) { 1957 for_each_online_cpu(cpu) {
1966 entry = &per_cpu(cpu_entries, cpu); 1958 entry = &per_cpu(cpu_entries, cpu);
1967 hrt_server = &entry->hrt_server; 1959 hrt_server = &entry->hrt_server;
@@ -1988,10 +1980,6 @@ static void start_servers(lt_t time)
1988 server_t *be_server; 1980 server_t *be_server;
1989 struct list_head *pos; 1981 struct list_head *pos;
1990 1982
1991 if (atomic_read(&servers_running))
1992 return;
1993 atomic_set(&servers_running, 1);
1994
1995 TRACE_SUB("starting servers at %llu", time); 1983 TRACE_SUB("starting servers at %llu", time);
1996 1984
1997 /* Start HRT servers */ 1985 /* Start HRT servers */
@@ -2051,6 +2039,8 @@ static long edf_hsb_activate_plugin(void)
2051 update_cpu_position(entry); 2039 update_cpu_position(entry);
2052 } 2040 }
2053 2041
2042 start_servers(litmus_clock());
2043
2054 TRACE("activating EDF-HSB plugin.\n"); 2044 TRACE("activating EDF-HSB plugin.\n");
2055 return 0; 2045 return 0;
2056} 2046}
@@ -2088,12 +2078,10 @@ static long edf_hsb_deactivate_plugin(void)
2088 2078
2089 local_irq_save(flags); 2079 local_irq_save(flags);
2090 2080
2091 /* stop_be_servers(); */
2092 /* stop_hrt_servers(); */
2093
2094 for_each_online_cpu(cpu) { 2081 for_each_online_cpu(cpu) {
2095 cpu_entry = &per_cpu(cpu_entries, cpu); 2082 cpu_entry = &per_cpu(cpu_entries, cpu);
2096 hrt_server = &cpu_entry->hrt_server; 2083 hrt_server = &cpu_entry->hrt_server;
2084
2097 slack_timer_cancel(hrt_server); 2085 slack_timer_cancel(hrt_server);
2098 2086
2099 if (likely(bheap_node_in_heap(cpu_entry->hn))) 2087 if (likely(bheap_node_in_heap(cpu_entry->hn)))
@@ -2331,11 +2319,6 @@ static void edf_hsb_task_wake_up(struct task_struct *task)
2331 2319
2332 raw_spin_lock_irqsave(global_lock, flags); 2320 raw_spin_lock_irqsave(global_lock, flags);
2333 2321
2334 /* A task set was released. Start servers. */
2335 if (unlikely(!atomic_read(&servers_running)))
2336 start_servers(get_deadline(task) - get_rt_period(task) -
2337 get_rt_phase(task));
2338
2339 if (!is_be(task)) { 2322 if (!is_be(task)) {
2340 if (is_srt(task)) { 2323 if (is_srt(task)) {
2341 catchup_srt_server(task); 2324 catchup_srt_server(task);