> From: Beulich
> Sent: Wednesday, January 5, 2022 9:58 PM
> 
> 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 <jbeul...@suse.com>

Reviewed-by: Kevin Tian <kevin.t...@intel.com>

> ---
> v2: Use sentinel comment only.
> 
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3869,7 +3869,7 @@ void vmx_vmexit_handler(struct cpu_user_
>      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 )
> --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
> +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
> @@ -219,6 +219,7 @@ static inline void pi_clear_sn(struct pi
>  #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
> --- a/xen/arch/x86/include/asm/perfc_defn.h
> +++ b/xen/arch/x86/include/asm/perfc_defn.h
> @@ -6,7 +6,7 @@ PERFCOUNTER_ARRAY(exceptions,
> 
>  #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)
> 

Reply via email to