perf/x86/amd/core: Fix reloading events for SVM
authorSandipan Das <sandipan.das@amd.com>
Wed, 18 May 2022 08:43:27 +0000 (14:13 +0530)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 19 May 2022 21:46:14 +0000 (23:46 +0200)
commitbae19fdd7e9e759580ac4693d2df3bc23ab415d7
tree3b8fd74796ec1f054c9000334682f32914b81a52
parent841b51e4a3590866d17fa2663c64688c25b891b1
perf/x86/amd/core: Fix reloading events for SVM

Commit 1018faa6cf23 ("perf/x86/kvm: Fix Host-Only/Guest-Only
counting with SVM disabled") addresses an issue in which the
Host-Only bit in the counter control registers needs to be
masked off when SVM is not enabled.

The events need to be reloaded whenever SVM is enabled or
disabled for a CPU and this requires the PERF_CTL registers
to be reprogrammed using {enable,disable}_all(). However,
PerfMonV2 variants of these functions do not reprogram the
PERF_CTL registers. Hence, the legacy enable_all() function
should also be called.

Fixes: 9622e67e3980 ("perf/x86/amd/core: Add PerfMonV2 counter control")
Reported-by: Like Xu <likexu@tencent.com>
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220518084327.464005-1-sandipan.das@amd.com
arch/x86/events/amd/core.c