Commit 540c7abe authored by Wanpeng Li's avatar Wanpeng Li Committed by Paolo Bonzini

KVM: vPMU: Fill get_msr MSR_CORE_PERF_GLOBAL_OVF_CTRL w/ 0

SDM section 18.2.3 mentioned that:

  "IA32_PERF_GLOBAL_OVF_CTL MSR allows software to clear overflow indicator(s) of
   any general-purpose or fixed-function counters via a single WRMSR."

It is R/W mentioned by SDM, we read this msr on bare-metal during perf testing,
the value is always 0 for ICX/SKX boxes on hands. Let's fill get_msr
MSR_CORE_PERF_GLOBAL_OVF_CTRL w/ 0 as hardware behavior and drop
global_ovf_ctrl variable.
Tested-by: default avatarLike Xu <likexu@tencent.com>
Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
Message-Id: <1634631160-67276-2-git-send-email-wanpengli@tencent.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 610265ea
...@@ -499,7 +499,6 @@ struct kvm_pmu { ...@@ -499,7 +499,6 @@ struct kvm_pmu {
u64 fixed_ctr_ctrl; u64 fixed_ctr_ctrl;
u64 global_ctrl; u64 global_ctrl;
u64 global_status; u64 global_status;
u64 global_ovf_ctrl;
u64 counter_bitmask[2]; u64 counter_bitmask[2];
u64 global_ctrl_mask; u64 global_ctrl_mask;
u64 global_ovf_ctrl_mask; u64 global_ovf_ctrl_mask;
......
...@@ -365,7 +365,7 @@ static int intel_pmu_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) ...@@ -365,7 +365,7 @@ static int intel_pmu_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
msr_info->data = pmu->global_ctrl; msr_info->data = pmu->global_ctrl;
return 0; return 0;
case MSR_CORE_PERF_GLOBAL_OVF_CTRL: case MSR_CORE_PERF_GLOBAL_OVF_CTRL:
msr_info->data = pmu->global_ovf_ctrl; msr_info->data = 0;
return 0; return 0;
default: default:
if ((pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0)) || if ((pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0)) ||
...@@ -423,7 +423,6 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) ...@@ -423,7 +423,6 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
if (!(data & pmu->global_ovf_ctrl_mask)) { if (!(data & pmu->global_ovf_ctrl_mask)) {
if (!msr_info->host_initiated) if (!msr_info->host_initiated)
pmu->global_status &= ~data; pmu->global_status &= ~data;
pmu->global_ovf_ctrl = data;
return 0; return 0;
} }
break; break;
...@@ -588,8 +587,7 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu) ...@@ -588,8 +587,7 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu)
pmc->counter = 0; pmc->counter = 0;
} }
pmu->fixed_ctr_ctrl = pmu->global_ctrl = pmu->global_status = pmu->fixed_ctr_ctrl = pmu->global_ctrl = pmu->global_status = 0;
pmu->global_ovf_ctrl = 0;
intel_pmu_release_guest_lbr_event(vcpu); intel_pmu_release_guest_lbr_event(vcpu);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment