KVM: s390: track synchronous pfault events in kvm_stat
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 25 Nov 2020 09:06:58 +0000 (10:06 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 10 Dec 2020 13:20:26 +0000 (14:20 +0100)
Right now we do count pfault (pseudo page faults aka async page faults
start and completion events). What we do not count is, if an async page
fault would have been possible by the host, but it was disabled by the
guest (e.g. interrupts off, pfault disabled, secure execution....).  Let
us count those as well in the pfault_sync counter.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/20201125090658.38463-1-borntraeger@de.ibm.com
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/kvm-s390.c

index 463c24e26000f0c8acbc830b335d06be258c6033..74f9a036bab2c8b42bec065f4c37bf040d7a91c3 100644 (file)
@@ -459,6 +459,7 @@ struct kvm_vcpu_stat {
        u64 diagnose_308;
        u64 diagnose_500;
        u64 diagnose_other;
+       u64 pfault_sync;
 };
 
 #define PGM_OPERATION                  0x01
index 19804c388d6182ec747c614ec8599ef783257bda..065f94f22fd3829cbfa415f240fb2a6ebd536a02 100644 (file)
@@ -60,6 +60,7 @@
 struct kvm_stats_debugfs_item debugfs_entries[] = {
        VCPU_STAT("userspace_handled", exit_userspace),
        VCPU_STAT("exit_null", exit_null),
+       VCPU_STAT("pfault_sync", pfault_sync),
        VCPU_STAT("exit_validity", exit_validity),
        VCPU_STAT("exit_stop_request", exit_stop_request),
        VCPU_STAT("exit_external_request", exit_external_request),
@@ -4111,6 +4112,7 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
                current->thread.gmap_pfault = 0;
                if (kvm_arch_setup_async_pf(vcpu))
                        return 0;
+               vcpu->stat.pfault_sync++;
                return kvm_arch_fault_in_page(vcpu, current->thread.gmap_addr, 1);
        }
        return vcpu_post_run_fault_in_sie(vcpu);