diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2016-07-15 08:38:36 -0400 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2016-07-16 09:26:54 -0400 |
commit | 6a907cd0ad31fce30b7a7416576410a7de7c8933 (patch) | |
tree | edd5c641dc154e14848bc7d284fcd07492decc6e | |
parent | 2b23c3a6e3eb2fba77eb35fdfa3d71a9aa3f33b7 (diff) |
Revert "KVM: SVM: fix trashing of MSR_TSC_AUX"
This reverts commit 9770404a0061ec46dec6e15c4b07731ce2e2d7bb.
The reverted patch is not needed as only userspace uses RDTSCP and
MSR_TSC_AUX is in host_save_user_msrs[] and therefore properly saved in
svm_vcpu_load() and restored in svm_vcpu_put() before every switch to
userspace.
The reverted patch did not allow the kernel to use RDTSCP in the future,
because of missed trashing in svm_set_msr() and 64-bit ifdef.
This reverts commit 2b23c3a6e3eb2fba77eb35fdfa3d71a9aa3f33b7.
2b23c3a6e3eb ("KVM: SVM: do not set MSR_TSC_AUX on 32-bit builds") is a
build fix for 9770404a0061 and reverting them separately would only
break more bisections.
Cc: stable@vger.kernel.org
-rw-r--r-- | arch/x86/kvm/svm.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 05c08b69cee7..16ef31b87452 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <asm/desc.h> | 41 | #include <asm/desc.h> |
42 | #include <asm/debugreg.h> | 42 | #include <asm/debugreg.h> |
43 | #include <asm/kvm_para.h> | 43 | #include <asm/kvm_para.h> |
44 | #include <asm/vgtod.h> | ||
45 | 44 | ||
46 | #include <asm/virtext.h> | 45 | #include <asm/virtext.h> |
47 | #include "trace.h" | 46 | #include "trace.h" |
@@ -1531,6 +1530,9 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
1531 | wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio); | 1530 | wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio); |
1532 | } | 1531 | } |
1533 | } | 1532 | } |
1533 | /* This assumes that the kernel never uses MSR_TSC_AUX */ | ||
1534 | if (static_cpu_has(X86_FEATURE_RDTSCP)) | ||
1535 | wrmsrl(MSR_TSC_AUX, svm->tsc_aux); | ||
1534 | 1536 | ||
1535 | avic_vcpu_load(vcpu, cpu); | 1537 | avic_vcpu_load(vcpu, cpu); |
1536 | } | 1538 | } |
@@ -4472,8 +4474,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
4472 | svm->vmcb->save.cr2 = vcpu->arch.cr2; | 4474 | svm->vmcb->save.cr2 = vcpu->arch.cr2; |
4473 | 4475 | ||
4474 | clgi(); | 4476 | clgi(); |
4475 | if (static_cpu_has(X86_FEATURE_RDTSCP)) | ||
4476 | wrmsrl(MSR_TSC_AUX, svm->tsc_aux); | ||
4477 | 4477 | ||
4478 | local_irq_enable(); | 4478 | local_irq_enable(); |
4479 | 4479 | ||
@@ -4551,8 +4551,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
4551 | ); | 4551 | ); |
4552 | 4552 | ||
4553 | #ifdef CONFIG_X86_64 | 4553 | #ifdef CONFIG_X86_64 |
4554 | if (static_cpu_has(X86_FEATURE_RDTSCP)) | ||
4555 | wrmsrl(MSR_TSC_AUX, __getcpu()); | ||
4556 | wrmsrl(MSR_GS_BASE, svm->host.gs_base); | 4554 | wrmsrl(MSR_GS_BASE, svm->host.gs_base); |
4557 | #else | 4555 | #else |
4558 | loadsegment(fs, svm->host.fs); | 4556 | loadsegment(fs, svm->host.fs); |