On Mon, Oct 11, 2021, Marc Zyngier wrote: > On Wed, 22 Sep 2021 01:05:32 +0100, > Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h > > index 864b9997efb2..42270676498d 100644 > > --- a/include/kvm/arm_pmu.h > > +++ b/include/kvm/arm_pmu.h > > @@ -14,6 +14,7 @@ > > #define ARMV8_PMU_MAX_COUNTER_PAIRS ((ARMV8_PMU_MAX_COUNTERS + 1) >> 1) > > > > DECLARE_STATIC_KEY_FALSE(kvm_arm_pmu_available); > > +void kvm_pmu_init(void); > > > > static __always_inline bool kvm_arm_support_pmu_v3(void) > > { > > Note that this patch is now conflicting with e840f42a4992 ("KVM: > arm64: Fix PMU probe ordering"), which was merged in -rc4. Moving the > static key definition to arch/arm64/kvm/pmu-emul.c and getting rid of > kvm_pmu_init() altogether should be enough to resolve it. Defining kvm_arm_pmu_available in pmu-emul.c doesn't work as-is because pmu-emul.c depends on CONFIG_HW_PERF_EVENTS=y. Since pmu-emul.c is the only path that enables the key, my plan is to add a prep match to bury kvm_arm_pmu_available behind the existing #ifdef CONFIG_HW_PERF_EVENTS in arm_pmu.h and add a stub for kvm_arm_support_pmu_v3(). The only ugly part is that the KVM_NVHE_ALIAS() also gains an #ifdef, but that doesn't seem too bad.