]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: x86: Account fastpath-only VM-Exits in vCPU stats
authorSean Christopherson <seanjc@google.com>
Fri, 2 Jun 2023 01:19:19 +0000 (18:19 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 2 Jun 2023 23:37:49 +0000 (16:37 -0700)
Increment vcpu->stat.exits when handling a fastpath VM-Exit without
going through any part of the "slow" path.  Not bumping the exits stat
can result in wildly misleading exit counts, e.g. if the primary reason
the guest is exiting is to program the TSC deadline timer.

Fixes: 404d5d7bff0d ("KVM: X86: Introduce more exit_fastpath_completion enum values")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230602011920.787844-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c

index c0778ca39650f42863d7e0d21464d1717b939314..04b57a336b34e5fc5224c47e5e8f23f794e98729 100644 (file)
@@ -10758,6 +10758,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
                        exit_fastpath = EXIT_FASTPATH_EXIT_HANDLED;
                        break;
                }
+
+               /* Note, VM-Exits that go down the "slow" path are accounted below. */
+               ++vcpu->stat.exits;
        }
 
        /*