diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2008-12-11 14:45:05 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:02:53 -0400 |
commit | 53f658b3c33616a4997ee254311b335e59063289 (patch) | |
tree | fbef1e51bfa096dd28a00b2449d567f2c3ab6fb9 /arch/x86/include/asm/kvm_host.h | |
parent | e8c4a4e8a7cc047dfb3c26b2cbc8599ad3460364 (diff) |
KVM: VMX: initialize TSC offset relative to vm creation time
VMX initializes the TSC offset for each vcpu at different times, and
also reinitializes it for vcpus other than 0 on APIC SIPI message.
This bug causes the TSC's to appear unsynchronized in the guest, even if
the host is good.
Older Linux kernels don't handle the situation very well, so
gettimeofday is likely to go backwards in time:
http://www.mail-archive.com/kvm@vger.kernel.org/msg02955.html
http://sourceforge.net/tracker/index.php?func=detail&aid=2025534&group_id=180599&atid=893831
Fix it by initializating the offset of each vcpu relative to vm creation
time, and moving it from vmx_vcpu_reset to vmx_vcpu_setup, out of the
APIC MP init path.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/kvm_host.h')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index c2a01d0513f5..9efc446b5ac6 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -398,6 +398,7 @@ struct kvm_arch{ | |||
398 | 398 | ||
399 | unsigned long irq_sources_bitmap; | 399 | unsigned long irq_sources_bitmap; |
400 | unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; | 400 | unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; |
401 | u64 vm_init_tsc; | ||
401 | }; | 402 | }; |
402 | 403 | ||
403 | struct kvm_vm_stat { | 404 | struct kvm_vm_stat { |