diff options
author | Will Deacon <will.deacon@arm.com> | 2015-05-27 17:12:18 +0200 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2015-05-27 17:12:18 +0200 |
commit | d06f23e7637343bb6dfdb5dd216e421be1a893d8 (patch) | |
tree | 0b3dd06018146af850792fca9ba458f7a7a7779c | |
parent | arm: perf: Fix callchain parse error with kernel tracepoint events (diff) | |
parent | perf: allow for PMU-specific event filtering (diff) | |
download | linux-d06f23e7637343bb6dfdb5dd216e421be1a893d8.tar.xz linux-d06f23e7637343bb6dfdb5dd216e421be1a893d8.zip |
Merge branch 'perf/core' into perf/updates
-rw-r--r-- | include/linux/perf_event.h | 5 | ||||
-rw-r--r-- | kernel/events/core.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 61992cf2e977..67c719cc91aa 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -304,6 +304,11 @@ struct pmu { * Free pmu-private AUX data structures */ void (*free_aux) (void *aux); /* optional */ + + /* + * Filter events for PMU-specific reasons. + */ + int (*filter_match) (struct perf_event *event); /* optional */ }; /** diff --git a/kernel/events/core.c b/kernel/events/core.c index 81aa3a4ece9f..aaeb44939db0 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1506,11 +1506,17 @@ static int __init perf_workqueue_init(void) core_initcall(perf_workqueue_init); +static inline int pmu_filter_match(struct perf_event *event) +{ + struct pmu *pmu = event->pmu; + return pmu->filter_match ? pmu->filter_match(event) : 1; +} + static inline int event_filter_match(struct perf_event *event) { return (event->cpu == -1 || event->cpu == smp_processor_id()) - && perf_cgroup_match(event); + && perf_cgroup_match(event) && pmu_filter_match(event); } static void |