Product SiteDocumentation Site

34.2. kvm_stat

The 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.
The 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 loaded
Mount debugfs if required:
# mount -t debugfs debugfs /sys/kernel/debug
kvm_stat output
The kvm_stat command outputs statistics for all virtualized guests and the host. The output is updated until the command is terminated (using Ctrl+c or the q key).
# kvm_stat

kvm statistics

efer_reload                 94       0
exits                  4003074   31272
fpu_reload             1313881   10796
halt_exits               14050     259
halt_wakeup               4496     203
host_state_reload	1638354   24893
hypercalls                   0       0
insn_emulation         1093850    1909
insn_emulation_fail          0       0
invlpg                   75569       0
io_exits               1596984   24509
irq_exits                21013     363
irq_injections           48039    1222
irq_window               24656     870
largepages                   0       0
mmio_exits               11873       0
mmu_cache_miss           42565       8
mmu_flooded              14752       0
mmu_pde_zapped           58730       0
mmu_pte_updated              6       0
mmu_pte_write           138795       0
mmu_recycled                 0       0
mmu_shadow_zapped        40358       0
mmu_unsync                 793       0
nmi_injections               0       0
nmi_window                   0       0
pf_fixed                697731    3150
pf_guest                279349       0
remote_tlb_flush             5       0
request_irq                  0       0
signal_exits                 1       0
tlb_flush               200190       0
Explanation of variables:
efer_reload
The number of Extended Feature Enable Register (EFER) reloads.
exits
The count of all VMEXIT calls.
fpu_reload
The number of times a VMENTRY reloaded the FPU state. The fpu_reload is incremented when a guest is using the Floating Point Unit (FPU).
halt_exits
Number of guest exits due to halt calls. This type of exit is usually seen when a guest is idle.
halt_wakeup
Number of wakeups from a halt.
host_state_reload
Count of full reloads of the host state (currently tallies MSR setup and guest MSR reads).
hypercalls
Number of guest hypervisor service calls.
insn_emulation
Number of guest instructions emulated by the host.
insn_emulation_fail
Number of failed insn_emulation attempts.
io_exits
Number of guest exits from I/O port accesses.
irq_exits
Number of guest exits due to external interrupts.
irq_injections
Number of interrupts sent to guests.
irq_window
Number of guest exits from an outstanding interrupt window.
largepages
Number of large pages currently in use.
mmio_exits
Number of guest exits due to memory mapped I/O (MMIO) accesses.
mmu_cache_miss
Number of KVM MMU shadow pages created.
mmu_flooded
Detection count of excessive write operations to an MMU page. This counts detected write operations not of individual write operations.
mmu_pde_zapped
Number of page directory entry (PDE) destruction operations.
mmu_pte_updated
Number of page table entry (PTE) destruction operations.
mmu_pte_write
Number of guest page table entry (PTE) write operations.
mmu_recycled
Number of shadow pages that can be reclaimed.
mmu_shadow_zapped
Number of invalidated shadow pages.
mmu_unsync
Number of non-synchronized pages which are not yet unlinked.
nmi_injections
Number of Non-maskable Interrupt (NMI) injections to the guest.
nmi_window
Number of guest exits from (outstanding) Non-maskable Interrupt (NMI) windows.
pf_fixed
Number of fixed (non-paging) page table entry (PTE) maps.
pf_guest
Number of page faults injected into guests.
remote_tlb_flush
Number of remote (sibling CPU) Translation Lookaside Buffer (TLB) flush requests.
request_irq
Number of guest interrupt window request exits.
signal_exits
Number of guest exits due to pending signals from the host.
tlb_flush
Number of tlb_flush operations performed by the hypervisor.

Note

The output information from the kvm_stat command is exported by the KVM hypervisor as pseudo files located in the /sys/kernel/debug/kvm/ directory.