Re: [PATCH v2 4/5] *** DO NOT MERGE *** KVM: x86: Hack in a stat to track guest-induced exits (for testing)

From: Naveen N Rao

Date: Fri May 08 2026 - 13:23:57 EST


On Wed, May 06, 2026 at 11:47:45AM -0700, Sean Christopherson wrote:
> Not-signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> ---
> arch/x86/include/asm/kvm_host.h | 2 +
> arch/x86/kvm/svm/svm.c | 81 +++++++++++++++++++++++++++++++++
> arch/x86/kvm/vmx/vmx.c | 79 ++++++++++++++++++++++++++++++++
> arch/x86/kvm/x86.c | 2 +
> 4 files changed, 164 insertions(+)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index c470e40a00aa..bff534bd00dc 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1703,6 +1703,8 @@ struct kvm_vcpu_stat {
> u64 invlpg;
>
> u64 exits;
> + u64 guest_induced_exits;
> + u64 msr_exits;
> u64 io_exits;
> u64 mmio_exits;
> u64 signal_exits;

This looks promising. I'm assuming 'hack' in the title is only meant to
indicate the PoC nature of this?

Taking this forward, introducing a similar bucket for all AVIC/APICv
related exits might help with a few tests.


- Naveen