diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-10-13 22:33:16 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-10-13 22:33:16 -0400 |
commit | 3d00edf817b71eb95440c72689e0c5657fd29dd0 (patch) | |
tree | 393178c60bf1ec4de9b9eb1b86f5447a15ae9534 /litmus/sched_mc.c | |
parent | 0836d628227984b343e5ed53e93ebed2252776f7 (diff) |
Freeing a cpu for ftracing
Diffstat (limited to 'litmus/sched_mc.c')
-rw-r--r-- | litmus/sched_mc.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c index 53c24ac2172c..8828919dfcf2 100644 --- a/litmus/sched_mc.c +++ b/litmus/sched_mc.c | |||
@@ -60,6 +60,8 @@ DEFINE_PER_CPU(struct cpu_entry, cpus); | |||
60 | static int interrupt_cpu; | 60 | static int interrupt_cpu; |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | struct cpumask rt_mask; | ||
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))) |
@@ -350,7 +352,7 @@ static void fix_global_levels(void) | |||
350 | struct task_struct *t; | 352 | struct task_struct *t; |
351 | 353 | ||
352 | STRACE("Fixing global levels\n"); | 354 | STRACE("Fixing global levels\n"); |
353 | for_each_online_cpu(c) { | 355 | for_each_rt_cpu(c) { |
354 | e = &per_cpu(cpus, c); | 356 | e = &per_cpu(cpus, c); |
355 | raw_spin_lock(&e->redir_lock); | 357 | raw_spin_lock(&e->redir_lock); |
356 | list_for_each_safe(pos, safe, &e->redir) { | 358 | list_for_each_safe(pos, safe, &e->redir) { |
@@ -377,6 +379,7 @@ static void link_task_to_cpu(struct cpu_entry *entry, struct task_struct *task) | |||
377 | TRACE_MC_TASK(task, "Linking to P%d\n", entry->cpu); | 379 | TRACE_MC_TASK(task, "Linking to P%d\n", entry->cpu); |
378 | BUG_ON(task && tsk_rt(task)->linked_on != entry->cpu); | 380 | BUG_ON(task && tsk_rt(task)->linked_on != entry->cpu); |
379 | BUG_ON(task && is_ghost(task)); | 381 | BUG_ON(task && is_ghost(task)); |
382 | BUG_ON(CONFIG_FTRACE_CPU == entry->cpu); | ||
380 | 383 | ||
381 | if (task){ | 384 | if (task){ |
382 | set_rt_flags(task, RT_F_RUNNING); | 385 | set_rt_flags(task, RT_F_RUNNING); |
@@ -892,6 +895,10 @@ static struct task_struct* mc_schedule(struct task_struct* prev) | |||
892 | int i, out_of_time, sleep, preempt, exists, blocks, global, lower; | 895 | int i, out_of_time, sleep, preempt, exists, blocks, global, lower; |
893 | struct task_struct *dtask = NULL, *ready_task = NULL, *next = NULL; | 896 | struct task_struct *dtask = NULL, *ready_task = NULL, *next = NULL; |
894 | 897 | ||
898 | /* Give FTRACE a CPU to run on */ | ||
899 | if (CONFIG_FTRACE_CPU == entry->cpu) | ||
900 | return NULL; | ||
901 | |||
895 | local_irq_save(flags); | 902 | local_irq_save(flags); |
896 | 903 | ||
897 | /* Litmus gave up because it couldn't access the stack of the CPU | 904 | /* Litmus gave up because it couldn't access the stack of the CPU |
@@ -1075,7 +1082,7 @@ static long mc_activate_plugin(void) | |||
1075 | #endif | 1082 | #endif |
1076 | #endif | 1083 | #endif |
1077 | 1084 | ||
1078 | for_each_online_cpu(cpu) { | 1085 | for_each_rt_cpu(cpu) { |
1079 | BUG_ON(NR_CPUS <= n); | 1086 | BUG_ON(NR_CPUS <= n); |
1080 | dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain; | 1087 | dom = per_cpu(cpus, cpu).crit_entries[CRIT_LEVEL_A].domain; |
1081 | dom_data = domain_data(dom); | 1088 | dom_data = domain_data(dom); |
@@ -1150,7 +1157,7 @@ static void init_global_domain(struct domain_data *dom_data, enum crit_level lev | |||
1150 | dom_data->heap = heap; | 1157 | dom_data->heap = heap; |
1151 | bheap_init(heap); | 1158 | bheap_init(heap); |
1152 | 1159 | ||
1153 | for_each_online_cpu(cpu) { | 1160 | for_each_rt_cpu(cpu) { |
1154 | entry = &per_cpu(cpus, cpu); | 1161 | entry = &per_cpu(cpus, cpu); |
1155 | node = &nodes[cpu]; | 1162 | node = &nodes[cpu]; |
1156 | ce = &entry->crit_entries[level]; | 1163 | ce = &entry->crit_entries[level]; |
@@ -1199,7 +1206,11 @@ static int __init init_mc(void) | |||
1199 | raw_spinlock_t *a_dom_lock, *b_dom_lock, *c_dom_lock; /* For lock debugger */ | 1206 | raw_spinlock_t *a_dom_lock, *b_dom_lock, *c_dom_lock; /* For lock debugger */ |
1200 | struct ce_dom_data *ce_data; | 1207 | struct ce_dom_data *ce_data; |
1201 | 1208 | ||
1202 | for_each_online_cpu(cpu) { | 1209 | #if CONFIG_FTRACE_CPU != NO_CPU |
1210 | cpumask_xor(&rt_mask, cpu_online_mask, cpumask_of(CONFIG_FTRACE_CPU)); | ||
1211 | #endif | ||
1212 | |||
1213 | for_each_rt_cpu(cpu) { | ||
1203 | entry = &per_cpu(cpus, cpu); | 1214 | entry = &per_cpu(cpus, cpu); |
1204 | 1215 | ||
1205 | /* CPU */ | 1216 | /* CPU */ |