ARM: perf: register CPU PMUs with idr types
authorSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Tue, 25 Sep 2012 16:26:50 +0000 (17:26 +0100)
committerJon Medhurst <tixy@linaro.org>
Wed, 17 Jul 2013 10:12:03 +0000 (11:12 +0100)
In order to support multiple, heterogeneous CPU PMUs and distinguish
them, they cannot be registered as PERF_TYPE_RAW type. Instead we can
get perf core to allocate a new idr type id for each PMU.
Userspace applications can refer sysfs entried to find a PMU's type,
which can then be used in tracking events on individual PMUs.

Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
arch/arm/kernel/perf_event.c
arch/arm/kernel/perf_event_cpu.c

index 8c3094d0f7b78426e367e2cf3ed538e54d686cbd..491573373f67576971c41bfc95d334e17709fb43 100644 (file)
@@ -81,6 +81,9 @@ armpmu_map_event(struct perf_event *event,
                return armpmu_map_cache_event(cache_map, config);
        case PERF_TYPE_RAW:
                return armpmu_map_raw_event(raw_event_mask, config);
+       default:
+               if (event->attr.type >= PERF_TYPE_MAX)
+                       return armpmu_map_raw_event(raw_event_mask, config);
        }
 
        return -ENOENT;
index 280de37056a15dd605327c1ed4b936421b51a492..f62d6cb6524ab7bb2af9d81b3e516b0312da3911 100644 (file)
@@ -285,7 +285,7 @@ static int cpu_pmu_device_probe(struct platform_device *pdev)
 
        pmu->plat_device = pdev;
        cpu_pmu_init(pmu);
-       ret = armpmu_register(pmu, PERF_TYPE_RAW);
+       ret = armpmu_register(pmu, -1);
 
        if (!ret)
                return 0;