diff options
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_uncore.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 9762dbd9f3f7..e98f68cfea02 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -276,6 +276,17 @@ static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, | |||
276 | return box; | 276 | return box; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* | ||
280 | * Using uncore_pmu_event_init pmu event_init callback | ||
281 | * as a detection point for uncore events. | ||
282 | */ | ||
283 | static int uncore_pmu_event_init(struct perf_event *event); | ||
284 | |||
285 | static bool is_uncore_event(struct perf_event *event) | ||
286 | { | ||
287 | return event->pmu->event_init == uncore_pmu_event_init; | ||
288 | } | ||
289 | |||
279 | static int | 290 | static int |
280 | uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, bool dogrp) | 291 | uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, bool dogrp) |
281 | { | 292 | { |
@@ -290,13 +301,18 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, b | |||
290 | return -EINVAL; | 301 | return -EINVAL; |
291 | 302 | ||
292 | n = box->n_events; | 303 | n = box->n_events; |
293 | box->event_list[n] = leader; | 304 | |
294 | n++; | 305 | if (is_uncore_event(leader)) { |
306 | box->event_list[n] = leader; | ||
307 | n++; | ||
308 | } | ||
309 | |||
295 | if (!dogrp) | 310 | if (!dogrp) |
296 | return n; | 311 | return n; |
297 | 312 | ||
298 | list_for_each_entry(event, &leader->sibling_list, group_entry) { | 313 | list_for_each_entry(event, &leader->sibling_list, group_entry) { |
299 | if (event->state <= PERF_EVENT_STATE_OFF) | 314 | if (!is_uncore_event(event) || |
315 | event->state <= PERF_EVENT_STATE_OFF) | ||
300 | continue; | 316 | continue; |
301 | 317 | ||
302 | if (n >= max_count) | 318 | if (n >= max_count) |