aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_mc.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/sched_mc.c')
-rw-r--r--litmus/sched_mc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index 53c24ac2172c..bcc50d3b6947 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -60,6 +60,8 @@ DEFINE_PER_CPU(struct cpu_entry, cpus);
60static int interrupt_cpu; 60static int interrupt_cpu;
61#endif 61#endif
62 62
63#define FTRACE_CPU 6
64
63#define domain_data(dom) (container_of(dom, struct domain_data, domain)) 65#define domain_data(dom) (container_of(dom, struct domain_data, domain))
64#define is_global(dom) (domain_data(dom)->heap) 66#define is_global(dom) (domain_data(dom)->heap)
65#define is_global_task(t) (is_global(get_task_domain(t))) 67#define is_global_task(t) (is_global(get_task_domain(t)))
@@ -351,6 +353,7 @@ static void fix_global_levels(void)
351 353
352 STRACE("Fixing global levels\n"); 354 STRACE("Fixing global levels\n");
353 for_each_online_cpu(c) { 355 for_each_online_cpu(c) {
356 if (c == FTRACE_CPU) continue;
354 e = &per_cpu(cpus, c); 357 e = &per_cpu(cpus, c);
355 raw_spin_lock(&e->redir_lock); 358 raw_spin_lock(&e->redir_lock);
356 list_for_each_safe(pos, safe, &e->redir) { 359 list_for_each_safe(pos, safe, &e->redir) {
@@ -781,8 +784,13 @@ static void mc_task_new(struct task_struct *t, int on_rq, int running)
781 tsk_mc_data(t)->mc_job.is_ghost = 0; 784 tsk_mc_data(t)->mc_job.is_ghost = 0;
782 if (running) { 785 if (running) {
783 BUG_ON(entry->scheduled); 786 BUG_ON(entry->scheduled);
784 entry->scheduled = t; 787 if (entry->cpu != FTRACE_CPU) {
785 tsk_rt(t)->scheduled_on = entry->cpu; 788 entry->scheduled = t;
789 tsk_rt(t)->scheduled_on = entry->cpu;
790 } else {
791 t->rt_param.scheduled_on = NO_CPU;
792 preempt_if_preemptable(NULL, entry->cpu);
793 }
786 } else { 794 } else {
787 t->rt_param.scheduled_on = NO_CPU; 795 t->rt_param.scheduled_on = NO_CPU;
788 } 796 }
@@ -892,6 +900,9 @@ static struct task_struct* mc_schedule(struct task_struct* prev)
892 int i, out_of_time, sleep, preempt, exists, blocks, global, lower; 900 int i, out_of_time, sleep, preempt, exists, blocks, global, lower;
893 struct task_struct *dtask = NULL, *ready_task = NULL, *next = NULL; 901 struct task_struct *dtask = NULL, *ready_task = NULL, *next = NULL;
894 902
903 if (entry->cpu == FTRACE_CPU)
904 return NULL;
905
895 local_irq_save(flags); 906 local_irq_save(flags);
896 907
897 /* Litmus gave up because it couldn't access the stack of the CPU 908 /* Litmus gave up because it couldn't access the stack of the CPU
@@ -1077,6 +1088,7 @@ static long mc_activate_plugin(void)
1077 1088
1078 for_each_online_cpu(cpu) { 1089 for_each_online_cpu(cpu) {
1079 BUG_ON(NR_CPUS <= n); 1090 BUG_ON(NR_CPUS <= n);
1091 if (cpu == FTRACE_CPU) continue;
1080 dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain; 1092 dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain;
1081 dom_data = domain_data(dom); 1093 dom_data = domain_data(dom);
1082 our_domains[cpu] = dom_data; 1094 our_domains[cpu] = dom_data;
@@ -1151,6 +1163,7 @@ static void init_global_domain(struct domain_data *dom_data, enum crit_level lev
1151 bheap_init(heap); 1163 bheap_init(heap);
1152 1164
1153 for_each_online_cpu(cpu) { 1165 for_each_online_cpu(cpu) {
1166 if (cpu == FTRACE_CPU) continue;
1154 entry = &per_cpu(cpus, cpu); 1167 entry = &per_cpu(cpus, cpu);
1155 node = &nodes[cpu]; 1168 node = &nodes[cpu];
1156 ce = &entry->crit_entries[level]; 1169 ce = &entry->crit_entries[level];
@@ -1206,6 +1219,8 @@ static int __init init_mc(void)
1206 entry->cpu = cpu; 1219 entry->cpu = cpu;
1207 entry->scheduled = NULL; 1220 entry->scheduled = NULL;
1208 entry->linked = NULL; 1221 entry->linked = NULL;
1222 if (cpu == FTRACE_CPU) continue;
1223
1209 raw_spin_lock_init(&entry->lock); 1224 raw_spin_lock_init(&entry->lock);
1210 1225
1211#ifdef CONFIG_PLUGIN_MC_REDIRECT 1226#ifdef CONFIG_PLUGIN_MC_REDIRECT