]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] x86_64: [PATCH] timer resume
authorShaohua Li <shaohua.li@intel.com>
Fri, 3 Feb 2006 20:50:56 +0000 (21:50 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 5 Feb 2006 00:43:13 +0000 (16:43 -0800)
At resume time, TSC's value or something similar might be changed a lot
against suspend time. This could make system gets a very big lost ticks.
See http://bugzilla.kernel.org/show_bug.cgi?id=5825

Signed-off-by: Shaohua Li<shaohua.li@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/pmtimer.c
arch/x86_64/kernel/time.c
include/asm-x86_64/proto.h

index feb5f108dd26e8a193232046f8ee976293bf0acb..8b2655ae4e61cb2601b44b43e9d89e4e7774a668 100644 (file)
@@ -80,6 +80,11 @@ int pmtimer_mark_offset(void)
        return lost - 1;
 }
 
+void pmtimer_resume(void)
+{
+       last_pmtmr_tick = inl(pmtmr_ioport);
+}
+
 unsigned int do_gettimeoffset_pm(void)
 {
        u32 now, offset, delta = 0;
index 91a448a86ebd7deb0fbfdbf9aeaf4503bba655dd..c1f76055b5780410a7cb2b7f1425aeda3377c42f 100644 (file)
@@ -1047,9 +1047,21 @@ static int timer_resume(struct sys_device *dev)
        write_seqlock_irqsave(&xtime_lock,flags);
        xtime.tv_sec = sec;
        xtime.tv_nsec = 0;
+       if (vxtime.mode == VXTIME_HPET) {
+               if (hpet_use_timer)
+                       vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick;
+               else
+                       vxtime.last = hpet_readl(HPET_COUNTER);
+#ifdef CONFIG_X86_PM_TIMER
+       } else if (vxtime.mode == VXTIME_PMTMR) {
+               pmtimer_resume();
+#endif
+       } else
+               vxtime.last_tsc = get_cycles_sync();
        write_sequnlock_irqrestore(&xtime_lock,flags);
        jiffies += sleep_length;
        wall_jiffies += sleep_length;
+       monotonic_base += sleep_length * (NSEC_PER_SEC/HZ);
        touch_softlockup_watchdog();
        return 0;
 }
index c1e2307445d478688e441575fb9ec25d2e9f735b..a6748b9568fef2a0ba7e4acf1afce1b1a4347c94 100644 (file)
@@ -41,6 +41,7 @@ extern void iommu_hole_init(void);
 
 extern void time_init_gtod(void);
 extern int pmtimer_mark_offset(void);
+extern void pmtimer_resume(void);
 extern unsigned int do_gettimeoffset_pm(void);
 #ifdef CONFIG_X86_PM_TIMER
 extern u32 pmtmr_ioport;