tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace

Message ID tencent_00082C8BFA925A65E11570F417F1CD404505@qq.com
State New
Headers
Series tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace |

Commit Message

Rong Tao Nov. 7, 2022, 2:52 p.m. UTC
  From: Rong Tao <rongtao@cestc.cn>

Update EXIT_REASONS from source, including VMX_EXIT_REASONS,
SVM_EXIT_REASONS, AARCH64_EXIT_REASONS, USERSPACE_EXIT_REASONS.

Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
 tools/kvm/kvm_stat/kvm_stat | 96 +++++++++++++++++++++++++++++++------
 1 file changed, 82 insertions(+), 14 deletions(-)
  

Comments

Paolo Bonzini Nov. 7, 2022, 3:45 p.m. UTC | #1
On 11/7/22 15:52, Rong Tao wrote:
> From: Rong Tao <rongtao@cestc.cn>
> 
> Update EXIT_REASONS from source, including VMX_EXIT_REASONS,
> SVM_EXIT_REASONS, AARCH64_EXIT_REASONS, USERSPACE_EXIT_REASONS.
> 
> Signed-off-by: Rong Tao <rongtao@cestc.cn>
> ---
>   tools/kvm/kvm_stat/kvm_stat | 96 +++++++++++++++++++++++++++++++------
>   1 file changed, 82 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
> index 9c366b3a676d..a34b781a3ce8 100755
> --- a/tools/kvm/kvm_stat/kvm_stat
> +++ b/tools/kvm/kvm_stat/kvm_stat
> @@ -41,11 +41,14 @@ VMX_EXIT_REASONS = {
>       'EXCEPTION_NMI':        0,
>       'EXTERNAL_INTERRUPT':   1,
>       'TRIPLE_FAULT':         2,
> -    'PENDING_INTERRUPT':    7,
> +    'INIT_SIGNAL':          3,
> +    'SIPI_SIGNAL':          4,
> +    'INTERRUPT_WINDOW':     7,
>       'NMI_WINDOW':           8,
>       'TASK_SWITCH':          9,
>       'CPUID':                10,
>       'HLT':                  12,
> +    'INVD':                 13,
>       'INVLPG':               14,
>       'RDPMC':                15,
>       'RDTSC':                16,
> @@ -65,26 +68,48 @@ VMX_EXIT_REASONS = {
>       'MSR_READ':             31,
>       'MSR_WRITE':            32,
>       'INVALID_STATE':        33,
> +    'MSR_LOAD_FAIL':        34,
>       'MWAIT_INSTRUCTION':    36,
> +    'MONITOR_TRAP_FLAG':    37,
>       'MONITOR_INSTRUCTION':  39,
>       'PAUSE_INSTRUCTION':    40,
>       'MCE_DURING_VMENTRY':   41,
>       'TPR_BELOW_THRESHOLD':  43,
>       'APIC_ACCESS':          44,
> +    'EOI_INDUCED':          45,
> +    'GDTR_IDTR':            46,
> +    'LDTR_TR':              47,
>       'EPT_VIOLATION':        48,
>       'EPT_MISCONFIG':        49,
> +    'INVEPT':               50,
> +    'RDTSCP':               51,
> +    'PREEMPTION_TIMER':     52,
> +    'INVVPID':              53,
>       'WBINVD':               54,
>       'XSETBV':               55,
>       'APIC_WRITE':           56,
> +    'RDRAND':               57,
>       'INVPCID':              58,
> +    'VMFUNC':               59,
> +    'ENCLS':                60,
> +    'RDSEED':               61,
> +    'PML_FULL':             62,
> +    'XSAVES':               63,
> +    'XRSTORS':              64,
> +    'UMWAIT':               67,
> +    'TPAUSE':               68,
> +    'BUS_LOCK':             74,
> +    'NOTIFY':               75,
>   }
>   
>   SVM_EXIT_REASONS = {
>       'READ_CR0':       0x000,
> +    'READ_CR2':       0x002,
>       'READ_CR3':       0x003,
>       'READ_CR4':       0x004,
>       'READ_CR8':       0x008,
>       'WRITE_CR0':      0x010,
> +    'WRITE_CR2':      0x012,
>       'WRITE_CR3':      0x013,
>       'WRITE_CR4':      0x014,
>       'WRITE_CR8':      0x018,
> @@ -105,6 +130,7 @@ SVM_EXIT_REASONS = {
>       'WRITE_DR6':      0x036,
>       'WRITE_DR7':      0x037,
>       'EXCP_BASE':      0x040,
> +    'LAST_EXCP':      0x05f,
>       'INTR':           0x060,
>       'NMI':            0x061,
>       'SMI':            0x062,
> @@ -151,21 +177,45 @@ SVM_EXIT_REASONS = {
>       'MWAIT':          0x08b,
>       'MWAIT_COND':     0x08c,
>       'XSETBV':         0x08d,
> +    'RDPRU':          0x08e,
> +    'EFER_WRITE_TRAP':           0x08f,
> +    'CR0_WRITE_TRAP':            0x090,
> +    'CR1_WRITE_TRAP':            0x091,
> +    'CR2_WRITE_TRAP':            0x092,
> +    'CR3_WRITE_TRAP':            0x093,
> +    'CR4_WRITE_TRAP':            0x094,
> +    'CR5_WRITE_TRAP':            0x095,
> +    'CR6_WRITE_TRAP':            0x096,
> +    'CR7_WRITE_TRAP':            0x097,
> +    'CR8_WRITE_TRAP':            0x098,
> +    'CR9_WRITE_TRAP':            0x099,
> +    'CR10_WRITE_TRAP':           0x09a,
> +    'CR11_WRITE_TRAP':           0x09b,
> +    'CR12_WRITE_TRAP':           0x09c,
> +    'CR13_WRITE_TRAP':           0x09d,
> +    'CR14_WRITE_TRAP':           0x09e,
> +    'CR15_WRITE_TRAP':           0x09f,
> +    'INVPCID':        0x0a2,
>       'NPF':            0x400,
> +    'AVIC_INCOMPLETE_IPI':       0x401,
> +    'AVIC_UNACCELERATED_ACCESS': 0x402,
> +    'VMGEXIT':        0x403,
>   }
>   
> -# EC definition of HSR (from arch/arm64/include/asm/kvm_arm.h)
> +# EC definition of HSR (from arch/arm64/include/asm/esr.h)
>   AARCH64_EXIT_REASONS = {
>       'UNKNOWN':      0x00,
> -    'WFI':          0x01,
> +    'WFx':          0x01,
>       'CP15_32':      0x03,
>       'CP15_64':      0x04,
>       'CP14_MR':      0x05,
>       'CP14_LS':      0x06,
>       'FP_ASIMD':     0x07,
>       'CP10_ID':      0x08,
> +    'PAC':          0x09,
>       'CP14_64':      0x0C,
> -    'ILL_ISS':      0x0E,
> +    'BTI':          0x0D,
> +    'ILL':          0x0E,
>       'SVC32':        0x11,
>       'HVC32':        0x12,
>       'SMC32':        0x13,
> @@ -173,21 +223,26 @@ AARCH64_EXIT_REASONS = {
>       'HVC64':        0x16,
>       'SMC64':        0x17,
>       'SYS64':        0x18,
> -    'IABT':         0x20,
> -    'IABT_HYP':     0x21,
> +    'SVE':          0x19,
> +    'ERET':         0x1A,
> +    'FPAC':         0x1C,
> +    'SME':          0x1D,
> +    'IMP_DEF':      0x1F,
> +    'IABT_LOW':     0x20,
> +    'IABT_CUR':     0x21,
>       'PC_ALIGN':     0x22,
> -    'DABT':         0x24,
> -    'DABT_HYP':     0x25,
> +    'DABT_LOW':     0x24,
> +    'DABT_CUR':     0x25,
>       'SP_ALIGN':     0x26,
>       'FP_EXC32':     0x28,
>       'FP_EXC64':     0x2C,
>       'SERROR':       0x2F,
> -    'BREAKPT':      0x30,
> -    'BREAKPT_HYP':  0x31,
> -    'SOFTSTP':      0x32,
> -    'SOFTSTP_HYP':  0x33,
> -    'WATCHPT':      0x34,
> -    'WATCHPT_HYP':  0x35,
> +    'BREAKPT_LOW':  0x30,
> +    'BREAKPT_CUR':  0x31,
> +    'SOFTSTP_LOW':  0x32,
> +    'SOFTSTP_CUR':  0x33,
> +    'WATCHPT_LOW':  0x34,
> +    'WATCHPT_CUR':  0x35,
>       'BKPT32':       0x38,
>       'VECTOR32':     0x3A,
>       'BRK64':        0x3C,
> @@ -220,6 +275,19 @@ USERSPACE_EXIT_REASONS = {
>       'S390_TSCH':        22,
>       'EPR':              23,
>       'SYSTEM_EVENT':     24,
> +    'S390_STSI':        25,
> +    'IOAPIC_EOI':       26,
> +    'HYPERV':           27,
> +    'ARM_NISV':         28,
> +    'X86_RDMSR':        29,
> +    'X86_WRMSR':        30,
> +    'DIRTY_RING_FULL':  31,
> +    'AP_RESET_HOLD':    32,
> +    'X86_BUS_LOCK':     33,
> +    'XEN':              34,
> +    'RISCV_SBI':        35,
> +    'RISCV_CSR':        36,
> +    'NOTIFY':           37,
>   }
>   
>   IOCTL_NUMBERS = {

Queued, thanks.

Paolo
  

Patch

diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 9c366b3a676d..a34b781a3ce8 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -41,11 +41,14 @@  VMX_EXIT_REASONS = {
     'EXCEPTION_NMI':        0,
     'EXTERNAL_INTERRUPT':   1,
     'TRIPLE_FAULT':         2,
-    'PENDING_INTERRUPT':    7,
+    'INIT_SIGNAL':          3,
+    'SIPI_SIGNAL':          4,
+    'INTERRUPT_WINDOW':     7,
     'NMI_WINDOW':           8,
     'TASK_SWITCH':          9,
     'CPUID':                10,
     'HLT':                  12,
+    'INVD':                 13,
     'INVLPG':               14,
     'RDPMC':                15,
     'RDTSC':                16,
@@ -65,26 +68,48 @@  VMX_EXIT_REASONS = {
     'MSR_READ':             31,
     'MSR_WRITE':            32,
     'INVALID_STATE':        33,
+    'MSR_LOAD_FAIL':        34,
     'MWAIT_INSTRUCTION':    36,
+    'MONITOR_TRAP_FLAG':    37,
     'MONITOR_INSTRUCTION':  39,
     'PAUSE_INSTRUCTION':    40,
     'MCE_DURING_VMENTRY':   41,
     'TPR_BELOW_THRESHOLD':  43,
     'APIC_ACCESS':          44,
+    'EOI_INDUCED':          45,
+    'GDTR_IDTR':            46,
+    'LDTR_TR':              47,
     'EPT_VIOLATION':        48,
     'EPT_MISCONFIG':        49,
+    'INVEPT':               50,
+    'RDTSCP':               51,
+    'PREEMPTION_TIMER':     52,
+    'INVVPID':              53,
     'WBINVD':               54,
     'XSETBV':               55,
     'APIC_WRITE':           56,
+    'RDRAND':               57,
     'INVPCID':              58,
+    'VMFUNC':               59,
+    'ENCLS':                60,
+    'RDSEED':               61,
+    'PML_FULL':             62,
+    'XSAVES':               63,
+    'XRSTORS':              64,
+    'UMWAIT':               67,
+    'TPAUSE':               68,
+    'BUS_LOCK':             74,
+    'NOTIFY':               75,
 }
 
 SVM_EXIT_REASONS = {
     'READ_CR0':       0x000,
+    'READ_CR2':       0x002,
     'READ_CR3':       0x003,
     'READ_CR4':       0x004,
     'READ_CR8':       0x008,
     'WRITE_CR0':      0x010,
+    'WRITE_CR2':      0x012,
     'WRITE_CR3':      0x013,
     'WRITE_CR4':      0x014,
     'WRITE_CR8':      0x018,
@@ -105,6 +130,7 @@  SVM_EXIT_REASONS = {
     'WRITE_DR6':      0x036,
     'WRITE_DR7':      0x037,
     'EXCP_BASE':      0x040,
+    'LAST_EXCP':      0x05f,
     'INTR':           0x060,
     'NMI':            0x061,
     'SMI':            0x062,
@@ -151,21 +177,45 @@  SVM_EXIT_REASONS = {
     'MWAIT':          0x08b,
     'MWAIT_COND':     0x08c,
     'XSETBV':         0x08d,
+    'RDPRU':          0x08e,
+    'EFER_WRITE_TRAP':           0x08f,
+    'CR0_WRITE_TRAP':            0x090,
+    'CR1_WRITE_TRAP':            0x091,
+    'CR2_WRITE_TRAP':            0x092,
+    'CR3_WRITE_TRAP':            0x093,
+    'CR4_WRITE_TRAP':            0x094,
+    'CR5_WRITE_TRAP':            0x095,
+    'CR6_WRITE_TRAP':            0x096,
+    'CR7_WRITE_TRAP':            0x097,
+    'CR8_WRITE_TRAP':            0x098,
+    'CR9_WRITE_TRAP':            0x099,
+    'CR10_WRITE_TRAP':           0x09a,
+    'CR11_WRITE_TRAP':           0x09b,
+    'CR12_WRITE_TRAP':           0x09c,
+    'CR13_WRITE_TRAP':           0x09d,
+    'CR14_WRITE_TRAP':           0x09e,
+    'CR15_WRITE_TRAP':           0x09f,
+    'INVPCID':        0x0a2,
     'NPF':            0x400,
+    'AVIC_INCOMPLETE_IPI':       0x401,
+    'AVIC_UNACCELERATED_ACCESS': 0x402,
+    'VMGEXIT':        0x403,
 }
 
-# EC definition of HSR (from arch/arm64/include/asm/kvm_arm.h)
+# EC definition of HSR (from arch/arm64/include/asm/esr.h)
 AARCH64_EXIT_REASONS = {
     'UNKNOWN':      0x00,
-    'WFI':          0x01,
+    'WFx':          0x01,
     'CP15_32':      0x03,
     'CP15_64':      0x04,
     'CP14_MR':      0x05,
     'CP14_LS':      0x06,
     'FP_ASIMD':     0x07,
     'CP10_ID':      0x08,
+    'PAC':          0x09,
     'CP14_64':      0x0C,
-    'ILL_ISS':      0x0E,
+    'BTI':          0x0D,
+    'ILL':          0x0E,
     'SVC32':        0x11,
     'HVC32':        0x12,
     'SMC32':        0x13,
@@ -173,21 +223,26 @@  AARCH64_EXIT_REASONS = {
     'HVC64':        0x16,
     'SMC64':        0x17,
     'SYS64':        0x18,
-    'IABT':         0x20,
-    'IABT_HYP':     0x21,
+    'SVE':          0x19,
+    'ERET':         0x1A,
+    'FPAC':         0x1C,
+    'SME':          0x1D,
+    'IMP_DEF':      0x1F,
+    'IABT_LOW':     0x20,
+    'IABT_CUR':     0x21,
     'PC_ALIGN':     0x22,
-    'DABT':         0x24,
-    'DABT_HYP':     0x25,
+    'DABT_LOW':     0x24,
+    'DABT_CUR':     0x25,
     'SP_ALIGN':     0x26,
     'FP_EXC32':     0x28,
     'FP_EXC64':     0x2C,
     'SERROR':       0x2F,
-    'BREAKPT':      0x30,
-    'BREAKPT_HYP':  0x31,
-    'SOFTSTP':      0x32,
-    'SOFTSTP_HYP':  0x33,
-    'WATCHPT':      0x34,
-    'WATCHPT_HYP':  0x35,
+    'BREAKPT_LOW':  0x30,
+    'BREAKPT_CUR':  0x31,
+    'SOFTSTP_LOW':  0x32,
+    'SOFTSTP_CUR':  0x33,
+    'WATCHPT_LOW':  0x34,
+    'WATCHPT_CUR':  0x35,
     'BKPT32':       0x38,
     'VECTOR32':     0x3A,
     'BRK64':        0x3C,
@@ -220,6 +275,19 @@  USERSPACE_EXIT_REASONS = {
     'S390_TSCH':        22,
     'EPR':              23,
     'SYSTEM_EVENT':     24,
+    'S390_STSI':        25,
+    'IOAPIC_EOI':       26,
+    'HYPERV':           27,
+    'ARM_NISV':         28,
+    'X86_RDMSR':        29,
+    'X86_WRMSR':        30,
+    'DIRTY_RING_FULL':  31,
+    'AP_RESET_HOLD':    32,
+    'X86_BUS_LOCK':     33,
+    'XEN':              34,
+    'RISCV_SBI':        35,
+    'RISCV_CSR':        36,
+    'NOTIFY':           37,
 }
 
 IOCTL_NUMBERS = {