x86, vmi: TSC going backwards check in vmi clocksource

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>
Cc: stable@kernel.org

authored by

Alok N Kataria and committed by
Ingo Molnar
48ffc70b 402a917a

+4 -1
+4 -1
arch/x86/kernel/vmiclock_32.c
··· 283 283 #endif 284 284 285 285 /** vmi clocksource */ 286 + static struct clocksource clocksource_vmi; 286 287 287 288 static cycle_t read_real_cycles(void) 288 289 { 289 - return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); 290 + cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); 291 + return ret >= clocksource_vmi.cycle_last ? 292 + ret : clocksource_vmi.cycle_last; 290 293 } 291 294 292 295 static struct clocksource clocksource_vmi = {