Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 406bea59 authored by Xunlei Pang's avatar Xunlei Pang Committed by Gerrit - the friendly Code Review server
Browse files

time: Fix a bug in timekeeping_suspend() with no persistent clock



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.

Change-Id: Iff552ae831615940e0ab8871e927af75e5f77dcf
Signed-off-by: default avatarXunlei Pang <pang.xunlei@linaro.org>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1427945681-29972-18-git-send-email-john.stultz@linaro.org


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Git-commit: 264bb3f79f2a465477cdcd2f0554e21aedc443a3
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
parent e0b299f3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment