A.4. kvm_stat
kvm_stat command is a python script which retrieves runtime statistics from the kvm kernel module. The kvm_stat command can be used to diagnose guest behavior visible to kvm. In particular, performance related issues with guests. Currently, the reported statistics are for the entire system; the behavior of all running guests is reported. To run this script you need to install the qemu-kvm-tools package. For more information, see Section 2.2, “Installing Virtualization Packages on an Existing Red Hat Enterprise Linux System”.
kvm_stat command requires that the kvm kernel module is loaded and debugfs is mounted. If either of these features are not enabled, the command will output the required steps to enable debugfs or the kvm module. For example:
# kvm_stat
Please mount debugfs ('mount -t debugfs debugfs /sys/kernel/debug')
and ensure the kvm modules are loadeddebugfs if required:
# mount -t debugfs debugfs /sys/kernel/debug
The kvm_stat command outputs statistics for all guests and the host. The output is updated until the command is terminated (using Ctrl+c or the q key). Note that the output you see on your screen may differ. For an explanation of the output elements, click any of the terms to link to the defintion.
# kvm_stat
kvm statistics
kvm_exit 17724 66
Individual exit reasons follow, see kvm_exit (NAME) for more information.
kvm_exit(CLGI) 0 0
kvm_exit(CPUID) 0 0
kvm_exit(CR0_SEL_WRITE) 0 0
kvm_exit(EXCP_BASE) 0 0
kvm_exit(FERR_FREEZE) 0 0
kvm_exit(GDTR_READ) 0 0
kvm_exit(GDTR_WRITE) 0 0
kvm_exit(HLT) 11 11
kvm_exit(ICEBP) 0 0
kvm_exit(IDTR_READ) 0 0
kvm_exit(IDTR_WRITE) 0 0
kvm_exit(INIT) 0 0
kvm_exit(INTR) 0 0
kvm_exit(INVD) 0 0
kvm_exit(INVLPG) 0 0
kvm_exit(INVLPGA) 0 0
kvm_exit(IOIO) 0 0
kvm_exit(IRET) 0 0
kvm_exit(LDTR_READ) 0 0
kvm_exit(LDTR_WRITE) 0 0
kvm_exit(MONITOR) 0 0
kvm_exit(MSR) 40 40
kvm_exit(MWAIT) 0 0
kvm_exit(MWAIT_COND) 0 0
kvm_exit(NMI) 0 0
kvm_exit(NPF) 0 0
kvm_exit(PAUSE) 0 0
kvm_exit(POPF) 0 0
kvm_exit(PUSHF) 0 0
kvm_exit(RDPMC) 0 0
kvm_exit(RDTSC) 0 0
kvm_exit(RDTSCP) 0 0
kvm_exit(READ_CR0) 0 0
kvm_exit(READ_CR3) 0 0
kvm_exit(READ_CR4) 0 0
kvm_exit(READ_CR8) 0 0
kvm_exit(READ_DR0) 0 0
kvm_exit(READ_DR1) 0 0
kvm_exit(READ_DR2) 0 0
kvm_exit(READ_DR3) 0 0
kvm_exit(READ_DR4) 0 0
kvm_exit(READ_DR5) 0 0
kvm_exit(READ_DR6) 0 0
kvm_exit(READ_DR7) 0 0
kvm_exit(RSM) 0 0
kvm_exit(SHUTDOWN) 0 0
kvm_exit(SKINIT) 0 0
kvm_exit(SMI) 0 0
kvm_exit(STGI) 0 0
kvm_exit(SWINT) 0 0
kvm_exit(TASK_SWITCH) 0 0
kvm_exit(TR_READ) 0 0
kvm_exit(TR_WRITE) 0 0
kvm_exit(VINTR) 1 1
kvm_exit(VMLOAD) 0 0
kvm_exit(VMMCALL) 0 0
kvm_exit(VMRUN) 0 0
kvm_exit(VMSAVE) 0 0
kvm_exit(WBINVD) 0 0
kvm_exit(WRITE_CR0) 2 2
kvm_exit(WRITE_CR3) 0 0
kvm_exit(WRITE_CR4) 0 0
kvm_exit(WRITE_CR8) 0 0
kvm_exit(WRITE_DR0) 0 0
kvm_exit(WRITE_DR1) 0 0
kvm_exit(WRITE_DR2) 0 0
kvm_exit(WRITE_DR3) 0 0
kvm_exit(WRITE_DR4) 0 0
kvm_exit(WRITE_DR5) 0 0
kvm_exit(WRITE_DR6) 0 0
kvm_exit(WRITE_DR7) 0 0
kvm_entry 17724 66
kvm_apic 13935 51
kvm_emulate_insn 13924 51
kvm_mmio 13897 50
varl-kvm_eoi 3222 12
kvm_inj_virq 3222 12
kvm_apic_accept_irq 3222 12
kvm_pv_eoi 3184 12
kvm_fpu 376 2
kvm_cr 177 1
kvm_apic_ipi 278 1
kvm_msi_set_irq 295 0
kvm_pio 79 0
kvm_userspace_exit 52 0
kvm_set_irq 50 0
kvm_pic_set_irq 50 0
kvm_ioapic_set_irq 50 0
kvm_ack_irq 25 0
kvm_cpuid 90 0
kvm_msr 12 0
Explanation of variables:
kvm_ack_irq- Number of interrupt controller (PIC/IOAPIC) interrupt acknowledgements.kvm_age_page- Number of page age iterations by memory management unit (MMU) notifiers.kvm_apic- Number of APIC register accesses.kvm_apic_accept_irq- Number of interrupts accepted into local APIC.kvm_apic_ipi- Number of inter processor interrupts.kvm_async_pf_completed- Number of completions of asynchronous page faults.kvm_async_pf_doublefault- Number of asynchronous page fault halts.kvm_async_pf_not_present- Number of initializations of asynchronous page faults.kvm_async_pf_ready- Number of completions of asynchronous page faults.kvm_cpuid- Number of CPUID instructions executed.kvm_cr- Number of trapped and emulated control register (CR) accesses (CR0, CR3, CR4, CR8).kvm_emulate_insn- Number of emulated instructions.kvm_entry- Number of emulated instructions.kvm_eoi- Number of Advanced Programmable Interrupt Controller (APIC) end of interrupt (EOI) notifications.kvm_exit- Number ofVM-exits.kvm_exit (NAME)- Individual exits that are processor-specific. See your processor's documentation for more information.kvm_fpu- Number of KVM floating-point units (FPU) reloads.kvm_hv_hypercall- Number of Hyper-V hypercalls.kvm_hypercall- Number of non-Hyper-V hypercalls.kvm_inj_exception- Number of exceptions injected into guest.kvm_inj_virq- Number of interrupts injected into guest.kvm_invlpga- Number of INVLPGA instructions intercepted.kvm_ioapic_set_irq- Number of interrupts level changes to the virtual IOAPIC controller.kvm_mmio- Number of emulated memory-mapped I/O (MMIO) operations.kvm_msi_set_irq- Number of message-signaled interrupts (MSI).kvm_msr- Number of model-specific register (MSR) accesses.kvm_nested_intercepts- Number of L1 ⇒ L2 nested SVM switches.kvm_nested_vmrun- Number of L1 ⇒ L2 nested SVM switches.kvm_nested_intr_vmexit- Number of nested VM-exit injections due to interrupt window.kvm_nested_vmexit- Exits to hypervisor while executing nested (L2) guest.kvm_nested_vmexit_inject- Number of L2 ⇒ L1 nested switches.kvm_page_fault- Number of page faults handled by hypervisor.kvm_pic_set_irq- Number of interrupts level changes to the virtual programmable interrupt controller (PIC).kvm_pio- Number of emulated programmed I/O (PIO) operations.kvm_pv_eoi- Number of paravirtual end of input (EOI) events.kvm_set_irq- Number of interrupt level changes at the generic IRQ controller level (counts PIC, IOAPIC and MSI).kvm_skinit- Number of SVM SKINIT exits.kvm_track_tsc- Number of time stamp counter (TSC) writes.kvm_try_async_get_page- Number of asynchronous page fault attempts.kvm_update_master_clock- Number of pvclock masterclock updates.kvm_userspace_exit- Number of exits to user space.kvm_write_tsc_offset- Number of TSC offset writes.vcpu_match_mmio- Number of SPTE cached memory-mapped I/O (MMIO) hits.
kvm_stat command is exported by the KVM hypervisor as pseudo files which are located in the /sys/kernel/debug/tracing/events/kvm/ directory.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.