diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2009-12-14 06:22:20 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:41 -0500 |
commit | 953899b659adce62cbe83d6a7527550ab8797c48 (patch) | |
tree | 5eb465ea6b419ba58d310fec6c3e619fd4dd148d /arch/x86/kvm/svm.c | |
parent | 4e47c7a6d714cf352b719db92a924b6ec487acc5 (diff) |
KVM: SVM: Adjust tsc_offset only if tsc_unstable
The tsc_offset adjustment in svm_vcpu_load is executed
unconditionally even if Linux considers the host tsc as
stable. This causes a Linux guest detecting an unstable tsc
in any case.
This patch removes the tsc_offset adjustment if the host tsc
is stable. The guest will now get the benefit of a stable
tsc too.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 7f4e225feebf..b373ae6fb974 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -765,14 +765,16 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
765 | if (unlikely(cpu != vcpu->cpu)) { | 765 | if (unlikely(cpu != vcpu->cpu)) { |
766 | u64 delta; | 766 | u64 delta; |
767 | 767 | ||
768 | /* | 768 | if (check_tsc_unstable()) { |
769 | * Make sure that the guest sees a monotonically | 769 | /* |
770 | * increasing TSC. | 770 | * Make sure that the guest sees a monotonically |
771 | */ | 771 | * increasing TSC. |
772 | delta = vcpu->arch.host_tsc - native_read_tsc(); | 772 | */ |
773 | svm->vmcb->control.tsc_offset += delta; | 773 | delta = vcpu->arch.host_tsc - native_read_tsc(); |
774 | if (is_nested(svm)) | 774 | svm->vmcb->control.tsc_offset += delta; |
775 | svm->nested.hsave->control.tsc_offset += delta; | 775 | if (is_nested(svm)) |
776 | svm->nested.hsave->control.tsc_offset += delta; | ||
777 | } | ||
776 | vcpu->cpu = cpu; | 778 | vcpu->cpu = cpu; |
777 | kvm_migrate_timers(vcpu); | 779 | kvm_migrate_timers(vcpu); |
778 | svm->asid_generation = 0; | 780 | svm->asid_generation = 0; |