aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/pmu.c
diff options
context:
space:
mode:
authorLike Xu <likexu@tencent.com>2022-04-11 18:19:44 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-08 04:48:16 -0400
commit968635abd5f5986f3cb6f15602d365cf1b551c5d (patch)
treeadef023fd2e68efe0e593c1a55e8f61aad158471 /arch/x86/kvm/pmu.c
parentKVM: x86/pmu: Disable guest PEBS temporarily in two rare situations (diff)
downloadlinux-dev-968635abd5f5986f3cb6f15602d365cf1b551c5d.tar.xz
linux-dev-968635abd5f5986f3cb6f15602d365cf1b551c5d.zip
KVM: x86/pmu: Add kvm_pmu_cap to optimize perf_get_x86_pmu_capability
The information obtained from the interface perf_get_x86_pmu_capability() doesn't change, so an exported "struct x86_pmu_capability" is introduced for all guests in the KVM, and it's initialized before hardware_setup(). Signed-off-by: Like Xu <likexu@tencent.com> Message-Id: <20220411101946.20262-16-likexu@tencent.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/pmu.c')
-rw-r--r--arch/x86/kvm/pmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 6e6898ef0011..a8f0618a5ebe 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -24,6 +24,9 @@
/* This is enough to filter the vast majority of currently defined events. */
#define KVM_PMU_EVENT_FILTER_MAX_EVENTS 300
+struct x86_pmu_capability __read_mostly kvm_pmu_cap;
+EXPORT_SYMBOL_GPL(kvm_pmu_cap);
+
/* NOTE:
* - Each perf counter is defined as "struct kvm_pmc";
* - There are two types of perf counters: general purpose (gp) and fixed.