OSDN Git Service

KVM: arm64: Record number of signal exits as a vCPU stat
authorOliver Upton <oupton@google.com>
Mon, 2 Aug 2021 19:28:07 +0000 (19:28 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 19 Aug 2021 10:19:41 +0000 (11:19 +0100)
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
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/guest.c

index 4191158..70e129f 100644 (file)
@@ -576,6 +576,7 @@ struct kvm_vcpu_stat {
        u64 wfi_exit_stat;
        u64 mmio_exit_user;
        u64 mmio_exit_kernel;
+       u64 signal_exits;
        u64 exits;
 };
 
index e9a2b8f..60d0a54 100644 (file)
@@ -783,6 +783,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;
                }
 
                /*
index 1dfb835..853d1e8 100644 (file)
@@ -50,6 +50,7 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
        STATS_DESC_COUNTER(VCPU, wfi_exit_stat),
        STATS_DESC_COUNTER(VCPU, mmio_exit_user),
        STATS_DESC_COUNTER(VCPU, mmio_exit_kernel),
+       STATS_DESC_COUNTER(VCPU, signal_exits),
        STATS_DESC_COUNTER(VCPU, exits)
 };
 static_assert(ARRAY_SIZE(kvm_vcpu_stats_desc) ==