[PATCH kvm-unit-tests] pmu: fix conditions for emulation test

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

 



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@xxxxxxxxx>
Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 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




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux