Skip to content

KVM: x86/pmu: Fix out-of-date AMD amd_event_mapping[]

Like Xu kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 40 repliesIn review

Changes in v2 from the cover letter

- Drop some merged patches and one misunderstood patch;
- Rename bitmap name from "avail_cpuid_events" to "avail_perf_hw_ids";
- Fix kernel test robot() compiler warning;

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: x86/pmu: Replace pmu->available_event_types with a new BITMAParch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/pmu_intel.c+34 -81 reply
2/3perf: x86/core: Add interface to query perfmon_event_map[] directlyarch/x86/events/core.c arch/x86/include/asm/perf_event.h+11 -036 replies
3/3KVM: x86/pmu: Setup the {inte|amd}_event_mapping[] when hardware_setuparch/x86/kvm/pmu.c arch/x86/kvm/pmu.h arch/x86/kvm/svm/pmu.c +2 more+45 -402 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH kvm/queue v2 0/3] KVM: x86/pmu: Fix out-of-date AMD amd_event_mapping[]

The current amd_event_mapping[] named "amd_perfmon_event_map" is only valid for "K7 and later, up to and including Family 16h" but for AMD "Family 17h and later", it needs amd_f17h_perfmon_event_mapp[] .

It's proposed to fix it in a more generic approach:
- decouple the available_event_types from the CPUID 0x0A.EBX bit vector;
- alway get the right perfmon_event_map[] form the hoser perf interface;
- dynamically populate {inte|amd}_event_mapping[] during hardware setup;

v1 -> v2 Changelog:
- Drop some merged patches and one misunderstood patch;
- Rename bitmap name from "avail_cpuid_events" to "avail_perf_hw_ids";
- Fix kernel test robot() compiler warning;

Previous:
https://lore.kernel.org/kvm/[email protected]/

Like Xu (3):
KVM: x86/pmu: Replace pmu->available_event_types with a new BITMAP
perf: x86/core: Add interface to query perfmon_event_map[] directly
KVM: x86/pmu: Setup the {inte|amd}_event_mapping[] when hardware_setup

 arch/x86/events/core.c            |  9 ++++
 arch/x86/include/asm/kvm_host.h   |  2 +-
 arch/x86/include/asm/perf_event.h |  2 +
 arch/x86/kvm/pmu.c                | 25 ++++++++++-
 arch/x86/kvm/pmu.h                |  2 +
 arch/x86/kvm/svm/pmu.c            | 23 ++--------
 arch/x86/kvm/vmx/pmu_intel.c      | 72 ++++++++++++++++++++-----------
 arch/x86/kvm/x86.c                |  1 +
 8 files changed, 89 insertions(+), 47 deletions(-)
Signature · 1 line
2.33.1