#
de1b03f2 |
|
08-Feb-2024 |
Thomas Huth <thuth@redhat.com> |
KVM: selftests: x86: Use TAP interface in the vmx_pmu_caps test Use the kvm_test_harness.h interface in this test to get TAP output, so that it is easier for the user to see what the test is doing. Signed-off-by: Thomas Huth <thuth@redhat.com> Link: https://lore.kernel.org/r/20240208204844.119326-8-thuth@redhat.com [sean: make host_cap static] Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
c85e9867 |
|
09-Jan-2024 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Add a helper to query if the PMU module param is enabled Add a helper to probe KVM's "enable_pmu" param, open coding strings in multiple places is just asking for false negatives and/or runtime errors due to typos. Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Tested-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Link: https://lore.kernel.org/r/20240109230250.424295-23-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
4d53dcc5 |
|
29-Nov-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Fix benign %llx vs. %lx issues in guest asserts Convert %llx to %lx as appropriate in guest asserts. The guest printf implementation treats them the same as KVM selftests are 64-bit only, but strictly adhering to the correct format will allow annotating the underlying helpers with __printf() without introducing new warnings in the build. Link: https://lore.kernel.org/r/20231129224916.532431-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
7ce7f8e7 |
|
28-Jul-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Rip out old, param-based guest assert macros Drop the param-based guest assert macros and enable the printf versions for all selftests. Note! This change can affect tests even if they don't use directly use guest asserts! E.g. via library code, or due to the compiler making different optimization decisions. Link: https://lore.kernel.org/r/20230729003643.1053367-33-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
30a6e0b4 |
|
28-Jul-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Convert VMX's PMU capabilities test to printf guest asserts Convert x86's VMX PMU capabilities test to use printf-based guest asserts. Opportunstically add a helper to do the WRMSR+assert so as to reduce the amount of copy+paste needed to spit out debug information. Link: https://lore.kernel.org/r/20230729003643.1053367-31-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
6d85f51a |
|
12-Jul-2023 |
Thomas Huth <thuth@redhat.com> |
KVM: selftests: Rename the ASSERT_EQ macro There is already an ASSERT_EQ macro in the file tools/testing/selftests/kselftest_harness.h, so currently KVM selftests can't include test_util.h from the KVM selftests together with that file. Rename the macro in the KVM selftests to TEST_ASSERT_EQ to avoid the problem - it is also more similar to the other macros in test_util.h that way. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Link: https://lore.kernel.org/r/20230712075910.22480-2-thuth@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
d8f992e9 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Verify LBRs are disabled if vPMU is disabled Verify that disabling the guest's vPMU via CPUID also disables LBRs. KVM has had at least one bug where LBRs would remain enabled even though the intent was to disable everything PMU related. Link: https://lore.kernel.org/r/20230311004618.920745-22-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
8b95b415 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Add negative testcase for PEBS format in PERF_CAPABILITIES Expand the immutable features sub-test for PERF_CAPABILITIES to verify KVM rejects any attempt to use a PEBS format other than the host's. Link: https://lore.kernel.org/r/20230311004618.920745-21-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
8ac2f774 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Refactor LBR_FMT test to avoid use of separate macro Rework the LBR format test to use the bitfield instead of a separate mask macro, mainly so that adding a nearly-identical PEBS format test doesn't have to copy-paste-tweak the macro too. No functional change intended. Link: https://lore.kernel.org/r/20230311004618.920745-20-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
bc7bb008 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Drop "all done!" printf() from PERF_CAPABILITIES test Drop the arbitrary "done" message from the VMX PMU caps test, it's pretty obvious the test is done when the process exits. Link: https://lore.kernel.org/r/20230311004618.920745-19-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
81fd9241 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Test post-KVM_RUN writes to PERF_CAPABILITIES Now that KVM disallows changing PERF_CAPABILITIES after KVM_RUN, expand the host side checks to verify KVM rejects any attempts to change bits from userspace. Link: https://lore.kernel.org/r/20230311004618.920745-18-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
baa36dac |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Expand negative testing of guest writes to PERF_CAPABILITIES Test that the guest can't write 0 to PERF_CAPABILITIES, can't write the current value, and can't toggle _any_ bits. There is no reason to special case the LBR format. Link: https://lore.kernel.org/r/20230311004618.920745-17-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
a2a34d14 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Test all immutable non-format bits in PERF_CAPABILITIES Add negative testing of all immutable bits in PERF_CAPABILITIES, i.e. single bits that are reserved-0 or are effectively reserved-1 by KVM. Omit LBR and PEBS format bits from the test as it's easier to test them manually than it is to add safeguards to the comment path, e.g. toggling a single bit can yield a format of '0', which is legal as a "disable" value. Link: https://lore.kernel.org/r/20230311004618.920745-16-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
37f4e79c |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Test all fungible features in PERF_CAPABILITIES Verify that userspace can set all fungible features in PERF_CAPABILITIES. Drop the now unused #define of the "full-width writes" flag. Link: https://lore.kernel.org/r/20230311004618.920745-15-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
69713940 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Drop now-redundant checks on PERF_CAPABILITIES writes Now that vcpu_set_msr() verifies the expected "read what was wrote" semantics of all durable MSRs, including PERF_CAPABILITIES, drop the now-redundant manual checks in the VMX PMU caps test. Link: https://lore.kernel.org/r/20230311004618.920745-14-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
b1b70562 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Assert that full-width PMC writes are supported if PDCM=1 KVM emulates full-width PMC writes in software, assert that KVM reports full-width writes as supported if PERF_CAPABILITIES is supported. Link: https://lore.kernel.org/r/20230311004618.920745-11-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
710fb612 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Move 0/initial value PERF_CAPS checks to dedicated sub-test Use a separate sub-test to verify userspace can clear PERF_CAPABILITIES and restore it to the KVM-supported value, as the testcase isn't unique to the LBR format. Link: https://lore.kernel.org/r/20230311004618.920745-10-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
e4d86fb9 |
|
10-Mar-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Split PMU caps sub-tests to avoid writing MSR after KVM_RUN Split the PERF_CAPABILITIES subtests into two parts so that the LBR format testcases don't execute after KVM_RUN. Similar to the guest CPUID model, KVM will soon disallow changing PERF_CAPABILITIES after KVM_RUN, at which point attempting to set the MSR after KVM_RUN will yield false positives and/or false negatives depending on what the test is trying to do. Land the LBR format test in a more generic "immutable features" test in anticipation of expanding its scope to other immutable features. Link: https://lore.kernel.org/r/20230311004618.920745-6-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
5b1abc28 |
|
13-Mar-2023 |
Like Xu <likexu@tencent.com> |
KVM: selftests: Report enable_pmu module value when test is skipped Running x86_64/pmu_event_filter_test or x86_64/vmx_pmu_caps_test with enable_pmu globally disabled will report the following into: 1..0 # SKIP - Requirement not met: use_intel_pmu() || use_amd_pmu() or 1..0 # SKIP - Requirement not met: kvm_cpu_has(X86_FEATURE_PDCM) this can be confusing, so add a check on kvm.enable_pmu. Signed-off-by: Like Xu <likexu@tencent.com> Link: https://lore.kernel.org/r/20230313085311.25327-3-likexu@tencent.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
4feb9d21 |
|
05-Oct-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Convert vmx_pmu_caps_test to use X86_PROPERTY_* Add X86_PROPERTY_PMU_VERSION and use it in vmx_pmu_caps_test to replace open coded versions of the same functionality. No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221006005125.680782-9-seanjc@google.com
|
#
9d27d461 |
|
04-Aug-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Test all possible "invalid" PERF_CAPABILITIES.LBR_FMT vals Test all possible input values to verify that KVM rejects all values except the exact host value. Due to the LBR format affecting the core functionality of LBRs, KVM can't emulate "other" formats, so even though there are a variety of legal values, KVM should reject anything but an exact host match. Suggested-by: Like Xu <like.xu.linux@gmail.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
446ab76a |
|
14-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Drop unnecessary use of kvm_get_supported_cpuid_index() Use kvm_get_supported_cpuid_entry() instead of kvm_get_supported_cpuid_index() when passing in '0' for the index, which just so happens to be the case in all remaining users of kvm_get_supported_cpuid_index() except kvm_get_supported_cpuid_entry(). Keep the helper as there may be users in the future, and it's not doing any harm. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-36-seanjc@google.com
|
#
813e38cd |
|
14-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Make get_supported_cpuid() returns "const" Tag the returned CPUID pointers from kvm_get_supported_cpuid(), kvm_get_supported_hv_cpuid(), and vcpu_get_supported_hv_cpuid() "const" to prevent reintroducing the broken pattern of modifying the static "cpuid" variable used by kvm_get_supported_cpuid() to cache the results of KVM_GET_SUPPORTED_CPUID. Update downstream consumers as needed. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-31-seanjc@google.com
|
#
50445ea2 |
|
14-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Drop redundant vcpu_set_cpuid() from PMU selftest Drop a redundant vcpu_set_cpuid() from the PMU test. The vCPU's CPUID is set to KVM's supported CPUID by vm_create_with_one_vcpu(), which was also true back when the helper was named vm_create_default(). Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-9-seanjc@google.com
|
#
ea129d22 |
|
14-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Use kvm_cpu_has() to query PDCM in PMU selftest Use kvm_cpu_has() in the PMU test to query PDCM support instead of open coding equivalent functionality using kvm_get_supported_cpuid_index(). No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-8-seanjc@google.com
|
#
7ed397d1 |
|
27-May-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Add TEST_REQUIRE macros to reduce skipping copy+paste Add TEST_REQUIRE() and __TEST_REQUIRE() to replace the myriad open coded instances of selftests exiting with KSFT_SKIP after printing an informational message. In addition to reducing the amount of boilerplate code in selftests, the UPPERCASE macro names make it easier to visually identify a test's requirements. Convert usage that erroneously uses something other than print_skip() and/or "exits" with '0' or some other non-KSFT_SKIP value. Intentionally drop a kvm_vm_free() in aarch64/debug-exceptions.c as part of the conversion. All memory and file descriptors are freed on process exit, so the explicit free is superfluous. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
768e9a61 |
|
02-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Purge vm+vcpu_id == vcpu silliness Take a vCPU directly instead of a VM+vcpu pair in all vCPU-scoped helpers and ioctls. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
d8b5b5d1 |
|
15-Feb-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Convert vmx_pmu_msrs_test away from VCPU_ID Convert vmx_pmu_msrs_test to use vm_create_with_one_vcpu() and pass around a 'struct kvm_vcpu' object instead of using a global VCPU_ID. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
825be3b5 |
|
12-May-2022 |
Yang Weijiang <weijiang.yang@intel.com> |
KVM: selftests: x86: Fix test failure on arch lbr capable platforms On Arch LBR capable platforms, LBR_FMT in perf capability msr is 0x3f, so the last format test will fail. Use a true invalid format(0x30) for the test if it's running on these platforms. Opportunistically change the file name to reflect the tests actually carried out. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Yang Weijiang <weijiang.yang@intel.com> Message-Id: <20220512084046.105479-1-weijiang.yang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|