Add a new stat that counts the number of times a remote TLB flush is
requested, regardless of whether it kicks vCPUs out of guest mode. This
allows us to look at how often flushes are initiated.
Unlike remote_tlb_flush, this one applies to ARM's instruction-set-based
TLB flush implementation, so apply it there too.
Original-by: David Matlack <dmatlack@google.com>
Signed-off-by: Jing Zhang <jingzhangos@google.com>
Message-Id: <
20210817002639.
3856694-1-jingzhangos@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  */
 void kvm_flush_remote_tlbs(struct kvm *kvm)
 {
+       ++kvm->stat.generic.remote_tlb_flush_requests;
        kvm_call_hyp(__kvm_tlb_flush_vmid, &kvm->arch.mmu);
 }
 
 
                KVM_STATS_BASE_POW10, -9, sz)
 
 #define KVM_GENERIC_VM_STATS()                                                \
-       STATS_DESC_COUNTER(VM_GENERIC, remote_tlb_flush)
+       STATS_DESC_COUNTER(VM_GENERIC, remote_tlb_flush),                      \
+       STATS_DESC_COUNTER(VM_GENERIC, remote_tlb_flush_requests)
 
 #define KVM_GENERIC_VCPU_STATS()                                              \
        STATS_DESC_COUNTER(VCPU_GENERIC, halt_successful_poll),                \
 
 
 struct kvm_vm_stat_generic {
        u64 remote_tlb_flush;
+       u64 remote_tlb_flush_requests;
 };
 
 struct kvm_vcpu_stat_generic {
 
         */
        long dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
 
+       ++kvm->stat.generic.remote_tlb_flush_requests;
        /*
         * We want to publish modifications to the page tables before reading
         * mode. Pairs with a memory barrier in arch-specific code.