summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2006-02-03 21:50:56 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-04 16:43:13 -0800
commit0dd2ea9af8f0eca43cf6200baa182b3aba307049 (patch)
tree68d19724e9c50e14ea7d900493a9af37ff26c948 /arch
parent6f3814cd2fb5ea4d53a7fa5b0635d68fa4036c1b (diff)
downloadkernel-crypto-0dd2ea9af8f0eca43cf6200baa182b3aba307049.tar.gz
kernel-crypto-0dd2ea9af8f0eca43cf6200baa182b3aba307049.tar.xz
kernel-crypto-0dd2ea9af8f0eca43cf6200baa182b3aba307049.zip
[PATCH] x86_64: [PATCH] timer resume
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/pmtimer.c5
-rw-r--r--arch/x86_64/kernel/time.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/pmtimer.c b/arch/x86_64/kernel/pmtimer.c
index feb5f108dd2..8b2655ae4e6 100644
--- a/arch/x86_64/kernel/pmtimer.c
+++ b/arch/x86_64/kernel/pmtimer.c
@@ -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;
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 91a448a86eb..c1f76055b57 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -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;
}