Re: [RFC 3/3] x86: KVM: stats: Add a stat counter for GALog events

From: Chao Gao
Date: Tue Apr 09 2024 - 02:46:54 EST


>diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
>index 4b74ea91f4e6..853cafe4a9af 100644
>--- a/arch/x86/kvm/svm/avic.c
>+++ b/arch/x86/kvm/svm/avic.c
>@@ -165,8 +165,10 @@ int avic_ga_log_notifier(u32 ga_tag)
> * bit in the vAPIC backing page. So, we just need to schedule
> * in the vcpu.
> */
>- if (vcpu)
>+ if (vcpu) {
> kvm_vcpu_wake_up(vcpu);
>+ ++vcpu->stat.ga_log_event;
>+ }
>

I am not sure why this is added for SVM only. it looks to me GALog events are
similar to Intel IOMMU's wakeup events. Can we have a general name? maybe
iommu_wakeup_event

and increase the counter after the kvm_vcpu_wake_up() call in pi_wakeup_handler().