Skip to content

Commit 8a15861

Browse files
committed
KVM: selftests: x86: Fix test failure on arch lbr capable platforms
jira LE-3201 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.30.1.rt7.371.el8_10 commit-author Yang Weijiang <weijiang.yang@intel.com> commit 825be3b 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> (cherry picked from commit 825be3b) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 786f730 commit 8a15861

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tools/testing/selftests/kvm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/xapic_state_test
7676
TEST_GEN_PROGS_x86_64 += x86_64/xss_msr_test
7777
TEST_GEN_PROGS_x86_64 += x86_64/debug_regs
7878
TEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test
79-
TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_msrs_test
79+
TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_caps_test
8080
TEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test
8181
TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test
8282
TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests

tools/testing/selftests/kvm/x86_64/vmx_pmu_msrs_test.c renamed to tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* VMX-pmu related msrs test
3+
* Test for VMX-pmu perf capability msr
44
*
55
* Copyright (C) 2021 Intel Corporation
66
*
7-
* Test to check the effect of various CPUID settings
8-
* on the MSR_IA32_PERF_CAPABILITIES MSR, and check that
9-
* whatever we write with KVM_SET_MSR is _not_ modified
10-
* in the guest and test it can be retrieved with KVM_GET_MSR.
11-
*
12-
* Test to check that invalid LBR formats are rejected.
7+
* Test to check the effect of various CPUID settings on
8+
* MSR_IA32_PERF_CAPABILITIES MSR, and check that what
9+
* we write with KVM_SET_MSR is _not_ modified by the guest
10+
* and check it can be retrieved with KVM_GET_MSR, also test
11+
* the invalid LBR formats are rejected.
1312
*/
1413

1514
#define _GNU_SOURCE /* for program_invocation_short_name */
@@ -107,8 +106,11 @@ int main(int argc, char *argv[])
107106
ASSERT_EQ(vcpu_get_msr(vm, VCPU_ID, MSR_IA32_PERF_CAPABILITIES), (u64)host_cap.lbr_format);
108107

109108
/* testcase 3, check invalid LBR format is rejected */
110-
ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, PMU_CAP_LBR_FMT);
109+
/* Note, on Arch LBR capable platforms, LBR_FMT in perf capability msr is 0x3f,
110+
* to avoid the failure, use a true invalid format 0x30 for the test. */
111+
ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, 0x30);
111112
TEST_ASSERT(ret == 0, "Bad PERF_CAPABILITIES didn't fail.");
112113

114+
printf("Completed perf capability tests.\n");
113115
kvm_vm_free(vm);
114116
}

0 commit comments

Comments
 (0)