diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-07-10 18:43:23 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-07-11 17:34:38 -0400 |
commit | 196951e91262fccda81147d2bcf7fdab08668b40 (patch) | |
tree | 80b7ae7f48d8591a6d470583b35757a000326f45 /kernel/hrtimer.c | |
parent | 5b9fe759a678e05be4937ddf03d50e950207c1c0 (diff) |
hrtimers: Move lock held region in hrtimer_interrupt()
We need to update the base offsets from this code and we need to do
that under base->lock. Move the lock held region around the
ktime_get() calls. The ktime_get() calls are going to be replaced with
a function which gets the time and the offsets atomically.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Prarit Bhargava <prarit@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Link: http://lkml.kernel.org/r/1341960205-56738-6-git-send-email-johnstul@us.ibm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 3c24fb2c25c8..8f320af837b5 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -1263,11 +1263,10 @@ void hrtimer_interrupt(struct clock_event_device *dev) | |||
1263 | cpu_base->nr_events++; | 1263 | cpu_base->nr_events++; |
1264 | dev->next_event.tv64 = KTIME_MAX; | 1264 | dev->next_event.tv64 = KTIME_MAX; |
1265 | 1265 | ||
1266 | raw_spin_lock(&cpu_base->lock); | ||
1266 | entry_time = now = ktime_get(); | 1267 | entry_time = now = ktime_get(); |
1267 | retry: | 1268 | retry: |
1268 | expires_next.tv64 = KTIME_MAX; | 1269 | expires_next.tv64 = KTIME_MAX; |
1269 | |||
1270 | raw_spin_lock(&cpu_base->lock); | ||
1271 | /* | 1270 | /* |
1272 | * We set expires_next to KTIME_MAX here with cpu_base->lock | 1271 | * We set expires_next to KTIME_MAX here with cpu_base->lock |
1273 | * held to prevent that a timer is enqueued in our queue via | 1272 | * held to prevent that a timer is enqueued in our queue via |
@@ -1344,6 +1343,7 @@ retry: | |||
1344 | * interrupt routine. We give it 3 attempts to avoid | 1343 | * interrupt routine. We give it 3 attempts to avoid |
1345 | * overreacting on some spurious event. | 1344 | * overreacting on some spurious event. |
1346 | */ | 1345 | */ |
1346 | raw_spin_lock(&cpu_base->lock); | ||
1347 | now = ktime_get(); | 1347 | now = ktime_get(); |
1348 | cpu_base->nr_retries++; | 1348 | cpu_base->nr_retries++; |
1349 | if (++retries < 3) | 1349 | if (++retries < 3) |
@@ -1356,6 +1356,7 @@ retry: | |||
1356 | */ | 1356 | */ |
1357 | cpu_base->nr_hangs++; | 1357 | cpu_base->nr_hangs++; |
1358 | cpu_base->hang_detected = 1; | 1358 | cpu_base->hang_detected = 1; |
1359 | raw_spin_unlock(&cpu_base->lock); | ||
1359 | delta = ktime_sub(now, entry_time); | 1360 | delta = ktime_sub(now, entry_time); |
1360 | if (delta.tv64 > cpu_base->max_hang_time.tv64) | 1361 | if (delta.tv64 > cpu_base->max_hang_time.tv64) |
1361 | cpu_base->max_hang_time = delta; | 1362 | cpu_base->max_hang_time = delta; |