diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-04-17 19:18:30 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-04-17 19:18:30 -0400 |
commit | 685f214b45fc0c53a6f722d3c8413f3a05d9db2c (patch) | |
tree | b68fc8d10c21572fb9a8b6b6459fd1aaaa8310a0 /litmus/servers.c | |
parent | 5846906431466b20b22d9063bf636f2cbb44dba0 (diff) |
Prevent tasks from linking to one CPU when they are scheduled on another
Diffstat (limited to 'litmus/servers.c')
-rw-r--r-- | litmus/servers.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/litmus/servers.c b/litmus/servers.c index 7c47e5fdc125..6e622f3bd5a3 100644 --- a/litmus/servers.c +++ b/litmus/servers.c | |||
@@ -81,17 +81,18 @@ static int completion_timer_arm(server_domain_t* domain, int cpu) | |||
81 | lt_t now = domain->start_times[cpu]; | 81 | lt_t now = domain->start_times[cpu]; |
82 | server_t *server = domain->linked_servers[cpu]; | 82 | server_t *server = domain->linked_servers[cpu]; |
83 | lt_t budget_exhausted = now + server->budget; | 83 | lt_t budget_exhausted = now + server->budget; |
84 | completion_timer_t *timer = &domain->completion_timers[cpu]; | ||
84 | 85 | ||
85 | /* This happens when someone attempts to call server_run when | 86 | /* This happens when someone attempts to call server_run when |
86 | * the server completes. When this happens, we can ignore the request | 87 | * the server completes. When this happens, we can ignore the request |
87 | * here because completion_timer_fire will re-arm the timer if | 88 | * here because completion_timer_fire will re-arm the timer if |
88 | * the server is still running / was run again. | 89 | * the server is still running / was run again. |
89 | */ | 90 | */ |
90 | if (hrtimer_active(&domain->completion_timers[cpu].timer)) { | 91 | if (hrtimer_active(&timer->timer)) { |
91 | TRACE_SUB(server, "cannot arm completion, already active"); | 92 | TRACE_SUB(server, "cannot arm completion, already active"); |
92 | return 0; | 93 | return 0; |
93 | } | 94 | } |
94 | if (domain->completion_timers[cpu].armed) { | 95 | if (timer->armed) { |
95 | TRACE_SUB(server, "cannot arm completion, waiting for arm"); | 96 | TRACE_SUB(server, "cannot arm completion, waiting for arm"); |
96 | return 0; | 97 | return 0; |
97 | } | 98 | } |
@@ -108,10 +109,9 @@ static int completion_timer_arm(server_domain_t* domain, int cpu) | |||
108 | #endif | 109 | #endif |
109 | on_cpu = cpu; | 110 | on_cpu = cpu; |
110 | 111 | ||
112 | err = 1; | ||
111 | if (cpu != smp_processor_id()) { | 113 | if (cpu != smp_processor_id()) { |
112 | err = hrtimer_start_on(on_cpu, | 114 | err = hrtimer_start_on(on_cpu, &timer->info, &timer->timer, |
113 | &domain->completion_timers[cpu].info, | ||
114 | &domain->completion_timers[cpu].timer, | ||
115 | ns_to_ktime(budget_exhausted), | 115 | ns_to_ktime(budget_exhausted), |
116 | HRTIMER_MODE_ABS_PINNED); | 116 | HRTIMER_MODE_ABS_PINNED); |
117 | if (err) { | 117 | if (err) { |
@@ -119,23 +119,20 @@ static int completion_timer_arm(server_domain_t* domain, int cpu) | |||
119 | } else { | 119 | } else { |
120 | TRACE_SUB(server, "success on P%d!", on_cpu); | 120 | TRACE_SUB(server, "success on P%d!", on_cpu); |
121 | } | 121 | } |
122 | } else { | 122 | } else if (atomic_read(&timer->info.state)!= HRTIMER_START_ON_INACTIVE){ |
123 | err = __hrtimer_start_range_ns(&domain->completion_timers[cpu].timer, | 123 | err = __hrtimer_start_range_ns(&timer->timer, |
124 | ns_to_ktime(budget_exhausted), | 124 | ns_to_ktime(budget_exhausted), |
125 | 0 /* delta */, | 125 | 0 /* delta */, |
126 | HRTIMER_MODE_ABS_PINNED, | 126 | HRTIMER_MODE_ABS_PINNED, |
127 | 0 /* no wakeup */); | 127 | 0 /* no wakeup */); |
128 | } | 128 | } |
129 | 129 | ||
130 | if (!err) | 130 | timer->armed = (err) ? 0 : 1; |
131 | domain->completion_timers[cpu].armed = 1; | ||
132 | else | ||
133 | domain->completion_timers[cpu].armed = 0; | ||
134 | 131 | ||
135 | TRACE_SUB(server, "completion 0x%x and %p armed to fire at %llu", | 132 | TRACE_SUB(server, "completion 0x%x and %p armed to fire at %llu, err: %d", |
136 | &domain->completion_timers[cpu].timer, | 133 | &timer->timer, |
137 | &domain->completion_timers[cpu].timer, | 134 | &timer->timer, |
138 | TIME(budget_exhausted)); | 135 | TIME(budget_exhausted), err); |
139 | 136 | ||
140 | return !err; | 137 | return !err; |
141 | } | 138 | } |