Re: [RFC PATCH 39/41] KVM: x86/pmu: Implement emulated counter increment for passthrough PMU

From: Sean Christopherson
Date: Thu Apr 11 2024 - 19:17:20 EST


On Thu, Apr 11, 2024, Sean Christopherson wrote:
> > + struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
> > + int bit;
> > +
> > + for_each_set_bit(bit, pmu->incremented_pmc_idx, X86_PMC_IDX_MAX) {
>
> I don't love the "incremented_pmc_idx" name. It's specifically for emulated
> events, that should ideally be clear in the name.
>
> And does the tracking the emulated counters actually buy anything? Iterating
> over all PMCs and checking emulated_counter doesn't seem like it'd be measurably
> slow, especially not when this path is likely writing multiple MSRs.
>
> Wait, why use that and not reprogram_pmi?

If the name is a sticking point, just rename it to something generic, e.g.
dirty_pmcs or something.