| 1 |
kvm_service_time.stp - Time Statistics on KVM Exit Reasons |
| 2 |
|
| 3 |
The kvm_service_time.stp script tracks the statistics about the |
| 4 |
amount of time that the processor left the guest virtual machine for |
| 5 |
each exit reason (for example fixing up a page table or handling an |
| 6 |
IO operation). When the script exits it prints out the number of |
| 7 |
times each exit reason was encountered, the total duration of time it |
| 8 |
left the guest VM, the minimum time, the average time, and the |
| 9 |
maximum time in microseconds for that exit reason. On Linux 2.6.38 |
| 10 |
and newer kernel the script can automatically determine whether it is |
| 11 |
running on Intel or AMD processors. For older kernels with a |
| 12 |
kernel.trace("kvm_exit") tracepoint that does not have the $isa |
| 13 |
parameter you can explicitly state the kvm type with a "-G kvm=intel" |
| 14 |
or "-G kvm=amd" on the command line. |
| 15 |
|
| 16 |
# stap kvm_service_time.stp -T 1 |
| 17 |
|
| 18 |
|
| 19 |
$ stap kvm_service_time.stp -T 10 |
| 20 |
|
| 21 |
# Intel exit reasons are EXIT_REASON_* in linux/arch/x86/include/asm/vmx.h |
| 22 |
# reason: count sum(us) min(us) avg(us) max(us) |
| 23 |
0: 55 123 0 2 12 |
| 24 |
1: 16668 23165 0 1 77 |
| 25 |
7: 65 129 0 1 21 |
| 26 |
12: 182 29145513 58 160140 500054 |
| 27 |
28: 1 2 2 2 2 |
| 28 |
30: 1561 5126 0 3 43 |
| 29 |
32: 10728 7748 0 0 32 |
| 30 |
40: 4966918 1273170 0 0 47 |
| 31 |
49: 105 201 0 1 22 |
| 32 |
|
| 33 |
|
| 34 |
Below are the EXIT_REASON_* codes corresponding to the output from the result |
| 35 |
|
| 36 |
#define EXIT_REASON_EXCEPTION_NMI 0 |
| 37 |
#define EXIT_REASON_EXTERNAL_INTERRUPT 1 |
| 38 |
#define EXIT_REASON_TRIPLE_FAULT 2 |
| 39 |
|
| 40 |
#define EXIT_REASON_PENDING_INTERRUPT 7 |
| 41 |
#define EXIT_REASON_NMI_WINDOW 8 |
| 42 |
#define EXIT_REASON_TASK_SWITCH 9 |
| 43 |
#define EXIT_REASON_CPUID 10 |
| 44 |
#define EXIT_REASON_HLT 12 |
| 45 |
#define EXIT_REASON_INVD 13 |
| 46 |
#define EXIT_REASON_INVLPG 14 |
| 47 |
#define EXIT_REASON_RDPMC 15 |
| 48 |
#define EXIT_REASON_RDTSC 16 |
| 49 |
#define EXIT_REASON_VMCALL 18 |
| 50 |
#define EXIT_REASON_VMCLEAR 19 |
| 51 |
#define EXIT_REASON_VMLAUNCH 20 |
| 52 |
#define EXIT_REASON_VMPTRLD 21 |
| 53 |
#define EXIT_REASON_VMPTRST 22 |
| 54 |
#define EXIT_REASON_VMREAD 23 |
| 55 |
#define EXIT_REASON_VMRESUME 24 |
| 56 |
#define EXIT_REASON_VMWRITE 25 |
| 57 |
#define EXIT_REASON_VMOFF 26 |
| 58 |
#define EXIT_REASON_VMON 27 |
| 59 |
#define EXIT_REASON_CR_ACCESS 28 |
| 60 |
#define EXIT_REASON_DR_ACCESS 29 |
| 61 |
#define EXIT_REASON_IO_INSTRUCTION 30 |
| 62 |
#define EXIT_REASON_MSR_READ 31 |
| 63 |
#define EXIT_REASON_MSR_WRITE 32 |
| 64 |
#define EXIT_REASON_INVALID_STATE 33 |
| 65 |
#define EXIT_REASON_MWAIT_INSTRUCTION 36 |
| 66 |
#define EXIT_REASON_MONITOR_INSTRUCTION 39 |
| 67 |
#define EXIT_REASON_PAUSE_INSTRUCTION 40 |
| 68 |
#define EXIT_REASON_MCE_DURING_VMENTRY 41 |
| 69 |
#define EXIT_REASON_TPR_BELOW_THRESHOLD 43 |
| 70 |
#define EXIT_REASON_APIC_ACCESS 44 |
| 71 |
#define EXIT_REASON_EOI_INDUCED 45 |
| 72 |
#define EXIT_REASON_EPT_VIOLATION 48 |
| 73 |
#define EXIT_REASON_EPT_MISCONFIG 49 |
| 74 |
#define EXIT_REASON_INVEPT 50 |
| 75 |
#define EXIT_REASON_PREEMPTION_TIMER 52 |
| 76 |
#define EXIT_REASON_INVVPID 53 |
| 77 |
#define EXIT_REASON_WBINVD 54 |
| 78 |
#define EXIT_REASON_XSETBV 55 |
| 79 |
#define EXIT_REASON_APIC_WRITE 56 |
| 80 |
#define EXIT_REASON_INVPCID 58 |
| 81 |
|