x86, vmi: TSC going backwards check in vmi clocksource
authorAlok N Kataria <akataria@vmware.com>
Wed, 18 Feb 2009 20:33:55 +0000 (12:33 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:53:01 +0000 (17:53 -0700)
commit 48ffc70b675aa7798a52a2e92e20f6cce9140b3d upstream.

Impact: fix time warps under vmware

Similar to the check for TSC going backwards in the TSC clocksource,
we also need this check for VMI clocksource.

Signed-off-by: Alok N Kataria <akataria@vmware.com>
Cc: Zachary Amsden <zach@vmware.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kernel/vmiclock_32.c

index 6953859fe28965bc77a7db5955a0b3a0d143127e..33397728306842166f1cf34733b03db56605b5ca 100644 (file)
@@ -280,10 +280,13 @@ void __devinit vmi_time_ap_init(void)
 #endif
 
 /** vmi clocksource */
+static struct clocksource clocksource_vmi;
 
 static cycle_t read_real_cycles(void)
 {
-       return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
+       cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
+       return ret >= clocksource_vmi.cycle_last ?
+               ret : clocksource_vmi.cycle_last;
 }
 
 static struct clocksource clocksource_vmi = {