提交 6a907cd0 编写于 作者: R Radim Krčmář

Revert "KVM: SVM: fix trashing of MSR_TSC_AUX"

This reverts commit 9770404a.

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 2b23c3a6.

2b23c3a6 ("KVM: SVM: do not set MSR_TSC_AUX on 32-bit builds") is a
build fix for 9770404a and reverting them separately would only
break more bisections.

Cc: stable@vger.kernel.org
上级 2b23c3a6
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/debugreg.h> #include <asm/debugreg.h>
#include <asm/kvm_para.h> #include <asm/kvm_para.h>
#include <asm/vgtod.h>
#include <asm/virtext.h> #include <asm/virtext.h>
#include "trace.h" #include "trace.h"
...@@ -1531,6 +1530,9 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) ...@@ -1531,6 +1530,9 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio); wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio);
} }
} }
/* This assumes that the kernel never uses MSR_TSC_AUX */
if (static_cpu_has(X86_FEATURE_RDTSCP))
wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
avic_vcpu_load(vcpu, cpu); avic_vcpu_load(vcpu, cpu);
} }
...@@ -4472,8 +4474,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) ...@@ -4472,8 +4474,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
svm->vmcb->save.cr2 = vcpu->arch.cr2; svm->vmcb->save.cr2 = vcpu->arch.cr2;
clgi(); clgi();
if (static_cpu_has(X86_FEATURE_RDTSCP))
wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
local_irq_enable(); local_irq_enable();
...@@ -4551,8 +4551,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) ...@@ -4551,8 +4551,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
); );
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
if (static_cpu_has(X86_FEATURE_RDTSCP))
wrmsrl(MSR_TSC_AUX, __getcpu());
wrmsrl(MSR_GS_BASE, svm->host.gs_base); wrmsrl(MSR_GS_BASE, svm->host.gs_base);
#else #else
loadsegment(fs, svm->host.fs); loadsegment(fs, svm->host.fs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册