• Avi Kivity's avatar
    KVM: SVM: Ensure timestamp counter monotonicity · 0cc5064d
    Avi Kivity authored
    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: default avatarAvi Kivity <avi@qumranet.com>
    0cc5064d
kvm.h 16.9 KB