[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8278857-1d30-877a-5c8d-329d3cba755b@gmail.com>
Date: Thu, 15 Dec 2022 21:11:32 +0800
From: Like Xu <like.xu.linux@...il.com>
To: Marc Zyngier <maz@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Fenghua Yu <fenghua.yu@...el.com>, kvmarm@...ts.linux.dev,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH RFC 1/8] perf/core: Add *group_leader to
perf_event_create_kernel_counter()
On 12/12/2022 9:23 pm, Marc Zyngier wrote:
> On Mon, 12 Dec 2022 12:58:37 +0000,
> Like Xu <like.xu.linux@...il.com> wrote:
>>
>> From: Like Xu <likexu@...cent.com>
>>
>> Like syscalls users, kernel-space perf_event creators may also use group
>> counters abstraction to gain pmu functionalities, and an in-kernel counter
>> groups behave much like normal 'single' counters, following the group
>> semantics-based behavior.
>>
>> No functional changes at this time. An example will be that KVM creates
>> Intel slot event as group leader and other topdown metric events to emulate
>> MSR_PERF_METRICS pmu capability for guests.
>>
>> Cc: Peter Zijlstra <peterz@...radead.org>
>> Cc: Marc Zyngier <maz@...nel.org>
>> Cc: Fenghua Yu <fenghua.yu@...el.com>
>> Cc: kvmarm@...ts.linux.dev
>> Cc: linux-perf-users@...r.kernel.org
>> Signed-off-by: Like Xu <likexu@...cent.com>
>> ---
>> arch/arm64/kvm/pmu-emul.c | 4 ++--
>> arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
>> arch/x86/kvm/pmu.c | 2 +-
>> arch/x86/kvm/vmx/pmu_intel.c | 2 +-
>> include/linux/perf_event.h | 1 +
>> kernel/events/core.c | 4 +++-
>> kernel/events/hw_breakpoint.c | 4 ++--
>> kernel/events/hw_breakpoint_test.c | 2 +-
>> kernel/watchdog_hld.c | 2 +-
>> 9 files changed, 14 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
>> index 24908400e190..11c3386bc86b 100644
>> --- a/arch/arm64/kvm/pmu-emul.c
>> +++ b/arch/arm64/kvm/pmu-emul.c
>> @@ -624,7 +624,7 @@ static void kvm_pmu_create_perf_event(struct kvm_pmc *pmc)
>>
>> attr.sample_period = compute_period(pmc, kvm_pmu_get_pmc_value(pmc));
>>
>> - event = perf_event_create_kernel_counter(&attr, -1, current,
>> + event = perf_event_create_kernel_counter(&attr, -1, current, NULL,
>> kvm_pmu_perf_overflow, pmc);
>
> Wouldn't it be better to have a separate helper that takes the group leader
> as a parameter, and reimplement perf_event_create_kernel_counter() in term
> of this helper?
>
> M.
>
Applied. It makes changes more concise, thank you.
Powered by blists - more mailing lists