From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/8] arm: perf: use IDR types for CPU PMUs
Date: Wed, 22 Oct 2014 11:06:40 +0100 [thread overview]
Message-ID: <20141022100639.GB22642@leverpostej> (raw)
In-Reply-To: <5446CF3E.70807@codeaurora.org>
On Tue, Oct 21, 2014 at 10:25:18PM +0100, Stephen Boyd wrote:
> On 10/21/2014 06:11 AM, Mark Rutland wrote:
> > arch/arm/kernel/perf_event.c | 6 +++++-
> > arch/arm/kernel/perf_event_cpu.c | 2 +-
> > 2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> > index ae96b98..f0bbd3d 100644
> > --- a/arch/arm/kernel/perf_event.c
> > +++ b/arch/arm/kernel/perf_event.c
> > @@ -77,8 +77,12 @@ armpmu_map_event(struct perf_event *event,
> > u32 raw_event_mask)
> > {
> > u64 config = event->attr.config;
> > + int type = event->attr.type;
>
> Can we use u32 here to match the userspace ABI and avoid any signed vs.
> unsigned oddness?
I'd used int to match the definition of struct pmu::type (and elsewhere
in the perf core code, e.g. the int type parameter to
perf_pmu_register).
> >
> > - switch (event->attr.type) {
> > + if (type >= PERF_TYPE_MAX && type == event->pmu->type)
I'll get rid of the check against PERF_TYPE_MAX here -- it's redundant
given we're about to check equivalence with event->pmu->type anyway.
With that removed we only check for equivalence between the userspace
provided type and any kernelspace type fields (which should all be in
the range [0,INT_MAX]), rather than greater/less than comparisons. So I
think we should be ok.
Does that make sense?
Thanks,
Mark.
> > + return armpmu_map_raw_event(raw_event_mask, config);
> > +
> > + switch (type) {
> > case PERF_TYPE_HARDWARE:
> > return armpmu_map_hw_event(event_map, config);
> > case PERF_TYPE_HW_CACHE:
> >
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
>
next prev parent reply other threads:[~2014-10-22 10:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 13:11 [PATCH 0/8] Prepatory rework for multi-PMU support Mark Rutland
2014-10-21 13:11 ` [PATCH 1/8] arm: perf: factor out callchain code Mark Rutland
2014-10-21 13:11 ` [PATCH 2/8] arm: perf: make PMU probing data-driven Mark Rutland
2014-10-21 21:25 ` Stephen Boyd
2014-10-22 9:50 ` Mark Rutland
2014-10-21 13:11 ` [PATCH 3/8] arm: perf: use IDR types for CPU PMUs Mark Rutland
2014-10-21 21:25 ` Stephen Boyd
2014-10-22 10:06 ` Mark Rutland [this message]
2014-10-27 20:29 ` Stephen Boyd
2014-10-21 13:11 ` [PATCH 4/8] arm: perf: limit size of accounting data Mark Rutland
2014-10-21 13:11 ` [PATCH 5/8] arm: perf: kill get_hw_events() Mark Rutland
2014-10-21 13:11 ` [PATCH 6/8] arm: perf: fold percpu_pmu into pmu_hw_events Mark Rutland
2014-10-21 22:05 ` Stephen Boyd
2014-10-22 10:10 ` Mark Rutland
2014-10-21 13:11 ` [PATCH 7/8] arm: perf: dynamically allocate cpu hardware data Mark Rutland
2014-10-21 21:24 ` Stephen Boyd
2014-10-22 11:06 ` Mark Rutland
2014-10-21 13:11 ` [PATCH 8/8] arm: perf: fold hotplug notifier into arm_pmu Mark Rutland
2014-10-21 22:18 ` Stephen Boyd
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=20141022100639.GB22642@leverpostej \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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