From: Like Xu <like.xu.linux@gmail.com>
To: Ravi Bangoria <ravi.bangoria@amd.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Marc Zyngier <maz@kernel.org>, Fenghua Yu <fenghua.yu@intel.com>,
kvmarm@lists.linux.dev, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH RFC 1/8] perf/core: Add *group_leader to perf_event_create_kernel_counter()
Date: Thu, 15 Dec 2022 21:36:19 +0800 [thread overview]
Message-ID: <90b640af-1d81-64bf-96f7-24aa44cca2dd@gmail.com> (raw)
In-Reply-To: <4990ef71-734a-10cf-e7dc-51b33b26fd18@amd.com>
On 14/12/2022 11:52 am, Ravi Bangoria wrote:
>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>> index 7f04f995c975..f671b1a9a691 100644
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -12674,12 +12674,14 @@ SYSCALL_DEFINE5(perf_event_open,
>> * @attr: attributes of the counter to create
>> * @cpu: cpu in which the counter is bound
>> * @task: task to profile (NULL for percpu)
>> + * @group_leader: event group leader
>> * @overflow_handler: callback to trigger when we hit the event
>> * @context: context data could be used in overflow_handler callback
>> */
>> struct perf_event *
>> perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
>> struct task_struct *task,
>> + struct perf_event *group_leader,
>> perf_overflow_handler_t overflow_handler,
>> void *context)
>> {
>> @@ -12694,7 +12696,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
>> if (attr->aux_output)
>> return ERR_PTR(-EINVAL);
>>
>> - event = perf_event_alloc(attr, cpu, task, NULL, NULL,
>> + event = perf_event_alloc(attr, cpu, task, group_leader, NULL,
>> overflow_handler, context, -1);
>
> Grouping involves lot of complexities. Setting group_leader won't be sufficient.
> Please see perf_event_open() syscall code for more detail.
>
> Thanks,
> Ravi
This is the main reason why the RFC tag is added. More detailed professional
reviews is encouraged.
AFAI, there does exist a number of code gaps here to support grouped events in
the kernel,
but there are also opportunities, as there may be other new use cases bringing
innovation.
I have to confirm this idea with maintainers first, the alternative is to create
yet another special
perf_event similar to PMC_IDX_FIXED_VLBR, which schedules perf_metrics MSR for
KVM stuff.
PeterZ, any input ?
next prev parent reply other threads:[~2022-12-15 13:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 12:58 [PATCH RFC 0/8] KVM: x86/pmu: Enable Fixed Counter3 and Topdown Perf Metrics Like Xu
2022-12-12 12:58 ` [PATCH RFC 1/8] perf/core: Add *group_leader to perf_event_create_kernel_counter() Like Xu
2022-12-12 13:23 ` Marc Zyngier
2022-12-15 13:11 ` Like Xu
2022-12-14 3:52 ` Ravi Bangoria
2022-12-15 13:36 ` Like Xu [this message]
2022-12-12 12:58 ` [PATCH RFC 2/8] perf: x86/core: Expose the available number of the Topdown metrics Like Xu
2022-12-12 12:58 ` [PATCH RFC 3/8] perf: x86/core: Snyc PERF_METRICS bit together with fixed counter3 Like Xu
2022-12-12 12:58 ` [PATCH RFC 4/8] KVM: x86/pmu: Add Intel CPUID-hinted Topdown Slots event Like Xu
2022-12-12 12:58 ` [PATCH RFC 5/8] KVM: x86/pmu: Add kernel-defined slots event to enable Fixed Counter3 Like Xu
2022-12-12 12:58 ` [PATCH RFC 6/8] KVM: x86/pmu: properly use INTEL_PMC_FIXED_RDPMC_BASE macro Like Xu
2022-12-12 12:58 ` [PATCH RFC 7/8] KVM: x86/pmu: Use flex *event arrays to implement grouped events Like Xu
2022-12-12 12:58 ` [PATCH RFC 8/8] KVM: x86/pmu: Add MSR_PERF_METRICS MSR emulation to enable Topdown Like Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90b640af-1d81-64bf-96f7-24aa44cca2dd@gmail.com \
--to=like.xu.linux@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox