diff mbox series

[kvm-unit-test,3/3] x86/pmu: Execute PEBS test only if PEBSRecordFormat >= 4

Message ID 20241118225207.16596-3-zide.chen@intel.com (mailing list archive)
State New
Headers show
Series [kvm-unit-test,1/3] nVMX: fixed-function performance counters could be not contiguous | expand

Commit Message

Zide Chen Nov. 18, 2024, 10:52 p.m. UTC
Before adaptive PEBS v4, the PEBS record format is not determined by
MSR_PEBS_DATA_CFG, but by IA32_PERF_CAPABILITIES.PEBS_FMT[11:8] (< 4),
which is not covered by this unit test.

We don't want additional implementation to support such legacy
platforms, instead, we can exclude them from the test to avoid test
failures.

Technically, it seems checking IA32_PERF_CAPABILITIES.PEBS_BASELINE[14]
is more reasonable.  But this bit is not exposed to the guest in the
current KVM emulated vPMU implementation, and if we use it as a filter,
it will filter out all platforms.

Signed-off-by: Zide Chen <zide.chen@intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
 x86/pmu_pebs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/x86/pmu_pebs.c b/x86/pmu_pebs.c
index 6b4a5ed3b91e..6396d51c6b49 100644
--- a/x86/pmu_pebs.c
+++ b/x86/pmu_pebs.c
@@ -404,8 +404,8 @@  int main(int ac, char **av)
 	} else if (!pmu_has_pebs()) {
 		report_skip("PEBS required PMU version 2, reported version is %d", pmu.version);
 		return report_summary();
-	} else if (!pmu_pebs_format()) {
-		report_skip("PEBS not enumerated in PERF_CAPABILITIES");
+	} else if (pmu_pebs_format() < 4) {
+		report_skip("This test supports PEBS_Record_Format >= 4 only");
 		return report_summary();
 	} else if (rdmsr(MSR_IA32_MISC_ENABLE) & MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL) {
 		report_skip("PEBS unavailable according to MISC_ENABLE");