Skip to contentSkip to conversation

xtf/vpmu VPMU tests

PATCH Superseded Mohit Gambhir 1 participant 4 messages Apr 24, 2017 x86

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover xtf/vpmu VPMU tests

This patch series adds tests to validate VPMU functionality on x86. The tests write and read PMU MSRs to make sure that that they have been exposed correctly.

The ultimate goal is to address security vulnerabilities, if any, that are vaguely mentioned in XSA-163 and make VPMU available to guests with reasonable caveats.

Further testing is required to validate the MSR state save/restore functionality of the VPMU, concurrent usage of the counters by a number of guests and analyze if any other non-PMU MSRs have been exposed incorrectly

Mohit Gambhir (2):
xtf/vpmu: Add Intel PMU MSR addresses
xtf/vpmu: MSR read/write tests for VPMU

 arch/x86/include/arch/msr-index.h |  11 +
 tests/vpmu/Makefile               |   9 +
 tests/vpmu/main.c                 | 504 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 524 insertions(+)
 create mode 100644 tests/vpmu/Makefile
 create mode 100644 tests/vpmu/main.c
Signature · 7 lines
2.9.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH v2 1/2 xtf/vpmu: Add Intel PMU MSR addresses

This patch adds Intel PMU MSR addresses as macros for VPMU testing

---
 arch/x86/include/arch/msr-index.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/x86/include/arch/msr-index.h +11 -0
index 2e90079..3a79025 100644
@@ -38,6 +38,17 @@
 #define MSR_GS_BASE                     0xc0000101
 #define MSR_SHADOW_GS_BASE              0xc0000102
 
+#define MSR_IA32_PMC(n)                 (0x000000c1 + (n))
+#define MSR_IA32_PERFEVTSEL(n)          (0x00000186 + (n))
+#define MSR_IA32_DEBUGCTL                0x000001d9
+#define MSR_IA32_FIXED_CTR(n)           (0x00000309 + (n))
+#define MSR_IA32_FIXED_CTR_CTRL          0x0000038d
+#define MSR_IA32_PERF_GLOBAL_CTRL        0x0000038f
+#define MSR_IA32_PERF_GLOBAL_STATUS      0x0000038e
+#define MSR_IA32_PERF_GLOBAL_OVF_CTRL    0x00000390
+#define MSR_IA32_PERF_CAPABILITIES       0x00000345
+#define MSR_IA32_A_PMC(n)               (0x000004c1 + (n))
+
 #endif /* XFT_X86_MSR_INDEX_H */
 
 /*
Signature · 7 lines
2.9.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v2 1/2][XTF] xtf/vpmu: Add Intel PMU MSR addresses

Quoted 14 lines · Mohit Gambhir

This patch adds Intel PMU MSR addresses as macros for VPMU testing

---
  arch/x86/include/arch/msr-index.h | 11 +++++++++++
  1 file changed, 11 insertions(+)
arch/x86/include/arch/msr-index.h +0 -0
index 2e90079..3a79025 100644
@@ -38,6 +38,17 @@
  #define MSR_GS_BASE                     0xc0000101
  #define MSR_SHADOW_GS_BASE              0xc0000102

arch/x86/include/arch/msr-index.h line 49

Quoted 10 lines
arch/x86/include/arch/msr-index.h +9 -0
 
+#define MSR_IA32_PMC(n)                 (0x000000c1 + (n))
+#define MSR_IA32_PERFEVTSEL(n)          (0x00000186 + (n))
+#define MSR_IA32_DEBUGCTL                0x000001d9
+#define MSR_IA32_FIXED_CTR(n)           (0x00000309 + (n))
+#define MSR_IA32_FIXED_CTR_CTRL          0x0000038d
+#define MSR_IA32_PERF_GLOBAL_CTRL        0x0000038f
+#define MSR_IA32_PERF_GLOBAL_STATUS      0x0000038e
+#define MSR_IA32_PERF_GLOBAL_OVF_CTRL    0x00000390
+#define MSR_IA32_PERF_CAPABILITIES       0x00000345

Seems I can not sort correctly. :( Will resend this patch.

arch/x86/include/arch/msr-index.h line 54

Quoted 5 lines
arch/x86/include/arch/msr-index.h +2 -0
+#define MSR_IA32_A_PMC(n)               (0x000004c1 + (n))
+
  #endif /* XFT_X86_MSR_INDEX_H */
 
  /*

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

PATCH v2 2/2 xtf/vpmu: MSR read/write tests for VPMU

In reply to Mohit Gambhir

This patch tests VPMU functionality in the hypervisor on Intel machines. The tests write to all valid bits in the MSRs that get exposed to the guests when VPMU is enabled. The tests also write invalid values to the bits that should be masked and expect the wrmsr call to fault.

The tests are currently unsupported for AMD machines and PV guests.

---
 tests/vpmu/Makefile |   9 +
 tests/vpmu/main.c   | 504 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 513 insertions(+)
 create mode 100644 tests/vpmu/Makefile
 create mode 100644 tests/vpmu/main.c
tests/vpmu/Makefile new file +9 -0
new file mode 100644
index 0000000..1eaf436
@@ -0,0 +1,9 @@
+include $(ROOT)/build/common.mk
+
+NAME      := vpmu
+CATEGORY  := utility
+TEST-ENVS := $(ALL_ENVIRONMENTS)
+
+obj-perenv += main.o
+
+include $(ROOT)/build/gen.mk
tests/vpmu/main.c new file +504 -0

504 lines not on this page · raw message

Signature · 7 lines
2.9.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel