Skip to content

Commit 995f054

Browse files
Ingo MolnarLinus Torvalds
authored andcommitted
[PATCH] high-res timers: resume fix
Soeren Sonnenburg reported that upon resume he is getting this backtrace: [<c0119637>] smp_apic_timer_interrupt+0x57/0x90 [<c0142d30>] retrigger_next_event+0x0/0xb0 [<c0104d30>] apic_timer_interrupt+0x28/0x30 [<c0142d30>] retrigger_next_event+0x0/0xb0 [<c0140068>] __kfifo_put+0x8/0x90 [<c0130fe5>] on_each_cpu+0x35/0x60 [<c0143538>] clock_was_set+0x18/0x20 [<c0135cdc>] timekeeping_resume+0x7c/0xa0 [<c02aabe1>] __sysdev_resume+0x11/0x80 [<c02ab0c7>] sysdev_resume+0x47/0x80 [<c02b0b05>] device_power_up+0x5/0x10 it turns out that on resume we mistakenly re-enable interrupts too early. Do the timer retrigger only on the current CPU. Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Soeren Sonnenburg <kernel@nn7.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bbef618 commit 995f054

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎include/linux/hrtimer.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ struct hrtimer_cpu_base {
206206
struct clock_event_device;
207207

208208
extern void clock_was_set(void);
209+
extern void hres_timers_resume(void);
209210
extern void hrtimer_interrupt(struct clock_event_device *dev);
210211

211212
/*
@@ -236,6 +237,8 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
236237
*/
237238
static inline void clock_was_set(void) { }
238239

240+
static inline void hres_timers_resume(void) { }
241+
239242
/*
240243
* In non high resolution mode the time reference is taken from
241244
* the base softirq time variable.

‎kernel/hrtimer.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,18 @@ void clock_was_set(void)
458458
on_each_cpu(retrigger_next_event, NULL, 0, 1);
459459
}
460460

461+
/*
462+
* During resume we might have to reprogram the high resolution timer
463+
* interrupt (on the local CPU):
464+
*/
465+
void hres_timers_resume(void)
466+
{
467+
WARN_ON_ONCE(num_online_cpus() > 1);
468+
469+
/* Retrigger the CPU local events: */
470+
retrigger_next_event(NULL);
471+
}
472+
461473
/*
462474
* Check, whether the timer is on the callback pending list
463475
*/

‎kernel/timer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static int timekeeping_resume(struct sys_device *dev)
10161016
clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
10171017

10181018
/* Resume hrtimers */
1019-
clock_was_set();
1019+
hres_timers_resume();
10201020

10211021
return 0;
10221022
}

0 commit comments

Comments
 (0)