BACKPORT: KVM: arm64: Record number of signal exits as a vCPU stat

Most other architectures that implement KVM record a statistic
indicating the number of times a vCPU has exited due to a pending
signal. Add support for that stat to arm64.

Reviewed-by: Jing Zhang <jingzhangos@google.com>
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210802192809.1851010-2-oupton@google.com
(cherry picked from commit fe5161d2c3)
[willdeacon@: Use VCPU_STAT instead of STATS_DESC_COUNTER]
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 198418208
Change-Id: I322334bf58efcb565769c46aa1ec3145cfe4b282
This commit is contained in:
Oliver Upton
2021-08-02 19:28:07 +00:00
committed by Will Deacon
parent 2d6db17eac
commit a92c085d26
3 changed files with 3 additions and 0 deletions

View File

@@ -577,6 +577,7 @@ struct kvm_vcpu_stat {
u64 wfi_exit_stat;
u64 mmio_exit_user;
u64 mmio_exit_kernel;
u64 signal_exits;
u64 exits;
};

View File

@@ -782,6 +782,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
if (signal_pending(current)) {
ret = -EINTR;
run->exit_reason = KVM_EXIT_INTR;
++vcpu->stat.signal_exits;
}
/*

View File

@@ -38,6 +38,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
VCPU_STAT("wfi_exit_stat", wfi_exit_stat),
VCPU_STAT("mmio_exit_user", mmio_exit_user),
VCPU_STAT("mmio_exit_kernel", mmio_exit_kernel),
VCPU_STAT("signal_exits", signal_exits),
VCPU_STAT("exits", exits),
VCPU_STAT("halt_poll_success_ns", halt_poll_success_ns),
VCPU_STAT("halt_poll_fail_ns", halt_poll_fail_ns),