[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240126085444.324918-28-xiong.y.zhang@linux.intel.com>
Date: Fri, 26 Jan 2024 16:54:30 +0800
From: Xiong Zhang <xiong.y.zhang@...ux.intel.com>
To: seanjc@...gle.com,
pbonzini@...hat.com,
peterz@...radead.org,
mizhang@...gle.com,
kan.liang@...el.com,
zhenyuw@...ux.intel.com,
dapeng1.mi@...ux.intel.com,
jmattson@...gle.com
Cc: kvm@...r.kernel.org,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org,
zhiyuan.lv@...el.com,
eranian@...gle.com,
irogers@...gle.com,
samantha.alt@...el.com,
like.xu.linux@...il.com,
chao.gao@...el.com,
xiong.y.zhang@...ux.intel.com
Subject: [RFC PATCH 27/41] KVM: x86/pmu: Clear PERF_METRICS MSR for guest
From: Dapeng Mi <dapeng1.mi@...ux.intel.com>
Since perf topdown metrics feature is not supported yet, clear
PERF_METRICS MSR for guest.
Signed-off-by: Dapeng Mi <dapeng1.mi@...ux.intel.com>
---
arch/x86/kvm/vmx/pmu_intel.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index 4b4da7f17895..ad0434646a29 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -916,6 +916,10 @@ static void intel_restore_pmu_context(struct kvm_vcpu *vcpu)
*/
for (i = pmu->nr_arch_fixed_counters; i < kvm_pmu_cap.num_counters_fixed; i++)
wrmsrl(MSR_CORE_PERF_FIXED_CTR0 + i, 0);
+
+ /* Clear PERF_METRICS MSR since guest topdown metrics is not supported yet. */
+ if (kvm_caps.host_perf_cap & PMU_CAP_PERF_METRICS)
+ wrmsrl(MSR_PERF_METRICS, 0);
}
struct kvm_pmu_ops intel_pmu_ops __initdata = {
--
2.34.1
Powered by blists - more mailing lists