Skip to content

PEBS virtualization enabling via DS

Luwei Kang kvm lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11perf/x86/core: Support KVM to assign a dedicated counter for guest PEBSarch/x86/events/intel/core.c arch/x86/events/perf_event.h include/linux/perf_event.h +1 more+63 -113 replies
2/11perf/x86/ds: Handle guest PEBS events overflow and inject fake PMIarch/x86/events/intel/ds.c+59 -00 replies
3/11perf/x86: Expose a function to disable auto-reloadarch/x86/events/intel/core.c arch/x86/include/asm/perf_event.h+16 -00 replies
4/11KVM: x86/pmu: Decouple event enablement from event creationarch/x86/kvm/pmu.c+2 -00 replies
5/11KVM: x86/pmu: Add support to reprogram PEBS event for guest countersarch/x86/include/asm/kvm_host.h arch/x86/kvm/pmu.c arch/x86/kvm/vmx/pmu_intel.c+70 -11 reply
6/11KVM: x86/pmu: Implement is_pebs_via_ds_supported pmu opsarch/x86/kvm/pmu.h arch/x86/kvm/vmx/pmu_intel.c+19 -00 replies
7/11KVM: x86/pmu: Expose CPUIDs feature bits PDCM, DS, DTES64arch/x86/include/asm/kvm_host.h arch/x86/kvm/cpuid.c arch/x86/kvm/svm.c +2 more+39 -30 replies
8/11KVM: x86/pmu: PEBS MSRs emulationarch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/pmu_intel.c arch/x86/kvm/vmx/vmx.c +2 more+62 -20 replies
9/11KVM: x86/pmu: Expose PEBS feature to guestarch/x86/include/asm/kvm_host.h arch/x86/include/asm/msr-index.h arch/x86/kvm/vmx/pmu_intel.c +1 more+24 -10 replies
10/11KVM: x86/pmu: Introduce the mask value for fixed counterarch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/pmu_intel.c+7 -10 replies
11/11KVM: x86/pmu: Adaptive PEBS virtualization enablingarch/x86/include/asm/kvm_host.h arch/x86/include/asm/msr-index.h arch/x86/kvm/pmu.h +2 more+55 -20 replies

Reviews trailers per patch

None of the 11 patches has a Reviewed-by or Acked-by.

PatchAndi Kleen
1/11Originally-by
2/11Originally-by
3/11
4/11
5/11Originally-by
6/11Originally-by
7/11Originally-by
8/11Originally-by
9/11Originally-by
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 00/11] PEBS virtualization enabling via DS

The Processor Event-Based Sampling(PEBS) supported on mainstream Intel platforms can provide an architectural state of the instruction executed after the instruction that caused the event. This patchset is going to enable PEBS feature via DS on KVM for the Icelake server. Although PEBS via DS supports EPT violations feature is supported starting Skylake Server, but we have to pin DS area to avoid losing PEBS records due to some issues.

BTW:
The PEBS virtualization via Intel PT patchset V1 has been posted out and the later version will base on this patchset.
https://lkml.kernel.org/r/[email protected]/

Testing:
The guest can use PEBS feature like native. e.g.

# perf record -e instructions:ppp ./br_instr a

perf report on guest:
# Samples: 2K of event 'instructions:ppp', # Event count (approx.): 1473377250
# Overhead Command Shared Object Symbol

  57.74%  br_instr  br_instr           [.] lfsr_cond
  41.40%  br_instr  br_instr           [.] cmp_end
   0.21%  br_instr  [kernel.kallsyms]  [k] __lock_acquire

perf report on host:
# Samples: 2K of event 'instructions:ppp', # Event count (approx.): 1462721386
# Overhead Command Shared Object Symbol

  57.90%  br_instr  br_instr          [.] lfsr_cond
  41.95%  br_instr  br_instr          [.] cmp_end
   0.05%  br_instr  [kernel.vmlinux]  [k] lock_acquire

Kan Liang (4):
perf/x86/core: Support KVM to assign a dedicated counter for guest
PEBS
perf/x86/ds: Handle guest PEBS events overflow and inject fake PMI perf/x86: Expose a function to disable auto-reload
KVM: x86/pmu: Decouple event enablement from event creation

Like Xu (1):
KVM: x86/pmu: Add support to reprogram PEBS event for guest counters

Luwei Kang (6):
KVM: x86/pmu: Implement is_pebs_via_ds_supported pmu ops
KVM: x86/pmu: Expose CPUIDs feature bits PDCM, DS, DTES64
KVM: x86/pmu: PEBS MSRs emulation
KVM: x86/pmu: Expose PEBS feature to guest
KVM: x86/pmu: Introduce the mask value for fixed counter
KVM: x86/pmu: Adaptive PEBS virtualization enabling

 arch/x86/events/intel/core.c      |  74 +++++++++++++++++++++-
 arch/x86/events/intel/ds.c        |  59 ++++++++++++++++++
 arch/x86/events/perf_event.h      |   1 +
 arch/x86/include/asm/kvm_host.h   |  12 ++++
 arch/x86/include/asm/msr-index.h  |   4 ++
 arch/x86/include/asm/perf_event.h |   2 +
 arch/x86/kvm/cpuid.c              |   9 ++-
 arch/x86/kvm/pmu.c                |  71 ++++++++++++++++++++-
 arch/x86/kvm/pmu.h                |   2 +
 arch/x86/kvm/svm.c                |  12 ++++
 arch/x86/kvm/vmx/capabilities.h   |  17 +++++
 arch/x86/kvm/vmx/pmu_intel.c      | 128 +++++++++++++++++++++++++++++++++++++-
 arch/x86/kvm/vmx/vmx.c            |   6 +-
 arch/x86/kvm/vmx/vmx.h            |   4 ++
 arch/x86/kvm/x86.c                |  19 +++++-
 include/linux/perf_event.h        |   2 +
 kernel/events/core.c              |   1 +
 17 files changed, 414 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.3.1