all_valid_pmc_idx is a bitmap of valid PMC indices, not an index itself; rename it to pmc_exists to better reflect what it holds and keep the name consistent with other fields in the same struct. No functional change intended. Signed-off-by: Zide Chen Reviewed-by: Dapeng Mi Reviewed-by: Jim Mattson --- v2: - Pick the name pmc_exists other than all_valid_pmc_mask. (Sean) --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/pmu.c | 10 +++++----- arch/x86/kvm/vmx/pmu_intel.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index e2eef7057bd3..72b8fbf432a2 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -595,7 +595,7 @@ struct kvm_pmu { DECLARE_BITMAP(reprogram_pmi, X86_PMC_IDX_MAX); atomic64_t __reprogram_pmi; }; - DECLARE_BITMAP(all_valid_pmc_idx, X86_PMC_IDX_MAX); + DECLARE_BITMAP(pmc_exists, X86_PMC_IDX_MAX); DECLARE_BITMAP(pmc_in_use, X86_PMC_IDX_MAX); DECLARE_BITMAP(pmc_counting_instructions, X86_PMC_IDX_MAX); diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index eef2f792dc9e..83883191d124 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -944,7 +944,7 @@ static void kvm_pmu_reset(struct kvm_vcpu *vcpu) bitmap_zero(pmu->reprogram_pmi, X86_PMC_IDX_MAX); bitmap_zero(pmu->pmc_has_mode_specific_enables, X86_PMC_IDX_MAX); - kvm_for_each_pmc(pmu, pmc, i, pmu->all_valid_pmc_idx) { + kvm_for_each_pmc(pmu, pmc, i, pmu->pmc_exists) { pmc_stop_counter(pmc); pmc->counter = 0; pmc->emulated_counter = 0; @@ -990,7 +990,7 @@ void kvm_pmu_refresh(struct kvm_vcpu *vcpu) pmu->fixed_ctr_ctrl_rsvd = ~0ull; pmu->pebs_enable_rsvd = ~0ull; pmu->pebs_data_cfg_rsvd = ~0ull; - bitmap_zero(pmu->all_valid_pmc_idx, X86_PMC_IDX_MAX); + bitmap_zero(pmu->pmc_exists, X86_PMC_IDX_MAX); if (!vcpu->kvm->arch.enable_pmu) return; @@ -1011,8 +1011,8 @@ void kvm_pmu_refresh(struct kvm_vcpu *vcpu) if (kvm_vcpu_has_mediated_pmu(vcpu)) kvm_pmu_call(write_global_ctrl)(pmu->global_ctrl); - bitmap_set(pmu->all_valid_pmc_idx, 0, pmu->nr_arch_gp_counters); - bitmap_set(pmu->all_valid_pmc_idx, KVM_FIXED_PMC_BASE_IDX, + bitmap_set(pmu->pmc_exists, 0, pmu->nr_arch_gp_counters); + bitmap_set(pmu->pmc_exists, KVM_FIXED_PMC_BASE_IDX, pmu->nr_arch_fixed_counters); } @@ -1034,7 +1034,7 @@ void kvm_pmu_cleanup(struct kvm_vcpu *vcpu) pmu->need_cleanup = false; - bitmap_andnot(bitmask, pmu->all_valid_pmc_idx, + bitmap_andnot(bitmask, pmu->pmc_exists, pmu->pmc_in_use, X86_PMC_IDX_MAX); kvm_for_each_pmc(pmu, pmc, i, bitmask) { diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 36d91215f42a..ee18899614a1 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -560,7 +560,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) lbr_desc->records.nr = 0; if (lbr_desc->records.nr) - bitmap_set(pmu->all_valid_pmc_idx, INTEL_PMC_IDX_FIXED_VLBR, 1); + bitmap_set(pmu->pmc_exists, INTEL_PMC_IDX_FIXED_VLBR, 1); if (pmu->version == 1) return; -- 2.56.0