Skip to content

Commit 97d0d16

Browse files
coltonlewissean-jc
authored andcommitted
KVM: selftests: Fix typos in x86's PMU counter test's macro variable use
Fix goofs in PMU counter test's assertion macros where the macros unintentionally reference variables in the parent scope. The code "works" as-is purely by accident, as all users define a variable with the correct name (and usage). Fixes: cd34fd8 ("KVM: selftests: Test PMC virtualization with forced emulation") Signed-off-by: Colton Lewis <coltonlewis@google.com> Reviewed-by: Mingwei Zhang <mizhang@google.com> Link: https://lore.kernel.org/r/20240918205319.3517569-2-coltonlewis@google.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 10b2c8a commit 97d0d16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/kvm/x86/pmu_counters_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ do { \
174174

175175
#define GUEST_TEST_EVENT(_idx, _event, _pmc, _pmc_msr, _ctrl_msr, _value, FEP) \
176176
do { \
177-
wrmsr(pmc_msr, 0); \
177+
wrmsr(_pmc_msr, 0); \
178178
\
179179
if (this_cpu_has(X86_FEATURE_CLFLUSHOPT)) \
180180
GUEST_MEASURE_EVENT(_ctrl_msr, _value, "clflushopt .", FEP); \
@@ -331,9 +331,9 @@ __GUEST_ASSERT(expect_gp ? vector == GP_VECTOR : !vector, \
331331
expect_gp ? "#GP" : "no fault", msr, vector) \
332332

333333
#define GUEST_ASSERT_PMC_VALUE(insn, msr, val, expected) \
334-
__GUEST_ASSERT(val == expected_val, \
334+
__GUEST_ASSERT(val == expected, \
335335
"Expected " #insn "(0x%x) to yield 0x%lx, got 0x%lx", \
336-
msr, expected_val, val);
336+
msr, expected, val);
337337

338338
static void guest_test_rdpmc(uint32_t rdpmc_idx, bool expect_success,
339339
uint64_t expected_val)

0 commit comments

Comments
 (0)