Re: [PATCH 1/2] time: Fix a bug in timekeeping_suspend() with no persistent clock
From: John Stultz
Date: Tue Mar 24 2015 - 17:23:27 EST
On Wed, Mar 18, 2015 at 7:42 PM, Xunlei Pang <xlpang@xxxxxxx> wrote:
> From: Xunlei Pang <pang.xunlei@xxxxxxxxxx>
>
> When there's no persistent clock, normally timekeeping_suspend_time
> should always be zero, but this can break in timekeeping_suspend().
>
> At T1, there was a system suspend, so old_delta was assigned T1.
> After some time, one time adjustment happened, and xtime got the
> value of T1-dt(0s<dt<2s). Then, there comes another system suspend
> soon after this adjustment, obviously we will get a small negative
> delta_delta, resulting in a negative timekeeping_suspend_time.
>
> This is problematic, when doing timekeeping_resume() if there is
> no nonstop clocksource for example, it will hit the else leg and
> inject the improper sleeptime which is the wrong logic.
>
> So, we can solve this problem by only doing delta related code when
> the persistent clock is existent. Actually the code only makes sense
> for persistent clock cases.
>
> Signed-off-by: Xunlei Pang <pang.xunlei@xxxxxxxxxx>
Thanks for resending this with the changes, Xunlei. I've queued these
two patches for 4.1
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/