diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2011-09-30 20:21:31 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2011-09-30 20:21:31 -0400 |
commit | b0466ecb422692bd0d30764075af834101849bd2 (patch) | |
tree | 319b5b04e6bf5785c6938ac2382388926ccbec82 /litmus/sched_mc_ce.c | |
parent | 17a40d7ea17014b7a615b9f91facc16c6d9072e3 (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_ce.c')
-rw-r--r-- | litmus/sched_mc_ce.c | 41 |
1 files changed, 32 insertions, 9 deletions
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); | |||
79 | DEFINE_PER_CPU(struct ce_dom_data, _mc_ce_dom_data); | 79 | DEFINE_PER_CPU(struct ce_dom_data, _mc_ce_dom_data); |
80 | DEFINE_PER_CPU(raw_spinlock_t, _mc_ce_dom_locks); | 80 | DEFINE_PER_CPU(raw_spinlock_t, _mc_ce_dom_locks); |
81 | 81 | ||
82 | #ifdef CONFIG_PLUGIN_MC_RELEASE_MASTER | ||
83 | static int interrupt_cpu; | ||
84 | #endif | ||
85 | |||
82 | long mc_ce_set_domains(const int n, struct domain_data *domains_in[]) | 86 | long mc_ce_set_domains(const int n, struct domain_data *domains_in[]) |
83 | { | 87 | { |
84 | const int max = (NR_CPUS < n) ? NR_CPUS : n; | 88 | const int max = (NR_CPUS < n) ? NR_CPUS : n; |
@@ -520,8 +524,9 @@ static enum hrtimer_restart mc_ce_timer_callback(struct hrtimer *timer) | |||
520 | #ifdef CONFIG_MERGE_TIMERS | 524 | #ifdef CONFIG_MERGE_TIMERS |
521 | struct event_group *event_group; | 525 | struct event_group *event_group; |
522 | ce_data = container_of(e, struct ce_dom_data, event); | 526 | ce_data = container_of(e, struct ce_dom_data, event); |
523 | event_group = get_event_group_for(ce_data->cpu); | 527 | /* use the same CPU the callbacking is executing on by passing NO_CPU */ |
524 | #else | 528 | event_group = get_event_group_for(NO_CPU); |
529 | #else /* CONFIG_MERGE_TIMERS */ | ||
525 | ce_data = container_of(timer, struct ce_dom_data, timer); | 530 | ce_data = container_of(timer, struct ce_dom_data, timer); |
526 | #endif | 531 | #endif |
527 | dom = get_domain_for(ce_data->cpu); | 532 | dom = get_domain_for(ce_data->cpu); |
@@ -588,7 +593,7 @@ static void arm_all_timers(void) | |||
588 | struct domain *dom; | 593 | struct domain *dom; |
589 | struct ce_dom_data *ce_data; | 594 | struct ce_dom_data *ce_data; |
590 | struct ce_pid_table *pid_table; | 595 | struct ce_pid_table *pid_table; |
591 | int cpu, idx; | 596 | int cpu, idx, cpu_for_timer; |
592 | const lt_t start = atomic64_read(&start_time); | 597 | const lt_t start = atomic64_read(&start_time); |
593 | 598 | ||
594 | TRACE("arm all timers\n"); | 599 | TRACE("arm all timers\n"); |
@@ -602,13 +607,19 @@ static void arm_all_timers(void) | |||
602 | for (idx = 0; idx < pid_table->num_pid_entries; idx++) { | 607 | for (idx = 0; idx < pid_table->num_pid_entries; idx++) { |
603 | pid_table->entries[idx].expected_job = 0; | 608 | pid_table->entries[idx].expected_job = 0; |
604 | } | 609 | } |
610 | #ifdef CONFIG_PLUGIN_MC_RELEASE_MASTER | ||
611 | cpu_for_timer = interrupt_cpu; | ||
612 | #else | ||
613 | cpu_for_timer = cpu; | ||
614 | #endif | ||
615 | |||
605 | #ifdef CONFIG_MERGE_TIMERS | 616 | #ifdef CONFIG_MERGE_TIMERS |
606 | TRACE("adding event for CPU %d\n", cpu); | 617 | add_event(get_event_group_for(cpu_for_timer), |
607 | add_event(get_event_group_for(cpu), &ce_data->event, start); | 618 | &ce_data->event, start); |
608 | #else | 619 | #else |
609 | TRACE("arming timer for CPU %d\n", cpu); | 620 | hrtimer_start_on(cpu_for_timer, &ce_data->timer_info, |
610 | hrtimer_start_on(cpu, &ce_data->timer_info, &ce_data->timer, | 621 | &ce_data->timer, ns_to_ktime(start), |
611 | ns_to_ktime(start), HRTIMER_MODE_ABS_PINNED); | 622 | HRTIMER_MODE_ABS_PINNED); |
612 | #endif | 623 | #endif |
613 | } | 624 | } |
614 | } | 625 | } |
@@ -634,8 +645,18 @@ long mc_ce_activate_plugin_common(void) | |||
634 | { | 645 | { |
635 | struct ce_dom_data *ce_data; | 646 | struct ce_dom_data *ce_data; |
636 | struct domain *dom; | 647 | struct domain *dom; |
648 | long ret; | ||
637 | int cpu; | 649 | int cpu; |
638 | 650 | ||
651 | #ifdef CONFIG_PLUGIN_MC_RELEASE_MASTER | ||
652 | interrupt_cpu = atomic_read(&release_master_cpu); | ||
653 | if (NO_CPU == interrupt_cpu) { | ||
654 | printk(KERN_ERR "LITMUS: MC-CE needs a release master\n"); | ||
655 | ret = -EINVAL; | ||
656 | goto out; | ||
657 | } | ||
658 | #endif | ||
659 | |||
639 | for_each_online_cpu(cpu) { | 660 | for_each_online_cpu(cpu) { |
640 | dom = get_domain_for(cpu); | 661 | dom = get_domain_for(cpu); |
641 | ce_data = dom->data; | 662 | ce_data = dom->data; |
@@ -647,7 +668,9 @@ long mc_ce_activate_plugin_common(void) | |||
647 | atomic64_set(&start_time, litmus_clock()); | 668 | atomic64_set(&start_time, litmus_clock()); |
648 | /* may not want to arm timers on activation, just after release */ | 669 | /* may not want to arm timers on activation, just after release */ |
649 | arm_all_timers(); | 670 | arm_all_timers(); |
650 | return 0; | 671 | ret = 0; |
672 | out: | ||
673 | return ret; | ||
651 | } | 674 | } |
652 | 675 | ||
653 | static long mc_ce_activate_plugin(void) | 676 | static long mc_ce_activate_plugin(void) |