aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2011-10-14 03:11:19 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2011-10-14 03:11:19 -0400
commit42ba03ccc49110d65a44da49a19354ae1a1351ac (patch)
treee5c73797197ecd232c047220fa1a3a718f19d42b
parent1729a3cbaf22538d3a514dea33e4fee1b411e49d (diff)
revert the cpu mask changes
-rw-r--r--include/litmus/sched_mc.h8
-rw-r--r--litmus/Kconfig9
-rw-r--r--litmus/sched_mc.c45
-rw-r--r--litmus/sched_mc_ce.c16
4 files changed, 17 insertions, 61 deletions
diff --git a/include/litmus/sched_mc.h b/include/litmus/sched_mc.h
index 8cdec04c64df..740cc11be5d7 100644
--- a/include/litmus/sched_mc.h
+++ b/include/litmus/sched_mc.h
@@ -31,14 +31,6 @@ struct mc_data {
31 struct mc_job mc_job; 31 struct mc_job mc_job;
32}; 32};
33 33
34/* Leave a CPU free for tracing stuff */
35#if CONFIG_FTRACE_CPU != NO_CPU
36extern struct cpumask rt_mask;
37#define for_each_rt_cpu(cpu) for_each_cpu((cpu), &rt_mask)
38#else
39#define for_each_rt_cpu(cpu) for_each_online_cpu(cpu)
40#endif
41
42#define tsk_mc_data(t) (tsk_rt(t)->mc_data) 34#define tsk_mc_data(t) (tsk_rt(t)->mc_data)
43#define tsk_mc_crit(t) (tsk_mc_data(t)->mc_task.crit) 35#define tsk_mc_crit(t) (tsk_mc_data(t)->mc_task.crit)
44#define is_ghost(t) (tsk_mc_data(t)->mc_job.is_ghost) 36#define is_ghost(t) (tsk_mc_data(t)->mc_job.is_ghost)
diff --git a/litmus/Kconfig b/litmus/Kconfig
index 20610fdf9a54..d629a2843584 100644
--- a/litmus/Kconfig
+++ b/litmus/Kconfig
@@ -83,15 +83,8 @@ config PLUGIN_MC_REDIRECT
83 Allow processors to send work involving global state to the 83 Allow processors to send work involving global state to the
84 release-master cpu in order to avoid excess overheads during 84 release-master cpu in order to avoid excess overheads during
85 partitioned decisions. 85 partitioned decisions.
86
87config FTRACE_CPU
88 int "CPU for Tracing"
89 depends on PLUGIN_MC
90 default -1
91 help
92 Keep one CPU free for the tasks which trace and flush
93 scheduling and overhead data.
94endmenu 86endmenu
87
95endmenu 88endmenu
96 89
97menu "Real-Time Synchronization" 90menu "Real-Time Synchronization"
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index f4037bb1dfe2..53c24ac2172c 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -60,8 +60,6 @@ DEFINE_PER_CPU(struct cpu_entry, cpus);
60static int interrupt_cpu; 60static int interrupt_cpu;
61#endif 61#endif
62 62
63struct cpumask rt_mask;
64
65#define domain_data(dom) (container_of(dom, struct domain_data, domain)) 63#define domain_data(dom) (container_of(dom, struct domain_data, domain))
66#define is_global(dom) (domain_data(dom)->heap) 64#define is_global(dom) (domain_data(dom)->heap)
67#define is_global_task(t) (is_global(get_task_domain(t))) 65#define is_global_task(t) (is_global(get_task_domain(t)))
@@ -352,7 +350,7 @@ static void fix_global_levels(void)
352 struct task_struct *t; 350 struct task_struct *t;
353 351
354 STRACE("Fixing global levels\n"); 352 STRACE("Fixing global levels\n");
355 for_each_rt_cpu(c) { 353 for_each_online_cpu(c) {
356 e = &per_cpu(cpus, c); 354 e = &per_cpu(cpus, c);
357 raw_spin_lock(&e->redir_lock); 355 raw_spin_lock(&e->redir_lock);
358 list_for_each_safe(pos, safe, &e->redir) { 356 list_for_each_safe(pos, safe, &e->redir) {
@@ -379,7 +377,6 @@ static void link_task_to_cpu(struct cpu_entry *entry, struct task_struct *task)
379 TRACE_MC_TASK(task, "Linking to P%d\n", entry->cpu); 377 TRACE_MC_TASK(task, "Linking to P%d\n", entry->cpu);
380 BUG_ON(task && tsk_rt(task)->linked_on != entry->cpu); 378 BUG_ON(task && tsk_rt(task)->linked_on != entry->cpu);
381 BUG_ON(task && is_ghost(task)); 379 BUG_ON(task && is_ghost(task));
382 BUG_ON(CONFIG_FTRACE_CPU == entry->cpu);
383 380
384 if (task){ 381 if (task){
385 set_rt_flags(task, RT_F_RUNNING); 382 set_rt_flags(task, RT_F_RUNNING);
@@ -772,15 +769,11 @@ static void mc_task_new(struct task_struct *t, int on_rq, int running)
772 TRACE("New mixed criticality task %d\n", t->pid); 769 TRACE("New mixed criticality task %d\n", t->pid);
773 770
774 /* Assign domain */ 771 /* Assign domain */
775 if (level < CRIT_LEVEL_C) { 772 if (level < CRIT_LEVEL_C)
776 entry = &per_cpu(cpus, get_partition(t)); 773 entry = &per_cpu(cpus, get_partition(t));
777 t->rt_param._domain = entry->crit_entries[level].domain; 774 else
778 } else {
779 entry = &per_cpu(cpus, task_cpu(t)); 775 entry = &per_cpu(cpus, task_cpu(t));
780 t->rt_param._domain = 776 t->rt_param._domain = entry->crit_entries[level].domain;
781 per_cpu(cpus, 0).crit_entries[CRIT_LEVEL_C].domain;
782 }
783
784 777
785 /* Setup job params */ 778 /* Setup job params */
786 release_at(t, litmus_clock()); 779 release_at(t, litmus_clock());
@@ -788,13 +781,8 @@ static void mc_task_new(struct task_struct *t, int on_rq, int running)
788 tsk_mc_data(t)->mc_job.is_ghost = 0; 781 tsk_mc_data(t)->mc_job.is_ghost = 0;
789 if (running) { 782 if (running) {
790 BUG_ON(entry->scheduled); 783 BUG_ON(entry->scheduled);
791 if (entry->cpu != CONFIG_FTRACE_CPU) { 784 entry->scheduled = t;
792 entry->scheduled = t; 785 tsk_rt(t)->scheduled_on = entry->cpu;
793 tsk_rt(t)->scheduled_on = entry->cpu;
794 } else {
795 tsk_rt(t)->scheduled_on = NO_CPU;
796 preempt_if_preemptable(NULL, entry->cpu);
797 }
798 } else { 786 } else {
799 t->rt_param.scheduled_on = NO_CPU; 787 t->rt_param.scheduled_on = NO_CPU;
800 } 788 }
@@ -904,10 +892,6 @@ static struct task_struct* mc_schedule(struct task_struct* prev)
904 int i, out_of_time, sleep, preempt, exists, blocks, global, lower; 892 int i, out_of_time, sleep, preempt, exists, blocks, global, lower;
905 struct task_struct *dtask = NULL, *ready_task = NULL, *next = NULL; 893 struct task_struct *dtask = NULL, *ready_task = NULL, *next = NULL;
906 894
907 /* Give FTRACE a CPU to run on */
908 if (CONFIG_FTRACE_CPU == entry->cpu)
909 return NULL;
910
911 local_irq_save(flags); 895 local_irq_save(flags);
912 896
913 /* Litmus gave up because it couldn't access the stack of the CPU 897 /* Litmus gave up because it couldn't access the stack of the CPU
@@ -1091,7 +1075,7 @@ static long mc_activate_plugin(void)
1091#endif 1075#endif
1092#endif 1076#endif
1093 1077
1094 for_each_rt_cpu(cpu) { 1078 for_each_online_cpu(cpu) {
1095 BUG_ON(NR_CPUS <= n); 1079 BUG_ON(NR_CPUS <= n);
1096 dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain; 1080 dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain;
1097 dom_data = domain_data(dom); 1081 dom_data = domain_data(dom);
@@ -1166,7 +1150,7 @@ static void init_global_domain(struct domain_data *dom_data, enum crit_level lev
1166 dom_data->heap = heap; 1150 dom_data->heap = heap;
1167 bheap_init(heap); 1151 bheap_init(heap);
1168 1152
1169 for_each_rt_cpu(cpu) { 1153 for_each_online_cpu(cpu) {
1170 entry = &per_cpu(cpus, cpu); 1154 entry = &per_cpu(cpus, cpu);
1171 node = &nodes[cpu]; 1155 node = &nodes[cpu];
1172 ce = &entry->crit_entries[level]; 1156 ce = &entry->crit_entries[level];
@@ -1215,16 +1199,6 @@ static int __init init_mc(void)
1215 raw_spinlock_t *a_dom_lock, *b_dom_lock, *c_dom_lock; /* For lock debugger */ 1199 raw_spinlock_t *a_dom_lock, *b_dom_lock, *c_dom_lock; /* For lock debugger */
1216 struct ce_dom_data *ce_data; 1200 struct ce_dom_data *ce_data;
1217 1201
1218#if CONFIG_FTRACE_CPU != NO_CPU
1219 cpumask_andnot(&rt_mask, cpu_online_mask, cpumask_of(CONFIG_FTRACE_CPU));
1220 printk(KERN_INFO "LITMUS-MC: %lu %lu %lu\n", *cpumask_bits(&rt_mask),
1221 *cpumask_bits(cpu_online_mask),
1222 *cpumask_bits(cpumask_of(CONFIG_FTRACE_CPU)));
1223 for_each_rt_cpu(cpu) {
1224 printk(KERN_INFO "LITMUS-MC: Cpu: %d\n", cpu);
1225 }
1226#endif
1227
1228 for_each_online_cpu(cpu) { 1202 for_each_online_cpu(cpu) {
1229 entry = &per_cpu(cpus, cpu); 1203 entry = &per_cpu(cpus, cpu);
1230 1204
@@ -1232,9 +1206,6 @@ static int __init init_mc(void)
1232 entry->cpu = cpu; 1206 entry->cpu = cpu;
1233 entry->scheduled = NULL; 1207 entry->scheduled = NULL;
1234 entry->linked = NULL; 1208 entry->linked = NULL;
1235
1236 if (cpu == CONFIG_FTRACE_CPU)
1237 continue;
1238 raw_spin_lock_init(&entry->lock); 1209 raw_spin_lock_init(&entry->lock);
1239 1210
1240#ifdef CONFIG_PLUGIN_MC_REDIRECT 1211#ifdef CONFIG_PLUGIN_MC_REDIRECT
diff --git a/litmus/sched_mc_ce.c b/litmus/sched_mc_ce.c
index d9be4d14e76c..af02dfdbb523 100644
--- a/litmus/sched_mc_ce.c
+++ b/litmus/sched_mc_ce.c
@@ -565,7 +565,7 @@ static int cancel_all_timers(void)
565 565
566 TRACE("cancel all timers\n"); 566 TRACE("cancel all timers\n");
567 567
568 for_each_rt_cpu(cpu) { 568 for_each_online_cpu(cpu) {
569 dom = get_domain_for(cpu); 569 dom = get_domain_for(cpu);
570 ce_data = dom->data; 570 ce_data = dom->data;
571 ce_data->should_schedule = NULL; 571 ce_data->should_schedule = NULL;
@@ -596,7 +596,7 @@ static void arm_all_timers(void)
596 596
597 TRACE("arm all timers\n"); 597 TRACE("arm all timers\n");
598 598
599 for_each_rt_cpu(cpu) { 599 for_each_online_cpu(cpu) {
600 dom = get_domain_for(cpu); 600 dom = get_domain_for(cpu);
601 ce_data = dom->data; 601 ce_data = dom->data;
602 pid_table = get_pid_table(cpu); 602 pid_table = get_pid_table(cpu);
@@ -655,7 +655,7 @@ long mc_ce_activate_plugin_common(void)
655 } 655 }
656#endif 656#endif
657 657
658 for_each_rt_cpu(cpu) { 658 for_each_online_cpu(cpu) {
659 dom = get_domain_for(cpu); 659 dom = get_domain_for(cpu);
660 ce_data = dom->data; 660 ce_data = dom->data;
661 ce_data->scheduled = NULL; 661 ce_data->scheduled = NULL;
@@ -677,7 +677,7 @@ static long mc_ce_activate_plugin(void)
677 int cpu, n = 0; 677 int cpu, n = 0;
678 long ret; 678 long ret;
679 679
680 for_each_rt_cpu(cpu) { 680 for_each_online_cpu(cpu) {
681 BUG_ON(NR_CPUS <= n); 681 BUG_ON(NR_CPUS <= n);
682 our_domains[cpu] = &per_cpu(_mc_ce_doms, cpu); 682 our_domains[cpu] = &per_cpu(_mc_ce_doms, cpu);
683 n++; 683 n++;
@@ -695,7 +695,7 @@ static void clear_pid_entries(void)
695 struct ce_pid_table *pid_table = NULL; 695 struct ce_pid_table *pid_table = NULL;
696 int cpu, entry; 696 int cpu, entry;
697 697
698 for_each_rt_cpu(cpu) { 698 for_each_online_cpu(cpu) {
699 pid_table = get_pid_table(cpu); 699 pid_table = get_pid_table(cpu);
700 pid_table->num_pid_entries = 0; 700 pid_table->num_pid_entries = 0;
701 pid_table->cycle_time = 0; 701 pid_table->cycle_time = 0;
@@ -716,7 +716,7 @@ long mc_ce_deactivate_plugin_common(void)
716{ 716{
717 int cpu; 717 int cpu;
718 cancel_all_timers(); 718 cancel_all_timers();
719 for_each_rt_cpu(cpu) { 719 for_each_online_cpu(cpu) {
720 per_cpu(domains, cpu) = NULL; 720 per_cpu(domains, cpu) = NULL;
721 } 721 }
722 return 0; 722 return 0;
@@ -746,7 +746,7 @@ static int __init init_sched_mc_ce(void)
746 struct domain *dom; 746 struct domain *dom;
747 int cpu, err; 747 int cpu, err;
748 748
749 for_each_rt_cpu(cpu) { 749 for_each_online_cpu(cpu) {
750 per_cpu(domains, cpu) = NULL; 750 per_cpu(domains, cpu) = NULL;
751 ce_lock = &per_cpu(_mc_ce_dom_locks, cpu); 751 ce_lock = &per_cpu(_mc_ce_dom_locks, cpu);
752 raw_spin_lock_init(ce_lock); 752 raw_spin_lock_init(ce_lock);
@@ -860,7 +860,7 @@ static int proc_read_ce_file(char *page, char **start, off_t off, int count,
860 goto out; 860 goto out;
861 } 861 }
862 862
863 for_each_rt_cpu(cpu) { 863 for_each_online_cpu(cpu) {
864 pid_table = get_pid_table(cpu); 864 pid_table = get_pid_table(cpu);
865 for (t = 0; t < pid_table->num_pid_entries; ++t) { 865 for (t = 0; t < pid_table->num_pid_entries; ++t) {
866 err = write_pid_entry(page + n, count - n, 866 err = write_pid_entry(page + n, count - n,