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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 3 Dec 2021 13:05:17 +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=Xbkw59rq1m1qExzkUUzR8dD75QHb9SESG2q0qwJbyuw=; b=Jd9M4bL3YxbFrizf0YJAzMlT70UZzNabBtL1VyLnGBkLzvL9gqft1h/OR7EapE21PphuH1P3DiWBxgQJlVg7c7NzCoVifhMhVjMNGIkMe4VhH5PB6TRiIfnRNM2zZq1fxHfvLbiCWqifok3ghM7X6YYjKUF8yk1admlBvQ4NNKz2/oIQ8NYpIIruuexdD3yI2zunK0Arspuq+rg9dq75i4xx55qFNog/9Hi953MzsPNU5jubk1+8tpYiGU5velAjP3FurJGi3dFOGShIFakZuTi4Zm8MVVjk1xv66WJcibf9p5eoy++5x68LSVtXVtXWllpGyDq6bsG8Aj/kkv1cVQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFkB0amN2zbx4hCmnZpBuluRFwAgHLjdVsE1haljjVLPHyXNE0SQc9IimNGldHAZ9sleuEgAWdz75I9UndAO1lYAZGek9+nt+IxBycZoCoj5siv6GkqoYEDE+BmEj9UUoQqH7gVzw4gEGmAOT8iV654DmT/pXNrnwwkxqgAkUi085KeFx2V2yQtQLd8xPN05VzxZJphNZA0VYw1l6mL2ySQa+NugsNPUfTQ0WkFe76zQ/gOpGFn9SbYgGJmWjkU7jjpvfw5jYPA2OnE9IJwxOfPiuUY+Czb/FX37sT8EvwpQVmh0Ch5chwueoinIKbl4P0ziZPlsQbAwUWbQnMR2Zg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 03 Dec 2021 12:05:28 +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.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
I wasn't sure about the #ifdef: Using CONFIG_PERF_COUNTERS there would
seem slightly odd next to a construct which specifically abstracts away
this aspect.

--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3869,7 +3869,10 @@ void vmx_vmexit_handler(struct cpu_user_
     else
         HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, exit_reason, regs->eip);
 
-    perfc_incra(vmexits, exit_reason);
+#ifdef VMX_PERF_EXIT_REASON_SIZE
+    BUILD_BUG_ON(VMX_PERF_EXIT_REASON_SIZE != EXIT_REASON_LAST + 1);
+#endif
+    perfc_incra(vmexits, (uint16_t)exit_reason);
 
     /* Handle the interrupt we missed before allowing any more in. */
     switch ( (uint16_t)exit_reason )
--- a/xen/include/asm-x86/hvm/vmx/vmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -220,6 +220,8 @@ static inline void pi_clear_sn(struct pi
 #define EXIT_REASON_XSAVES              63
 #define EXIT_REASON_XRSTORS             64
 
+#define EXIT_REASON_LAST                EXIT_REASON_XRSTORS
+
 /*
  * Interruption-information format
  */
--- a/xen/include/asm-x86/perfc_defn.h
+++ b/xen/include/asm-x86/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®.