diff options
author | Avi Kivity <avi@qumranet.com> | 2007-03-25 06:07:27 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:27 -0400 |
commit | 0cc5064d335543a72c5ef904a3f528966fa3f2d2 (patch) | |
tree | 4e6f8b4e013fc24821cb0f1af26d33d906e4d870 /drivers/kvm/kvm.h | |
parent | d28c6cfbbc5e2d4fccfe6d733995ed5971ca87f6 (diff) |
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>
Diffstat (limited to 'drivers/kvm/kvm.h')
-rw-r--r-- | drivers/kvm/kvm.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index f5e343cb06b0..6d0bd7aab92e 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -244,6 +244,7 @@ struct kvm_vcpu { | |||
244 | struct mutex mutex; | 244 | struct mutex mutex; |
245 | int cpu; | 245 | int cpu; |
246 | int launched; | 246 | int launched; |
247 | u64 host_tsc; | ||
247 | struct kvm_run *run; | 248 | struct kvm_run *run; |
248 | int interrupt_window_open; | 249 | int interrupt_window_open; |
249 | unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ | 250 | unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ |