Re: [PATCH] sched_clock: Avoid corrupting hrtimer tree during suspend

From: John Stultz
Date: Fri Jul 18 2014 - 18:25:19 EST


On 07/18/2014 03:09 PM, Stephen Boyd wrote:
> During suspend we call sched_clock_poll() to update the epoch and
> accumulated time and reprogram the sched_clock_timer to fire
> before the next wrap-around time. Unfortunately,
> sched_clock_poll() doesn't restart the timer, instead it relies
> on the hrtimer layer to do that and during suspend we aren't
> calling that function from the hrtimer layer. Instead, we're
> reprogramming the expires time while the hrtimer is enqueued,
> which can cause the hrtimer tree to be corrupted. Fix this
> problem by updating the state via update_sched_clock() and
> properly restarting the timer via hrtimer_start().
>
> Fixes: a08ca5d1089d "sched_clock: Use an hrtimer instead of timer"
> Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
> ---
>
> I also wonder if we should be restarting the timer during resume
> instead of suspend given that the resume path modifies the epoch.
> At that point timers can't run because interrupts are disabled and
> we don't really care if the timer fires earlier than it's supposed
> to anyway because it's just there to avoid rollover events, but
> does it seem better to do it that way? I didn't send that version
> because this patch is to fix the code intention, but I'm curious
> if anyone else feels like it should be changed.

Yea, starting the timer on suspend seems unintuitive to me.

Is this something you were hoping to get in for 3.17 or is this a urgent
3.16 item?

thanks
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/