Re: [PATCH v2 0/4] KVM: x86/vPMU: Efficiency optimization by reusing last created perf_event

From: Like Xu
Date: Sun Oct 20 2019 - 22:26:09 EST


On 2019/10/13 17:15, Like Xu wrote:
...

Hi Paolo,

Do you have any concerns or comments for the KVM codes (the last two patches) about this vPMU efficiency optimization?

Thanks,
Like Xu


---
Changes in v2:
- use perf_event_pause() to disable, read, reset by only one lock;
- use __perf_event_read_value() after _perf_event_disable();
- replace bitfields with 'u8 event_count; bool need_cleanup;';
- refine comments and commit messages;
- fix two issues reported by kbuild test robot for ARCH=[nds32|sh]

v1:
https://lore.kernel.org/kvm/20190930072257.43352-1-like.xu@xxxxxxxxxxxxxxx/

Like Xu (4):
perf/core: Provide a kernel-internal interface to recalibrate event
period
perf/core: Provide a kernel-internal interface to pause perf_event
KVM: x86/vPMU: Reuse perf_event to avoid unnecessary
pmc_reprogram_counter
KVM: x86/vPMU: Add lazy mechanism to release perf_event per vPMC

arch/x86/include/asm/kvm_host.h | 17 +++++++
arch/x86/kvm/pmu.c | 88 ++++++++++++++++++++++++++++++++-
arch/x86/kvm/pmu.h | 15 +++++-
arch/x86/kvm/pmu_amd.c | 14 ++++++
arch/x86/kvm/vmx/pmu_intel.c | 27 ++++++++++
arch/x86/kvm/x86.c | 12 +++++
include/linux/perf_event.h | 10 ++++
kernel/events/core.c | 44 ++++++++++++++---
8 files changed, 216 insertions(+), 11 deletions(-)