Re: [PATCH 2/3] KVM: x86/vPMU: Reuse perf_event to avoid unnecessary pmc_reprogram_counter

2019-10-01 Thread Like Xu
Hi Peter, On 2019/10/1 16:22, Peter Zijlstra wrote: On Mon, Sep 30, 2019 at 03:22:56PM +0800, Like Xu wrote: diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 46875bbd0419..74bc5c42b8b5 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -140,6 +140,35 @@ static void

Re: [PATCH 2/3] KVM: x86/vPMU: Reuse perf_event to avoid unnecessary pmc_reprogram_counter

2019-10-01 Thread Peter Zijlstra
On Mon, Sep 30, 2019 at 03:22:56PM +0800, Like Xu wrote: > diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c > index 46875bbd0419..74bc5c42b8b5 100644 > --- a/arch/x86/kvm/pmu.c > +++ b/arch/x86/kvm/pmu.c > @@ -140,6 +140,35 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, > u32 type,

[PATCH 2/3] KVM: x86/vPMU: Reuse perf_event to avoid unnecessary pmc_reprogram_counter

2019-09-30 Thread Like Xu
The perf_event_create_kernel_counter() in the pmc_reprogram_counter() is a high-frequency and heavyweight operation, especially when host disables the watchdog (maximum 2100 ns) which leads to an unacceptable latency of the guest NMI handler and limits the vPMU usage scenario. When a vPMC is