Message ID | 20210922000533.713300-15-seanjc@google.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | perf: KVM: Fix, optimize, and clean up callbacks | expand |
On Wed, 22 Sep 2021 01:05:31 +0100, Sean Christopherson <seanjc@google.com> wrote: > > Drop arm64's version of the callbacks in favor of the callbacks provided > by generic KVM, which are semantically identical. > > Signed-off-by: Sean Christopherson <seanjc@google.com> > --- > arch/arm64/kvm/perf.c | 34 ++-------------------------------- > 1 file changed, 2 insertions(+), 32 deletions(-) > > diff --git a/arch/arm64/kvm/perf.c b/arch/arm64/kvm/perf.c > index 3e99ac4ab2d6..0b902e0d5b5d 100644 > --- a/arch/arm64/kvm/perf.c > +++ b/arch/arm64/kvm/perf.c > @@ -13,45 +13,15 @@ > > DEFINE_STATIC_KEY_FALSE(kvm_arm_pmu_available); > > -static unsigned int kvm_guest_state(void) > -{ > - struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); > - unsigned int state; > - > - if (!vcpu) > - return 0; > - > - state = PERF_GUEST_ACTIVE; > - if (!vcpu_mode_priv(vcpu)) > - state |= PERF_GUEST_USER; > - > - return state; > -} > - > -static unsigned long kvm_get_guest_ip(void) > -{ > - struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); > - > - if (WARN_ON_ONCE(!vcpu)) > - return 0; > - > - return *vcpu_pc(vcpu); > -} > - > -static struct perf_guest_info_callbacks kvm_guest_cbs = { > - .state = kvm_guest_state, > - .get_ip = kvm_get_guest_ip, > -}; > - > void kvm_perf_init(void) > { > if (kvm_pmu_probe_pmuver() != 0xf && !is_protected_kvm_enabled()) > static_branch_enable(&kvm_arm_pmu_available); > > - perf_register_guest_info_callbacks(&kvm_guest_cbs); > + kvm_register_perf_callbacks(NULL); > } > > void kvm_perf_teardown(void) > { > - perf_unregister_guest_info_callbacks(&kvm_guest_cbs); > + kvm_unregister_perf_callbacks(); > } Reviewed-by: Marc Zyngier <maz@kernel.org> M.
diff --git a/arch/arm64/kvm/perf.c b/arch/arm64/kvm/perf.c index 3e99ac4ab2d6..0b902e0d5b5d 100644 --- a/arch/arm64/kvm/perf.c +++ b/arch/arm64/kvm/perf.c @@ -13,45 +13,15 @@ DEFINE_STATIC_KEY_FALSE(kvm_arm_pmu_available); -static unsigned int kvm_guest_state(void) -{ - struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); - unsigned int state; - - if (!vcpu) - return 0; - - state = PERF_GUEST_ACTIVE; - if (!vcpu_mode_priv(vcpu)) - state |= PERF_GUEST_USER; - - return state; -} - -static unsigned long kvm_get_guest_ip(void) -{ - struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); - - if (WARN_ON_ONCE(!vcpu)) - return 0; - - return *vcpu_pc(vcpu); -} - -static struct perf_guest_info_callbacks kvm_guest_cbs = { - .state = kvm_guest_state, - .get_ip = kvm_get_guest_ip, -}; - void kvm_perf_init(void) { if (kvm_pmu_probe_pmuver() != 0xf && !is_protected_kvm_enabled()) static_branch_enable(&kvm_arm_pmu_available); - perf_register_guest_info_callbacks(&kvm_guest_cbs); + kvm_register_perf_callbacks(NULL); } void kvm_perf_teardown(void) { - perf_unregister_guest_info_callbacks(&kvm_guest_cbs); + kvm_unregister_perf_callbacks(); }
Drop arm64's version of the callbacks in favor of the callbacks provided by generic KVM, which are semantically identical. Signed-off-by: Sean Christopherson <seanjc@google.com> --- arch/arm64/kvm/perf.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-)