Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
 "Two fixes in the timer area:
   - a long-standing lock inversion due to a printk
   - suspend-related hrtimer corruption in sched_clock"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks
  sched_clock: Avoid corrupting hrtimer tree during suspend
This commit is contained in:
Linus Torvalds 2014-08-03 09:58:20 -07:00
commit 8d71844b51
2 changed files with 9 additions and 5 deletions

View File

@ -146,7 +146,8 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev)
{ {
/* Nothing to do if we already reached the limit */ /* Nothing to do if we already reached the limit */
if (dev->min_delta_ns >= MIN_DELTA_LIMIT) { if (dev->min_delta_ns >= MIN_DELTA_LIMIT) {
printk(KERN_WARNING "CE: Reprogramming failure. Giving up\n"); printk_deferred(KERN_WARNING
"CE: Reprogramming failure. Giving up\n");
dev->next_event.tv64 = KTIME_MAX; dev->next_event.tv64 = KTIME_MAX;
return -ETIME; return -ETIME;
} }
@ -159,9 +160,10 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev)
if (dev->min_delta_ns > MIN_DELTA_LIMIT) if (dev->min_delta_ns > MIN_DELTA_LIMIT)
dev->min_delta_ns = MIN_DELTA_LIMIT; dev->min_delta_ns = MIN_DELTA_LIMIT;
printk(KERN_WARNING "CE: %s increased min_delta_ns to %llu nsec\n", printk_deferred(KERN_WARNING
dev->name ? dev->name : "?", "CE: %s increased min_delta_ns to %llu nsec\n",
(unsigned long long) dev->min_delta_ns); dev->name ? dev->name : "?",
(unsigned long long) dev->min_delta_ns);
return 0; return 0;
} }

View File

@ -191,7 +191,8 @@ void __init sched_clock_postinit(void)
static int sched_clock_suspend(void) static int sched_clock_suspend(void)
{ {
sched_clock_poll(&sched_clock_timer); update_sched_clock();
hrtimer_cancel(&sched_clock_timer);
cd.suspended = true; cd.suspended = true;
return 0; return 0;
} }
@ -199,6 +200,7 @@ static int sched_clock_suspend(void)
static void sched_clock_resume(void) static void sched_clock_resume(void)
{ {
cd.epoch_cyc = read_sched_clock(); cd.epoch_cyc = read_sched_clock();
hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL);
cd.suspended = false; cd.suspended = false;
} }