kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
	Michal Luczaj <mhal@rbox.co>
Subject: [kvm-unit-tests PATCH v3 7/7] x86/pmu: Run the "emulation" test iff forced emulation is available
Date: Mon,  8 Aug 2022 16:47:07 +0000	[thread overview]
Message-ID: <20220808164707.537067-8-seanjc@google.com> (raw)
In-Reply-To: <20220808164707.537067-1-seanjc@google.com>

Run the PMU's emulation testcase if and only if forced emulation is
available, and do so without requiring the user to manually specify they
want to run the emulation testcase.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/pmu.c         | 17 ++++++++---------
 x86/unittests.cfg |  7 -------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/x86/pmu.c b/x86/pmu.c
index 457c5b9..d59baf1 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -655,17 +655,16 @@ int main(int ac, char **av)
 
 	apic_write(APIC_LVTPC, PC_VECTOR);
 
-	if (ac > 1 && !strcmp(av[1], "emulation")) {
+	if (is_fep_available())
 		check_emulated_instr();
-	} else {
+
+	check_counters();
+
+	if (rdmsr(MSR_IA32_PERF_CAPABILITIES) & PMU_CAP_FW_WRITES) {
+		gp_counter_base = MSR_IA32_PMC0;
+		report_prefix_push("full-width writes");
 		check_counters();
-
-		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();
-		}
+		check_gp_counters_write_width();
 	}
 
 	return report_summary();
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 01d775e..ed65185 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -198,13 +198,6 @@ check = /sys/module/kvm/parameters/ignore_msrs=N
 check = /proc/sys/kernel/nmi_watchdog=0
 accel = kvm
 
-[pmu_emulation]
-file = pmu.flat
-arch = x86_64
-extra_params = -cpu max -append emulation
-check = /sys/module/kvm/parameters/force_emulation_prefix=Y
-accel = kvm
-
 [vmware_backdoors]
 file = vmware_backdoors.flat
 extra_params = -machine vmport=on -cpu max
-- 
2.37.1.559.g78731f0fdb-goog


  parent reply	other threads:[~2022-08-08 16:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 16:47 [kvm-unit-tests PATCH v3 0/7] x86: Illegal LEA test and FEP cleanups Sean Christopherson
2022-08-08 16:47 ` [kvm-unit-tests PATCH v3 1/7] x86: emulator.c: Save and restore exception handlers Sean Christopherson
2022-08-08 16:47 ` [kvm-unit-tests PATCH v3 2/7] x86: Dedup 32-bit vs. 64-bit ASM_TRY() by stealing kernel's __ASM_SEL() Sean Christopherson
2022-08-08 16:47 ` [kvm-unit-tests PATCH v3 3/7] x86: Introduce ASM_TRY_FEP() to handle exceptions on forced emulation Sean Christopherson
2022-08-08 16:47 ` [kvm-unit-tests PATCH v3 4/7] x86: Add helper to detect if forced emulation prefix is available Sean Christopherson
2022-08-08 16:47 ` [kvm-unit-tests PATCH v3 5/7] x86: emulator.c: Use ASM_TRY() for the UD_VECTOR cases Sean Christopherson
2022-08-08 16:47 ` [kvm-unit-tests PATCH v3 6/7] x86: Test emulator's handling of LEA with /reg Sean Christopherson
2022-08-08 16:47 ` Sean Christopherson [this message]
2022-08-10 19:06 ` [kvm-unit-tests PATCH v3 0/7] x86: Illegal LEA test and FEP cleanups Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220808164707.537067-8-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mhal@rbox.co \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).