Message ID | 20240813164244.751597-2-coltonlewis@google.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Extend pmu_counters_test to AMD CPUs | expand |
On Tue, Aug 13, 2024, Colton Lewis wrote: > Without the leading underscore, these variables are referencing a > variable in the calling scope. It only worked before by accident > because all calling scopes had a variable with the right name. > > Signed-off-by: Colton Lewis <coltonlewis@google.com> This might need a fixes tag, right? Fixes: cd34fd8c758e ("KVM: selftests: Test PMC virtualization with forced emulation") no need to cc stable tree though, since this is very minor. Reviewed-by: Mingwei Zhang <mizhang@google.com> > --- > tools/testing/selftests/kvm/x86_64/pmu_counters_test.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c b/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c > index 698cb36989db..0e305e43a93b 100644 > --- a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c > +++ b/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c > @@ -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) > -- > 2.46.0.76.ge559c4bf1a-goog >
diff --git a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c b/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c index 698cb36989db..0e305e43a93b 100644 --- a/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c +++ b/tools/testing/selftests/kvm/x86_64/pmu_counters_test.c @@ -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)
Without the leading underscore, these variables are referencing a variable in the calling scope. It only worked before by accident because all calling scopes had a variable with the right name. Signed-off-by: Colton Lewis <coltonlewis@google.com> --- tools/testing/selftests/kvm/x86_64/pmu_counters_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)