diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8b8fc0b792ba..20316c67b824 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -106,6 +106,8 @@ EXPORT_SYMBOL_GPL(kvm_max_guest_tsc_khz); | |||
106 | static u32 tsc_tolerance_ppm = 250; | 106 | static u32 tsc_tolerance_ppm = 250; |
107 | module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR); | 107 | module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR); |
108 | 108 | ||
109 | static bool backwards_tsc_observed = false; | ||
110 | |||
109 | #define KVM_NR_SHARED_MSRS 16 | 111 | #define KVM_NR_SHARED_MSRS 16 |
110 | 112 | ||
111 | struct kvm_shared_msrs_global { | 113 | struct kvm_shared_msrs_global { |
@@ -280,7 +282,7 @@ int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
280 | } | 282 | } |
281 | EXPORT_SYMBOL_GPL(kvm_set_apic_base); | 283 | EXPORT_SYMBOL_GPL(kvm_set_apic_base); |
282 | 284 | ||
283 | asmlinkage void kvm_spurious_fault(void) | 285 | asmlinkage __visible void kvm_spurious_fault(void) |
284 | { | 286 | { |
285 | /* Fault while not rebooting. We want the trace. */ | 287 | /* Fault while not rebooting. We want the trace. */ |
286 | BUG(); | 288 | BUG(); |
@@ -1486,7 +1488,8 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm) | |||
1486 | &ka->master_kernel_ns, | 1488 | &ka->master_kernel_ns, |
1487 | &ka->master_cycle_now); | 1489 | &ka->master_cycle_now); |
1488 | 1490 | ||
1489 | ka->use_master_clock = host_tsc_clocksource & vcpus_matched; | 1491 | ka->use_master_clock = host_tsc_clocksource && vcpus_matched |
1492 | && !backwards_tsc_observed; | ||
1490 | 1493 | ||
1491 | if (ka->use_master_clock) | 1494 | if (ka->use_master_clock) |
1492 | atomic_set(&kvm_guest_has_master_clock, 1); | 1495 | atomic_set(&kvm_guest_has_master_clock, 1); |
@@ -6945,6 +6948,7 @@ int kvm_arch_hardware_enable(void *garbage) | |||
6945 | */ | 6948 | */ |
6946 | if (backwards_tsc) { | 6949 | if (backwards_tsc) { |
6947 | u64 delta_cyc = max_tsc - local_tsc; | 6950 | u64 delta_cyc = max_tsc - local_tsc; |
6951 | backwards_tsc_observed = true; | ||
6948 | list_for_each_entry(kvm, &vm_list, vm_list) { | 6952 | list_for_each_entry(kvm, &vm_list, vm_list) { |
6949 | kvm_for_each_vcpu(i, vcpu, kvm) { | 6953 | kvm_for_each_vcpu(i, vcpu, kvm) { |
6950 | vcpu->arch.tsc_offset_adjustment += delta_cyc; | 6954 | vcpu->arch.tsc_offset_adjustment += delta_cyc; |