Re: [RFC][PATCH -mm 1/2] i386: Detect clock skew during suspend

From: john stultz
Date: Mon Aug 14 2006 - 15:56:23 EST


On Sun, 2006-08-13 at 23:06 +0200, Rafael J. Wysocki wrote:
> Detect the situations in which the time after a resume from disk would
> be earlier than the time before the suspend and prevent them from
> happening on i386.
>
> Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>

One minor comment, but otherwise looks good.

> @@ -302,16 +305,25 @@ static int timer_resume(struct sys_devic
> {
> unsigned long flags;
> unsigned long sec;
> - unsigned long sleep_length;
> + unsigned long ctime = get_cmos_time();
> + long sleep_length = (ctime - sleep_start) * HZ;
> struct timespec ts;
> +
> + if (sleep_length < 0) {
> + printk(KERN_WARNING "Time skew detected in timer resume!\n");

Please make sure the warning describes the CMOS clock going backwards,
rather then just the vague "time skew detected" comment.

> + /* The time after the resume must not be earlier than the time

s/time/CMOS clock/



Acked-by: John Stultz <johnstul@xxxxxxxxxx>

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/