21.4. 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. To run this script you need to install the qemu-kvm-tools package.
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
# 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
# mount -t debugfs debugfs /sys/kernel/debug
kvm_stat Output
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).
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. Thefpu_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.