Skip to content

Commit 6a907cd

Browse files
committed
Revert "KVM: SVM: fix trashing of MSR_TSC_AUX"
This reverts commit 9770404. 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 2b23c3a. 2b23c3a ("KVM: SVM: do not set MSR_TSC_AUX on 32-bit builds") is a build fix for 9770404 and reverting them separately would only break more bisections. Cc: [email protected]
1 parent 2b23c3a commit 6a907cd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

arch/x86/kvm/svm.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <asm/desc.h>
4242
#include <asm/debugreg.h>
4343
#include <asm/kvm_para.h>
44-
#include <asm/vgtod.h>
4544

4645
#include <asm/virtext.h>
4746
#include "trace.h"
@@ -1531,6 +1530,9 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
15311530
wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio);
15321531
}
15331532
}
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);
15341536

15351537
avic_vcpu_load(vcpu, cpu);
15361538
}
@@ -4472,8 +4474,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
44724474
svm->vmcb->save.cr2 = vcpu->arch.cr2;
44734475

44744476
clgi();
4475-
if (static_cpu_has(X86_FEATURE_RDTSCP))
4476-
wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
44774477

44784478
local_irq_enable();
44794479

@@ -4551,8 +4551,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
45514551
);
45524552

45534553
#ifdef CONFIG_X86_64
4554-
if (static_cpu_has(X86_FEATURE_RDTSCP))
4555-
wrmsrl(MSR_TSC_AUX, __getcpu());
45564554
wrmsrl(MSR_GS_BASE, svm->host.gs_base);
45574555
#else
45584556
loadsegment(fs, svm->host.fs);

0 commit comments

Comments
 (0)