From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] ARM: perf-events: use numeric ID to identify PMU
Date: Fri, 26 Feb 2010 11:17:02 -0000 [thread overview]
Message-ID: <000701cab6d5$38d828a0$aa8879e0$@deacon@arm.com> (raw)
In-Reply-To: <201002261010.03017.jpihet@mvista.com>
Hi Jean,
> > +/* ARM perf PMU IDs for use by internal perf clients. */
> > +#define ARM_PERF_PMU_ID_XSCALE1 0
> > +#define ARM_PERF_PMU_ID_XSCALE2 (ARM_PERF_PMU_ID_XSCALE1 + 1)
> > +#define ARM_PERF_PMU_ID_V6 (ARM_PERF_PMU_ID_XSCALE2 + 1)
> > +#define ARM_PERF_PMU_ID_V6MP (ARM_PERF_PMU_ID_V6 + 1)
> > +#define ARM_PERF_PMU_ID_CA8 (ARM_PERF_PMU_ID_V6MP + 1)
> > +#define ARM_PERF_PMU_ID_CA9 (ARM_PERF_PMU_ID_CA8 + 1)
> > +#define ARM_NUM_PMU_IDS (ARM_PERF_PMU_ID_CA9 + 1)
> I think we need a better representation of the IDs and names. This is error
> prone in case of modification, e.g. adding an ID.
OK - how about something like this?:
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index 925b9a4..7584aa4 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -29,13 +29,15 @@ set_perf_event_pending(void)
#define PERF_EVENT_INDEX_OFFSET 1
/* ARM perf PMU IDs for use by internal perf clients. */
-#define ARM_PERF_PMU_ID_XSCALE1 0
-#define ARM_PERF_PMU_ID_XSCALE2 (ARM_PERF_PMU_ID_XSCALE1 + 1)
-#define ARM_PERF_PMU_ID_V6 (ARM_PERF_PMU_ID_XSCALE2 + 1)
-#define ARM_PERF_PMU_ID_V6MP (ARM_PERF_PMU_ID_V6 + 1)
-#define ARM_PERF_PMU_ID_CA8 (ARM_PERF_PMU_ID_V6MP + 1)
-#define ARM_PERF_PMU_ID_CA9 (ARM_PERF_PMU_ID_CA8 + 1)
-#define ARM_NUM_PMU_IDS (ARM_PERF_PMU_ID_CA9 + 1)
+static enum arm_perf_pmu_ids {
+ ARM_PERF_PMU_ID_XSCALE1 = 0,
+ ARM_PERF_PMU_ID_XSCALE2,
+ ARM_PERF_PMU_ID_V6,
+ ARM_PERF_PMU_ID_V6MP,
+ ARM_PERF_PMU_ID_CA8,
+ ARM_PERF_PMU_ID_CA9,
+ ARM_NUM_PMU_IDS,
+};
extern int
armpmu_get_pmu_id(void);
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 98c62ff..513ee60 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -69,13 +69,13 @@ struct cpu_hw_events {
DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
/* PMU names. */
-static const char *arm_pmu_names[ARM_NUM_PMU_IDS] = {
- "xscale1",
- "xscale2",
- "v6",
- "v6mpcore",
- "ARMv7 Cortex-A8",
- "ARMv7 Cortex-A9",
+static const char *arm_pmu_names[] = {
+ [ARM_PERF_PMU_ID_XSCALE1] = "xscale1",
+ [ARM_PERF_PMU_ID_XSCALE2] = "xscale2",
+ [ARM_PERF_PMU_ID_V6] = "v6",
+ [ARM_PERF_PMU_ID_V6MP] = "v6mpcore",
+ [ARM_PERF_PMU_ID_CA8] = "ARMv7 Cortex-A8",
+ [ARM_PERF_PMU_ID_CA9] = "ARMv7 Cortex-A9",
};
struct arm_pmu {
Cheers,
Will
next prev parent reply other threads:[~2010-02-26 11:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 18:56 [PATCH 0/6] ARM: oprofile: use perf-events framework as backend Will Deacon
2010-02-25 18:56 ` [PATCH 1/6] ARM: perf-events: add Realview PMU IRQs to pmu.c Will Deacon
2010-02-25 18:56 ` [PATCH 2/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
2010-02-25 18:56 ` [PATCH 3/6] ARM: perf-events: add support for xscale PMUs Will Deacon
2010-02-25 18:56 ` [PATCH 4/6] perf-events: export enable/disable event symbols to kernel modules Will Deacon
2010-02-25 18:56 ` [PATCH 5/6] ARM: oprofile: use perf-events framework as backend Will Deacon
2010-02-25 18:56 ` [PATCH 6/6] ARM: oprofile: remove old files and update KConfig Will Deacon
2010-02-26 9:28 ` [PATCH 5/6] ARM: oprofile: use perf-events framework as backend Jean Pihet
2010-02-26 10:01 ` Will Deacon
2010-02-26 10:25 ` Jean Pihet
2010-03-02 15:54 ` Will Deacon
2010-02-26 8:23 ` [PATCH 4/6] perf-events: export enable/disable event symbols to kernel modules Ingo Molnar
2010-02-26 9:53 ` Will Deacon
2010-02-26 9:10 ` [PATCH 2/6] ARM: perf-events: use numeric ID to identify PMU Jean Pihet
2010-02-26 11:17 ` Will Deacon [this message]
2010-02-26 9:07 ` [PATCH 0/6] ARM: oprofile: use perf-events framework as backend Jean Pihet
-- strict thread matches above, loose matches on Subject: below --
2010-03-10 10:41 [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v2] Will Deacon
2010-03-10 10:41 ` [PATCH 1/6] ARM: perf-events: add Realview PMU IRQs to pmu.c Will Deacon
2010-03-10 10:41 ` [PATCH 2/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
2010-03-10 11:03 ` Jamie Iles
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='000701cab6d5$38d828a0$aa8879e0$@deacon@arm.com' \
--to=will.deacon@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.