Re: [RFC PATCH 11/41] KVM: x86/pmu: Introduce enable_passthrough_pmu module parameter and propage to KVM instance

From: Sean Christopherson
Date: Thu Apr 11 2024 - 16:54:55 EST


On Fri, Jan 26, 2024, Xiong Zhang wrote:
> Finally, always propagate enable_passthrough_pmu and perf_capabilities into
> kvm->arch for each KVM instance.

Why?

arch.enable_passthrough_pmu is simply "arch.enable_pmu && enable_passthrough_pmu",
I don't see any reason to cache that information on a per-VM basis. Blech, it's
also cached in vcpu->pmu.passthrough, which is even more compexity that doesn't
add any value.

E.g. code that is reachable iff the VM/vCPU has a PMU can simply check the module
param. And if we commit to that model (all or nothing), then we can probably
end up with cleaner code overall because we bifurcate everything at a module
level, e.g. even use static_call() if we had reason to.