aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_mc.c
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2011-09-30 20:21:31 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2011-09-30 20:21:31 -0400
commitb0466ecb422692bd0d30764075af834101849bd2 (patch)
tree319b5b04e6bf5785c6938ac2382388926ccbec82 /litmus/sched_mc.c
parent17a40d7ea17014b7a615b9f91facc16c6d9072e3 (diff)
Debug commit.
Some things are working, but the kernel panics when you try and deallocate an event group. Committed so Jonathan can look at it.
Diffstat (limited to 'litmus/sched_mc.c')
-rw-r--r--litmus/sched_mc.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index 17f84c9eba79..e20e97810847 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -27,8 +27,6 @@
27#include <litmus/sched_mc.h> 27#include <litmus/sched_mc.h>
28#include <litmus/ce_domain.h> 28#include <litmus/ce_domain.h>
29 29
30/* XXX TODO Do we ever want to move level-A timers? */
31
32/** 30/**
33 * struct cpu_entry - State of a CPU for the entire MC system 31 * struct cpu_entry - State of a CPU for the entire MC system
34 * @cpu CPU id 32 * @cpu CPU id
@@ -50,6 +48,9 @@ struct cpu_entry {
50 struct list_head redir; 48 struct list_head redir;
51 raw_spinlock_t redir_lock; 49 raw_spinlock_t redir_lock;
52#endif 50#endif
51#ifdef CONFIG_MERGE_TIMERS
52 struct event_group *event_group;
53#endif
53}; 54};
54 55
55DEFINE_PER_CPU(struct cpu_entry, cpus); 56DEFINE_PER_CPU(struct cpu_entry, cpus);
@@ -141,7 +142,7 @@ static inline void cancel_ghost(struct crit_entry *ce)
141static inline void arm_ghost(struct crit_entry *ce, lt_t fire) 142static inline void arm_ghost(struct crit_entry *ce, lt_t fire)
142{ 143{
143#ifdef CONFIG_MERGE_TIMERS 144#ifdef CONFIG_MERGE_TIMERS
144 add_event(get_event_group_for(crit_cpu(ce)->cpu), &ce->event, fire); 145 add_event(crit_cpu(ce)->event_group, &ce->event, fire);
145#else 146#else
146 __hrtimer_start_range_ns(&ce->timer, 147 __hrtimer_start_range_ns(&ce->timer,
147 ns_to_ktime(fire), 148 ns_to_ktime(fire),
@@ -298,7 +299,7 @@ static void fix_global_levels(void)
298 struct list_head *pos, *safe; 299 struct list_head *pos, *safe;
299 struct task_struct *t; 300 struct task_struct *t;
300 301
301 STRACE("Fixing global levels"); 302 STRACE("Fixing global levels\n");
302 for_each_online_cpu(c) { 303 for_each_online_cpu(c) {
303 e = &per_cpu(cpus, c); 304 e = &per_cpu(cpus, c);
304 raw_spin_lock(&e->redir_lock); 305 raw_spin_lock(&e->redir_lock);
@@ -621,13 +622,12 @@ static void ce_timer_function(struct rt_event *e)
621{ 622{
622 struct ce_dom_data *ce_data = 623 struct ce_dom_data *ce_data =
623 container_of(e, struct ce_dom_data, event); 624 container_of(e, struct ce_dom_data, event);
624 struct event_group *event_group = get_event_group_for(ce_data->cpu);
625 unsigned long flags; 625 unsigned long flags;
626 lt_t next_timer_abs; 626 lt_t next_timer_abs;
627 627
628 local_irq_save(flags); 628 local_irq_save(flags);
629 next_timer_abs = __ce_timer_function(ce_data); 629 next_timer_abs = __ce_timer_function(ce_data);
630 add_event(event_group, e, next_timer_abs); 630 add_event(per_cpu(cpus, ce_data->cpu).event_group, e, next_timer_abs);
631 local_irq_restore(flags); 631 local_irq_restore(flags);
632} 632}
633#else /* else to CONFIG_MERGE_TIMERS */ 633#else /* else to CONFIG_MERGE_TIMERS */
@@ -945,13 +945,13 @@ static long mc_activate_plugin(void)
945 struct domain_data *dom_data; 945 struct domain_data *dom_data;
946 struct domain *dom; 946 struct domain *dom;
947 struct domain_data *our_domains[NR_CPUS]; 947 struct domain_data *our_domains[NR_CPUS];
948 struct event_group *event_group;
948 int cpu, n = 0; 949 int cpu, n = 0;
949 long ret; 950 long ret;
950 951
951#ifdef CONFIG_RELEASE_MASTER 952#ifdef CONFIG_RELEASE_MASTER
952 interrupt_cpu = atomic_read(&release_master_cpu); 953 interrupt_cpu = atomic_read(&release_master_cpu);
953#if defined(CONFIG_PLUGIN_MC_REDIRECT) || \ 954#if defined(CONFIG_PLUGIN_MC_REDIRECT) || defined(CONFIG_PLUGIN_MC_RELEASE_MASTER)
954 (defined(CONFIG_PLUGIN_MC_RELEASE_MASTER) && defined(CONFIG_MERGE_TIMERS))
955 if (NO_CPU == interrupt_cpu) { 955 if (NO_CPU == interrupt_cpu) {
956 printk(KERN_ERR "LITMUS-MC: need a release master\n"); 956 printk(KERN_ERR "LITMUS-MC: need a release master\n");
957 ret = -EINVAL; 957 ret = -EINVAL;
@@ -965,6 +965,12 @@ static long mc_activate_plugin(void)
965 dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain; 965 dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain;
966 dom_data = domain_data(dom); 966 dom_data = domain_data(dom);
967 our_domains[cpu] = dom_data; 967 our_domains[cpu] = dom_data;
968#if defined(CONFIG_MERGE_TIMERS) && defined(CONFIG_PLUGIN_MC_RELEASE_MASTER)
969 event_group = get_event_group_for(interrupt_cpu);
970#elif defined(CONFIG_MERGE_TIMERS) && !defined(CONFIG_PLUGIN_MC_RELEASE_MASTER)
971 event_group = get_event_group_for(cpu);
972#endif
973 per_cpu(cpus, cpu).event_group = event_group;
968 n++; 974 n++;
969 } 975 }
970 ret = mc_ce_set_domains(n, our_domains); 976 ret = mc_ce_set_domains(n, our_domains);