lkml.org 
[lkml]   [2011]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] rtc: Avoid accumulating time drift in suspend/resume
From
Date
On Wed, 2011-06-01 at 17:54 -0700, Arve Hjønnevåg wrote:
> On Tue, May 31, 2011 at 11:07 PM, John Stultz <john.stultz@linaro.org> wrote:
> > + /*
> > + * Since these RTC suspend/resume handlers are not called
> > + * at the very end of suspend or the start of resume,
> > + * some run-time may pass on either sides of the sleep time
> > + * so subtract kernel run-time between rtc_suspend to rtc_resume
> > + * to keep things accurate.
> > + */
> > + sleep_time = timespec_sub(sleep_time,
> > + timespec_sub(new_system, old_system));
>
> What happens if sleep_time is negative? I think this need to be
> clamped to 0 to avoid backwards jumps when you wake up more than once
> without the rtc advancing.

Good thought! Although that will be easier to catch in
timekeeping_inject_sleeptime(), so I might add it there.

Thanks for the review!
-john



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

\
 
 \ /
  Last update: 2011-06-02 03:17    [W:0.051 / U:27.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site