[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/3] VMX: sync VM-exit perf counters with known VM-exit reasons


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 5 Jan 2022 14:57:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jfO6hMu+j+6AmU2LVFQtGR/ZVgz/9AB7/U+rI7fXn+I=; b=Pge43x3gUHvdCLY6ED7YWAthFDbY8SeAHSNpeqcYOSwuqVP3+Xe/CKaLso0h+jgoxS7EGKmXs3qM6dPN8RlUe02L66LytxZ8MGJGixfi5B4yeMJMAklXhnrnpMtAL81P41raDMV+HmipF+6jbI52/aiF4aSUjYrgJzip+eRpe9HcA5DRNyHl7EM2Y168/7DPZqjtiSznzyPYSmnLCE0dSFHXhH75pYhibp0LzfjeFS0YvOOygiJcz1qyOF44X0LDJkTnrhMU8d/A4MpdX8nEl5/LZnUPufII/9IqC2Ptj0UZBlS8ecaIJhWLXikVNIyOXHCAGQ9MbjK9qH+tU5jaXw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W3SpFfead0SkPqEqOEk3nfjGwuiCdjyZ0IrXVAy/hMVXbns4OSDWCdbvOaKJq17Lj8xhITJEYaXRm/El+395sDrNKRUQFlUgRUjDG5SGntX9GKycgTg25u82tp3FgCy1QfzEc2Q0e8q45niYAdZx+W/2RQm1xR303mxU6jG+GsW7o77MhFWvNWw02n5jP3K2FsR4PkIpZ3Q6+6QI+IwiVhPkIAQLqIGn2MiMOOKcIoDyAAtSaO7gztOp4oXcphlIvfisODGTgPqZ0vJ1E2wYCQND5tf+OmMHbCXqBbSKFprOXimlqftK8hB/PH9zp45apQntNJHm3hKb0X8SD/YFew==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>
  • Delivery-date: Wed, 05 Jan 2022 13:57:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <jbeulich@xxxxxxxx>
---
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)




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.