From b0466ecb422692bd0d30764075af834101849bd2 Mon Sep 17 00:00:00 2001 From: Christopher Kenna Date: Fri, 30 Sep 2011 20:21:31 -0400 Subject: 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. --- litmus/sched_mc_ce.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'litmus/sched_mc_ce.c') diff --git a/litmus/sched_mc_ce.c b/litmus/sched_mc_ce.c index c5066918f282..5125df9572ba 100644 --- a/litmus/sched_mc_ce.c +++ b/litmus/sched_mc_ce.c @@ -79,6 +79,10 @@ DEFINE_PER_CPU(struct domain_data, _mc_ce_doms); DEFINE_PER_CPU(struct ce_dom_data, _mc_ce_dom_data); DEFINE_PER_CPU(raw_spinlock_t, _mc_ce_dom_locks); +#ifdef CONFIG_PLUGIN_MC_RELEASE_MASTER +static int interrupt_cpu; +#endif + long mc_ce_set_domains(const int n, struct domain_data *domains_in[]) { const int max = (NR_CPUS < n) ? NR_CPUS : n; @@ -520,8 +524,9 @@ static enum hrtimer_restart mc_ce_timer_callback(struct hrtimer *timer) #ifdef CONFIG_MERGE_TIMERS struct event_group *event_group; ce_data = container_of(e, struct ce_dom_data, event); - event_group = get_event_group_for(ce_data->cpu); -#else + /* use the same CPU the callbacking is executing on by passing NO_CPU */ + event_group = get_event_group_for(NO_CPU); +#else /* CONFIG_MERGE_TIMERS */ ce_data = container_of(timer, struct ce_dom_data, timer); #endif dom = get_domain_for(ce_data->cpu); @@ -588,7 +593,7 @@ static void arm_all_timers(void) struct domain *dom; struct ce_dom_data *ce_data; struct ce_pid_table *pid_table; - int cpu, idx; + int cpu, idx, cpu_for_timer; const lt_t start = atomic64_read(&start_time); TRACE("arm all timers\n"); @@ -602,13 +607,19 @@ static void arm_all_timers(void) for (idx = 0; idx < pid_table->num_pid_entries; idx++) { pid_table->entries[idx].expected_job = 0; } +#ifdef CONFIG_PLUGIN_MC_RELEASE_MASTER + cpu_for_timer = interrupt_cpu; +#else + cpu_for_timer = cpu; +#endif + #ifdef CONFIG_MERGE_TIMERS - TRACE("adding event for CPU %d\n", cpu); - add_event(get_event_group_for(cpu), &ce_data->event, start); + add_event(get_event_group_for(cpu_for_timer), + &ce_data->event, start); #else - TRACE("arming timer for CPU %d\n", cpu); - hrtimer_start_on(cpu, &ce_data->timer_info, &ce_data->timer, - ns_to_ktime(start), HRTIMER_MODE_ABS_PINNED); + hrtimer_start_on(cpu_for_timer, &ce_data->timer_info, + &ce_data->timer, ns_to_ktime(start), + HRTIMER_MODE_ABS_PINNED); #endif } } @@ -634,8 +645,18 @@ long mc_ce_activate_plugin_common(void) { struct ce_dom_data *ce_data; struct domain *dom; + long ret; int cpu; +#ifdef CONFIG_PLUGIN_MC_RELEASE_MASTER + interrupt_cpu = atomic_read(&release_master_cpu); + if (NO_CPU == interrupt_cpu) { + printk(KERN_ERR "LITMUS: MC-CE needs a release master\n"); + ret = -EINVAL; + goto out; + } +#endif + for_each_online_cpu(cpu) { dom = get_domain_for(cpu); ce_data = dom->data; @@ -647,7 +668,9 @@ long mc_ce_activate_plugin_common(void) atomic64_set(&start_time, litmus_clock()); /* may not want to arm timers on activation, just after release */ arm_all_timers(); - return 0; + ret = 0; +out: + return ret; } static long mc_ce_activate_plugin(void) -- cgit v1.2.2