Re: [PATCH v2 42/54] KVM: x86/pmu: Implement emulated counter increment for passthrough PMU

Mi, Dapeng
2024-05-09T01:11:42Z

On 5/9/2024 2:28 AM, Chen, Zide wrote:
>
> On 5/5/2024 10:30 PM, Mingwei Zhang wrote:
>> @@ -896,6 +924,12 @@ void kvm_pmu_trigger_event(struct kvm_vcpu *vcpu, u64 eventsel)
>> return;
>>
>> kvm_for_each_pmc(pmu, pmc, i, bitmap) {
>> + if (is_passthrough)
>> + is_pmc_allowed = pmc_speculative_in_use(pmc) &&
>> + check_pmu_event_filter(pmc);
>> + else
>> + is_pmc_allowed = pmc_event_is_allowed(pmc);
>> +
> Why don't need to check pmc_is_globally_enabled() in PMU passthrough
> case? Sorry if I missed something.

Not sure if it's because the historical reason. Since pmu->global_ctrl
would be updated in each vm-exit right now, we may not need to skip
pmc_is_globally_enabled() anymore. Need Mingwei to confirm.