The patch titled i386: Detect clock skew during suspend has been added to the -mm tree. Its filename is i386-detect-clock-skew-during-suspend.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: i386: Detect clock skew during suspend From: "Rafael J. Wysocki" <rjw@xxxxxxx> 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> Acked-by: John Stultz <johnstul@xxxxxxxxxx> Acked-by: Pavel Machek <pavel@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/time.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff -puN arch/i386/kernel/time.c~i386-detect-clock-skew-during-suspend arch/i386/kernel/time.c --- a/arch/i386/kernel/time.c~i386-detect-clock-skew-during-suspend +++ a/arch/i386/kernel/time.c @@ -285,16 +285,19 @@ void notify_arch_cmos_timer(void) mod_timer(&sync_cmos_timer, jiffies + 1); } -static long clock_cmos_diff, sleep_start; +static long clock_cmos_diff; +static unsigned long sleep_start; static int timer_suspend(struct sys_device *dev, pm_message_t state) { /* * Estimate time zone so that set_time can update the clock */ - clock_cmos_diff = -get_cmos_time(); + unsigned long ctime = get_cmos_time(); + + clock_cmos_diff = -ctime; clock_cmos_diff += get_seconds(); - sleep_start = get_cmos_time(); + sleep_start = ctime; return 0; } @@ -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 "CMOS clock skew detected in timer resume!\n"); + /* The time after the resume must not be earlier than the time + * before the suspend or some nasty things will happen + */ + sleep_length = 0; + ctime = sleep_start; + } #ifdef CONFIG_HPET_TIMER if (is_hpet_enabled()) hpet_reenable(); #endif setup_pit_timer(); - sec = get_cmos_time() + clock_cmos_diff; - sleep_length = (get_cmos_time() - sleep_start) * HZ; + sec = ctime + clock_cmos_diff; ts.tv_sec = sec; ts.tv_nsec = 0; do_settimeofday(&ts); _ Patches currently in -mm which might be from rjw@xxxxxxx are git-cifs.patch pm-define-pm_event_prethaw.patch pm-pci-and-ide-handle-pm_event_prethaw.patch pm-video-drivers-and-pm_event_prethaw.patch pm-usb-hcds-use-pm_event_prethaw.patch pm-usb-hcds-use-pm_event_prethaw-fix.patch pm-issue-pm_event_prethaw.patch swsusp-write-timer.patch swsusp-write-speedup.patch swsusp-read-timer.patch swsusp-read-speedup.patch swsusp-read-speedup-fix.patch swsusp-read-speedup-cleanup.patch swsusp-read-speedup-cleanup-2.patch swsusp-clean-up-browsing-of-pfns.patch swsusp-struct-snapshot_handle-cleanup.patch make-swsusp-avoid-memory-holes-and-reserved-memory-regions-on-x86_64.patch disable-cpu-hotplug-during-suspend-2.patch swsusp-fix-mark_free_pages.patch swsusp-reorder-memory-allocating-functions.patch swsusp-fix-alloc_pagedir.patch clean-up-suspend-header.patch change-the-name-of-pagedir_nosave.patch swsusp-introduce-some-helpful-constants.patch swsusp-introduce-memory-bitmaps.patch swsusp-use-memory-bitmaps-during-resume.patch swsusp-use-memory-bitmaps-during-resume-fix.patch i386-detect-clock-skew-during-suspend.patch reiserfs-make-sure-all-dentries-refs-are-released-before-calling-kill_block_super-try-2.patch ide-reprogram-disk-pio-timings-on-resume.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html