Skip to content

Commit

Permalink
VMX: sync VM-exit perf counters with known VM-exit reasons
Browse files Browse the repository at this point in the history
This has gone out of sync over time. Introduce a simplistic mechanism to
hopefully keep things in sync going forward.

Also limit the array index to just the "basic exit reason" part, which is
what the pseudo-enumeration covers.

Signed-off-by: Jan Beulich <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
  • Loading branch information
jbeulich committed Jan 31, 2022
1 parent 21170a7 commit c5539e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xen/arch/x86/hvm/vmx/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3928,7 +3928,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
else
HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, exit_reason, regs->eip);

perfc_incra(vmexits, exit_reason);
perfc_incra(vmexits, (uint16_t)exit_reason);

/* Handle the interrupt we missed before allowing any more in. */
switch ( (uint16_t)exit_reason )
Expand Down
1 change: 1 addition & 0 deletions xen/arch/x86/include/asm/hvm/vmx/vmx.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
#define EXIT_REASON_PML_FULL 62
#define EXIT_REASON_XSAVES 63
#define EXIT_REASON_XRSTORS 64
/* Remember to also update VMX_PERF_EXIT_REASON_SIZE! */

/*
* Interruption-information format
Expand Down
2 changes: 1 addition & 1 deletion xen/arch/x86/include/asm/perfc_defn.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PERFCOUNTER_ARRAY(exceptions, "exceptions", 32)

#ifdef CONFIG_HVM

#define VMX_PERF_EXIT_REASON_SIZE 56
#define VMX_PERF_EXIT_REASON_SIZE 65
#define VMX_PERF_VECTOR_SIZE 0x20
PERFCOUNTER_ARRAY(vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE)
PERFCOUNTER_ARRAY(cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE)
Expand Down

0 comments on commit c5539e6

Please sign in to comment.