diff options
author | Will Deacon <will.deacon@arm.com> | 2012-07-06 10:45:00 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-07-09 12:41:10 -0400 |
commit | 4295b898f5a5c7e62ae68e7a4ecc4b414622ffe6 (patch) | |
tree | b05cc5adefe9e4a42ccbbe31c7a771934e064a35 /arch/arm/oprofile | |
parent | 881ccccb6bd3f0e1fff8b9addbe0de90e0b16166 (diff) |
ARM: 7448/1: perf: remove arm_perf_pmu_ids global enumeration
In order to provide PMU name strings compatible with the OProfile
user ABI, an enumeration of all PMUs is currently used by perf to
identify each PMU uniquely. Unfortunately, this does not scale well
in the presence of multiple PMUs and creates a single, global namespace
across all PMUs in the system.
This patch removes the enumeration and instead uses the name string
for the PMU to map onto the OProfile variant. perf_pmu_name is
implemented for CPU PMUs, which is all that OProfile cares about anyway.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/oprofile')
-rw-r--r-- | arch/arm/oprofile/common.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c index 4e0a371630b3..99c63d4b6af8 100644 --- a/arch/arm/oprofile/common.c +++ b/arch/arm/oprofile/common.c | |||
@@ -23,26 +23,37 @@ | |||
23 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
24 | 24 | ||
25 | #ifdef CONFIG_HW_PERF_EVENTS | 25 | #ifdef CONFIG_HW_PERF_EVENTS |
26 | |||
27 | /* | ||
28 | * OProfile has a curious naming scheme for the ARM PMUs, but they are | ||
29 | * part of the user ABI so we need to map from the perf PMU name for | ||
30 | * supported PMUs. | ||
31 | */ | ||
32 | static struct op_perf_name { | ||
33 | char *perf_name; | ||
34 | char *op_name; | ||
35 | } op_perf_name_map[] = { | ||
36 | { "xscale1", "arm/xscale1" }, | ||
37 | { "xscale1", "arm/xscale2" }, | ||
38 | { "v6", "arm/armv6" }, | ||
39 | { "v6mpcore", "arm/mpcore" }, | ||
40 | { "ARMv7 Cortex-A8", "arm/armv7" }, | ||
41 | { "ARMv7 Cortex-A9", "arm/armv7-ca9" }, | ||
42 | }; | ||
43 | |||
26 | char *op_name_from_perf_id(void) | 44 | char *op_name_from_perf_id(void) |
27 | { | 45 | { |
28 | enum arm_perf_pmu_ids id = armpmu_get_pmu_id(); | 46 | int i; |
29 | 47 | struct op_perf_name names; | |
30 | switch (id) { | 48 | const char *perf_name = perf_pmu_name(); |
31 | case ARM_PERF_PMU_ID_XSCALE1: | 49 | |
32 | return "arm/xscale1"; | 50 | for (i = 0; i < ARRAY_SIZE(op_perf_name_map); ++i) { |
33 | case ARM_PERF_PMU_ID_XSCALE2: | 51 | names = op_perf_name_map[i]; |
34 | return "arm/xscale2"; | 52 | if (!strcmp(names.perf_name, perf_name)) |
35 | case ARM_PERF_PMU_ID_V6: | 53 | return names.op_name; |
36 | return "arm/armv6"; | ||
37 | case ARM_PERF_PMU_ID_V6MP: | ||
38 | return "arm/mpcore"; | ||
39 | case ARM_PERF_PMU_ID_CA8: | ||
40 | return "arm/armv7"; | ||
41 | case ARM_PERF_PMU_ID_CA9: | ||
42 | return "arm/armv7-ca9"; | ||
43 | default: | ||
44 | return NULL; | ||
45 | } | 54 | } |
55 | |||
56 | return NULL; | ||
46 | } | 57 | } |
47 | #endif | 58 | #endif |
48 | 59 | ||