KVM: SVM: Ensure timestamp counter monotonicity
authorAvi Kivity <avi@qumranet.com>
Sun, 25 Mar 2007 10:07:27 +0000 (12:07 +0200)
committerAvi Kivity <avi@qumranet.com>
Thu, 3 May 2007 07:52:27 +0000 (10:52 +0300)
commit0cc5064d335543a72c5ef904a3f528966fa3f2d2
tree4e6f8b4e013fc24821cb0f1af26d33d906e4d870
parentd28c6cfbbc5e2d4fccfe6d733995ed5971ca87f6
KVM: SVM: Ensure timestamp counter monotonicity

When a vcpu is migrated from one cpu to another, its timestamp counter
may lose its monotonic property if the host has unsynced timestamp counters.
This can confuse the guest, sometimes to the point of refusing to boot.

As the rdtsc instruction is rather fast on AMD processors (7-10 cycles),
we can simply record the last host tsc when we drop the cpu, and adjust
the vcpu tsc offset when we detect that we've migrated to a different cpu.

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm.h
drivers/kvm/svm.c