public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] pmu: fix conditions for emulation test
@ 2021-11-16 10:50 Paolo Bonzini
  2021-11-16 17:49 ` Jim Mattson
  2022-02-12 23:45 ` Jim Mattson
  0 siblings, 2 replies; 6+ messages in thread
From: Paolo Bonzini @ 2021-11-16 10:50 UTC (permalink / raw)
  To: kvm; +Cc: jmattson, Like Xu

Right now, unittests.cfg only supports a single check line.  Multiple
checks must be space separated.

However, the pmu_emulation test does not really need nmi_watchdog=0;
it is only needed by the PMU counters test because Linux reserves one
counter if nmi_watchdog=1, but the pmu_emulation test does not
allocate all counters in the same way.  By removing the counters
tests from pmu_emulation, the check on nmi_watchdog=0 can be
removed.

This also hid a typo for the force_emulation_prefix module parameter,
which is part of the kvm module rather than the kvm_intel module,
so fix that.

Reported-by: Like Xu <like.xu.linux@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/pmu.c         | 17 +++++++++--------
 x86/unittests.cfg |  3 +--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/x86/pmu.c b/x86/pmu.c
index a159333..92206ad 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -638,16 +638,17 @@ int main(int ac, char **av)
 
 	apic_write(APIC_LVTPC, PC_VECTOR);
 
-	check_counters();
-
-	if (ac > 1 && !strcmp(av[1], "emulation"))
+	if (ac > 1 && !strcmp(av[1], "emulation")) {
 		check_emulated_instr();
-
-	if (rdmsr(MSR_IA32_PERF_CAPABILITIES) & PMU_CAP_FW_WRITES) {
-		gp_counter_base = MSR_IA32_PMC0;
-		report_prefix_push("full-width writes");
+	} else {
 		check_counters();
-		check_gp_counters_write_width();
+
+		if (rdmsr(MSR_IA32_PERF_CAPABILITIES) & PMU_CAP_FW_WRITES) {
+			gp_counter_base = MSR_IA32_PMC0;
+			report_prefix_push("full-width writes");
+			check_counters();
+			check_gp_counters_write_width();
+		}
 	}
 
 	return report_summary();
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 6585df4..27ecd31 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -189,8 +189,7 @@ check = /proc/sys/kernel/nmi_watchdog=0
 file = pmu.flat
 arch = x86_64
 extra_params = -cpu max -append emulation
-check = /sys/module/kvm_intel/parameters/force_emulation_prefix=Y
-check = /proc/sys/kernel/nmi_watchdog=0
+check = /sys/module/kvm/parameters/force_emulation_prefix=Y
 
 [vmware_backdoors]
 file = vmware_backdoors.flat
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-12 23:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-16 10:50 [PATCH kvm-unit-tests] pmu: fix conditions for emulation test Paolo Bonzini
2021-11-16 17:49 ` Jim Mattson
2021-11-16 18:03   ` Paolo Bonzini
2021-11-16 20:00     ` Jim Mattson
2021-11-17  2:49       ` Like Xu
2022-02-12 23:45 ` Jim Mattson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox