Skip to content

Commit d6a2a04

Browse files
KAGA-KOKObwhacks
authored andcommitted
hrtimers: Move lock held region in hrtimer_interrupt()
commit 196951e upstream. 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> 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> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
1 parent a105e02 commit d6a2a04

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎kernel/hrtimer.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,11 +1263,10 @@ void hrtimer_interrupt(struct clock_event_device *dev)
12631263
cpu_base->nr_events++;
12641264
dev->next_event.tv64 = KTIME_MAX;
12651265

1266+
raw_spin_lock(&cpu_base->lock);
12661267
entry_time = now = ktime_get();
12671268
retry:
12681269
expires_next.tv64 = KTIME_MAX;
1269-
1270-
raw_spin_lock(&cpu_base->lock);
12711270
/*
12721271
* We set expires_next to KTIME_MAX here with cpu_base->lock
12731272
* held to prevent that a timer is enqueued in our queue via
@@ -1344,6 +1343,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)
13441343
* interrupt routine. We give it 3 attempts to avoid
13451344
* overreacting on some spurious event.
13461345
*/
1346+
raw_spin_lock(&cpu_base->lock);
13471347
now = ktime_get();
13481348
cpu_base->nr_retries++;
13491349
if (++retries < 3)
@@ -1356,6 +1356,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)
13561356
*/
13571357
cpu_base->nr_hangs++;
13581358
cpu_base->hang_detected = 1;
1359+
raw_spin_unlock(&cpu_base->lock);
13591360
delta = ktime_sub(now, entry_time);
13601361
if (delta.tv64 > cpu_base->max_hang_time.tv64)
13611362
cpu_base->max_hang_time = delta;

0 commit comments

Comments
 (0)