diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2011-09-30 01:23:20 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2011-09-30 01:23:20 -0400 |
commit | cd5685b6483df2f1ba8affc0ff8a0679f4044db8 (patch) | |
tree | b2c15c6f04fdfd96a738900d8e822057847ea641 /litmus/rt_domain.c | |
parent | 23a00b911b968c6290251913ecc34171836b4d32 (diff) |
Refactor timer merging and add it to CE plugin.
THIS CODE IS UNTESTED
We now initialize one event group for each cpu on system start. We can
get the event group for a CPU via a function in event_group.c
Another change is that an event now stores what group it is in when it
add_event() is called on it. This lets us cancel it without knowing what
event group it is in.
The above is important because Level-C events (like releases) have a
NULL event group. When calling add_event(), it will get the event group
of the current CPU. If the event needs to be canceled later, we need
that saved group in the event so we know where to remove it from.
Diffstat (limited to 'litmus/rt_domain.c')
-rw-r--r-- | litmus/rt_domain.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c index db92e849f08..fbd91c82961 100644 --- a/litmus/rt_domain.c +++ b/litmus/rt_domain.c | |||
@@ -166,7 +166,7 @@ static void reinit_release_heap(rt_domain_t *rt, struct task_struct* t) | |||
166 | 166 | ||
167 | #ifdef CONFIG_MERGE_TIMERS | 167 | #ifdef CONFIG_MERGE_TIMERS |
168 | rh->event.prio = rt->prio; | 168 | rh->event.prio = rt->prio; |
169 | cancel_event(rt->event_group, &rh->event); | 169 | cancel_event(&rh->event); |
170 | #else | 170 | #else |
171 | /* Make sure it is safe to use. The timer callback could still | 171 | /* Make sure it is safe to use. The timer callback could still |
172 | * be executing on another CPU; hrtimer_cancel() will wait | 172 | * be executing on another CPU; hrtimer_cancel() will wait |
@@ -188,7 +188,11 @@ static void reinit_release_heap(rt_domain_t *rt, struct task_struct* t) | |||
188 | 188 | ||
189 | } | 189 | } |
190 | 190 | ||
191 | #ifdef CONFIG_RELEASE_MASTER | ||
192 | static void arm_release_timer_on(struct release_heap *rh, int target_cpu) | ||
193 | #else | ||
191 | static void arm_release_timer(struct release_heap *rh) | 194 | static void arm_release_timer(struct release_heap *rh) |
195 | #endif | ||
192 | { | 196 | { |
193 | #ifdef CONFIG_MERGE_TIMERS | 197 | #ifdef CONFIG_MERGE_TIMERS |
194 | add_event(rh->dom->event_group, &rh->event, rh->release_time); | 198 | add_event(rh->dom->event_group, &rh->event, rh->release_time); |
@@ -200,8 +204,7 @@ static void arm_release_timer(struct release_heap *rh) | |||
200 | */ | 204 | */ |
201 | 205 | ||
202 | #ifdef CONFIG_RELEASE_MASTER | 206 | #ifdef CONFIG_RELEASE_MASTER |
203 | if (rt->release_master == NO_CPU && | 207 | if (rh->dom->release_master == NO_CPU && target_cpu == NO_CPU) |
204 | target_cpu == NO_CPU) | ||
205 | #endif | 208 | #endif |
206 | __hrtimer_start_range_ns(&rh->timer, | 209 | __hrtimer_start_range_ns(&rh->timer, |
207 | ns_to_ktime(rh->release_time), | 210 | ns_to_ktime(rh->release_time), |
@@ -210,7 +213,7 @@ static void arm_release_timer(struct release_heap *rh) | |||
210 | else | 213 | else |
211 | hrtimer_start_on(/* target_cpu overrides release master */ | 214 | hrtimer_start_on(/* target_cpu overrides release master */ |
212 | (target_cpu != NO_CPU ? | 215 | (target_cpu != NO_CPU ? |
213 | target_cpu : rt->release_master), | 216 | target_cpu : rh->dom->release_master), |
214 | &rh->info, &rh->timer, | 217 | &rh->info, &rh->timer, |
215 | ns_to_ktime(rh->release_time), | 218 | ns_to_ktime(rh->release_time), |
216 | HRTIMER_MODE_ABS_PINNED); | 219 | HRTIMER_MODE_ABS_PINNED); |
@@ -278,9 +281,13 @@ static void setup_release(rt_domain_t *_rt) | |||
278 | * owner do the arming (which is the "first" task to reference | 281 | * owner do the arming (which is the "first" task to reference |
279 | * this release_heap anyway). | 282 | * this release_heap anyway). |
280 | */ | 283 | */ |
281 | if (rh == tsk_rt(t)->rel_heap) | 284 | if (rh == tsk_rt(t)->rel_heap) { |
285 | #ifdef CONFIG_RELEASE_MASTER | ||
286 | arm_release_timer_on(rh, target_cpu); | ||
287 | #else | ||
282 | arm_release_timer(rh); | 288 | arm_release_timer(rh); |
283 | else | 289 | #endif |
290 | } else | ||
284 | VTRACE_TASK(t, "0x%p is not my timer\n", &rh->timer); | 291 | VTRACE_TASK(t, "0x%p is not my timer\n", &rh->timer); |
285 | } | 292 | } |
286 | } | 293 | } |