diff options
-rw-r--r-- | drivers/kvm/vmx.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 0b2aace70aec..d06c3627f640 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -160,6 +160,7 @@ static void __vcpu_clear(void *arg) | |||
160 | vmcs_clear(vcpu->vmcs); | 160 | vmcs_clear(vcpu->vmcs); |
161 | if (per_cpu(current_vmcs, cpu) == vcpu->vmcs) | 161 | if (per_cpu(current_vmcs, cpu) == vcpu->vmcs) |
162 | per_cpu(current_vmcs, cpu) = NULL; | 162 | per_cpu(current_vmcs, cpu) = NULL; |
163 | rdtscll(vcpu->host_tsc); | ||
163 | } | 164 | } |
164 | 165 | ||
165 | static void vcpu_clear(struct kvm_vcpu *vcpu) | 166 | static void vcpu_clear(struct kvm_vcpu *vcpu) |
@@ -376,6 +377,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu) | |||
376 | { | 377 | { |
377 | u64 phys_addr = __pa(vcpu->vmcs); | 378 | u64 phys_addr = __pa(vcpu->vmcs); |
378 | int cpu; | 379 | int cpu; |
380 | u64 tsc_this, delta; | ||
379 | 381 | ||
380 | cpu = get_cpu(); | 382 | cpu = get_cpu(); |
381 | 383 | ||
@@ -409,6 +411,13 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu) | |||
409 | 411 | ||
410 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); | 412 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); |
411 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ | 413 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ |
414 | |||
415 | /* | ||
416 | * Make sure the time stamp counter is monotonous. | ||
417 | */ | ||
418 | rdtscll(tsc_this); | ||
419 | delta = vcpu->host_tsc - tsc_this; | ||
420 | vmcs_write64(TSC_OFFSET, vmcs_read64(TSC_OFFSET) + delta); | ||
412 | } | 421 | } |
413 | } | 422 | } |
414 | 423 | ||