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

[PATCH v2 3/3] x86/perfc: fold HVM's VM-exit counter arrays


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 5 Jan 2022 14:59:03 +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=oOtoJrYnwb+6pTq3iX76gcDNkqLaRj7Wk1Spp/mwh8I=; b=iekbL4HYjIXrxiVuYnR1xHRT8q09Ft+Pu8jGmG4T3ou52zOOMLldN7IXBzc/Doe0UaKIcF/t25i4qGDCTIsToLqWf4YP7v4ccqbDOTvgqpJlNvjjte9LOofZMlWi0ZpnNM9gXo5cAljyshAN8U1JmDIKwgb87/xONkVtCiCRdZb2J89jlXoPxdJkXLwNgpVCjgRKMuuvgxMWVn7VJZDCF8Wvw7Zo+p3WtW04mbXBOZpLBTTduSQtypWXa+2REFCD2DpVChenEVAd7HFLL/8CC0i2/26WQ1mvMRhH5M4jX08d+lDSk5EmEKakt7HIfHTBXP7o4E8+Q1ncbm7tqX4UFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WvmCoBWNuuSiestSOAgqxqBIzCySQ4gysDqAsNpNacQGFNQu/QFTDkXnx9EaWYJBS+9/Al0WiQQNMnaBDkS1S1ZP97+22PrJC/C7Vi+3eQEeBTMPcJK392NdFjuYCsg8BDZ1P38usqkBUB3wAlv1lOHHwlbV98z+iRm/Yf/5hZTm0VFmUhmHg8Fb1uhb3uFe502AOAZMz709X4vP6Izh5pwQwcuADmVPXnd5G/of5ykDczlaCjGtnQHxvR7unFhDFXKdkKQad5XiTGCPlnN5OO5bnDNvj+uC4gMsmFYXVXZjJyzgwr/lEMU10F/Bpb1JlDO+74T/qQn//0CdWJW7jw==
  • 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>
  • Delivery-date: Wed, 05 Jan 2022 13:59:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Only one of them can be in use at a time, so make the whole set union-
like. While doing the rename in SVM code, combine the two perf_incra(),
generalizing the range upwards of VMEXIT_NPF.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.

--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2644,7 +2644,10 @@ void svm_vmexit_handler(struct cpu_user_
         goto out;
     }
 
-    perfc_incra(svmexits, exit_reason);
+    perfc_incra(vmexits,
+                exit_reason < VMEXIT_NPF
+                ? exit_reason
+                : exit_reason - VMEXIT_NPF + VMEXIT_NPF_PERFC);
 
     hvm_maybe_deassert_evtchn_irq();
 
@@ -2973,7 +2976,6 @@ void svm_vmexit_handler(struct cpu_user_
         break;
 
     case VMEXIT_NPF:
-        perfc_incra(svmexits, VMEXIT_NPF_PERFC);
         if ( cpu_has_svm_decode )
             v->arch.hvm.svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         rc = vmcb->exitinfo1 & PFEC_page_present
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -7,13 +7,13 @@ PERFCOUNTER_ARRAY(exceptions,
 #ifdef CONFIG_HVM
 
 #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)
-
 #define VMEXIT_NPF_PERFC 143
 #define SVM_PERF_EXIT_REASON_SIZE (VMEXIT_NPF_PERFC + 1)
-PERFCOUNTER_ARRAY(svmexits,             "SVMexits", SVM_PERF_EXIT_REASON_SIZE)
+PERFCOUNTER_ARRAY(vmexits,              "vmexits",
+                  MAX(VMX_PERF_EXIT_REASON_SIZE, SVM_PERF_EXIT_REASON_SIZE))
+
+#define VMX_PERF_VECTOR_SIZE 0x20
+PERFCOUNTER_ARRAY(cause_vector,         "cause vector", VMX_PERF_VECTOR_SIZE)
 
 #endif /* CONFIG_HVM */
 




 


Rackspace

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