Commit 97d0d165 authored by Colton Lewis's avatar Colton Lewis Committed by Sean Christopherson
Browse files

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: cd34fd8c ("KVM: selftests: Test PMC virtualization with forced emulation")
Signed-off-by: default avatarColton Lewis <coltonlewis@google.com>
Reviewed-by: default avatarMingwei Zhang <mizhang@google.com>
Link: https://lore.kernel.org/r/20240918205319.3517569-2-coltonlewis@google.com


[sean: massage changelog]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 10b2c8a6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ do { \

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

#define GUEST_ASSERT_PMC_VALUE(insn, msr, val, expected)			\
	__GUEST_ASSERT(val == expected_val,					\
	__GUEST_ASSERT(val == expected,					\
		       "Expected " #insn "(0x%x) to yield 0x%lx, got 0x%lx",	\
		       msr, expected_val, val);
		       msr, expected, val);

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