KVM: selftests: Copy full counter values from guest in PMU event filter test
authorSean Christopherson <seanjc@google.com>
Fri, 7 Apr 2023 23:32:53 +0000 (16:32 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 14 Apr 2023 20:21:32 +0000 (13:21 -0700)
commite9f322bd23960026275014477e21f7a9445fd926
treeec826f1216c65d0710160ac30f39109119a48273
parentc02c74428288282c9bd5fd37fe4135f3ca419a86
KVM: selftests: Copy full counter values from guest in PMU event filter test

Use a single struct to track all PMC event counts in the PMU filter test,
and copy the full struct to/from the guest when running and measuring each
guest workload.  Using a common struct avoids naming conflicts, e.g. the
loads/stores testcase has claimed "perf_counter", and eliminates the
unnecessary truncation of the counter values when they are propagated from
the guest MSRs to the host structs.

Zero the struct before running the guest workload to ensure that the test
doesn't get a false pass due to consuming data from a previous run.

Link: https://lore.kernel.org/r/20230407233254.957013-6-seanjc@google.com
Reviewed by: Aaron Lewis <aaronlewis@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c