diff options
author | Peter Zijlstra <peterz@infradead.org> | 2016-11-18 07:53:54 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-11-22 06:36:59 -0500 |
commit | 033ac60c7f21f9996a0fab2fd04f334afbf77b33 (patch) | |
tree | 3c43c0f1b40804fbd5e5a755c8dd19e32c5ad697 | |
parent | b8000586c90b4804902058a38d3a59ce5708e695 (diff) |
perf/x86/intel/uncore: Allow only a single PMU/box within an events group
Group validation expects all events to be of the same PMU; however
is_uncore_pmu() is too wide, it matches _all_ uncore events, even
across PMUs.
This triggers failure when we group different events from different
uncore PMUs, like:
perf stat -vv -e '{uncore_cbox_0/config=0x0334/,uncore_qpi_0/event=1/}' -a sleep 1
Fix is_uncore_pmu() by only matching events to the box at hand.
Note that generic code; ran after this step; will disallow this
mixture of PMU events.
Reported-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vince@deater.net>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/20161118125354.GQ3117@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/events/intel/uncore.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index efca2685d876..dbaaf7dc8373 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c | |||
@@ -319,9 +319,9 @@ static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, | |||
319 | */ | 319 | */ |
320 | static int uncore_pmu_event_init(struct perf_event *event); | 320 | static int uncore_pmu_event_init(struct perf_event *event); |
321 | 321 | ||
322 | static bool is_uncore_event(struct perf_event *event) | 322 | static bool is_box_event(struct intel_uncore_box *box, struct perf_event *event) |
323 | { | 323 | { |
324 | return event->pmu->event_init == uncore_pmu_event_init; | 324 | return &box->pmu->pmu == event->pmu; |
325 | } | 325 | } |
326 | 326 | ||
327 | static int | 327 | static int |
@@ -340,7 +340,7 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, | |||
340 | 340 | ||
341 | n = box->n_events; | 341 | n = box->n_events; |
342 | 342 | ||
343 | if (is_uncore_event(leader)) { | 343 | if (is_box_event(box, leader)) { |
344 | box->event_list[n] = leader; | 344 | box->event_list[n] = leader; |
345 | n++; | 345 | n++; |
346 | } | 346 | } |
@@ -349,7 +349,7 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, | |||
349 | return n; | 349 | return n; |
350 | 350 | ||
351 | list_for_each_entry(event, &leader->sibling_list, group_entry) { | 351 | list_for_each_entry(event, &leader->sibling_list, group_entry) { |
352 | if (!is_uncore_event(event) || | 352 | if (!is_box_event(box, event) || |
353 | event->state <= PERF_EVENT_STATE_OFF) | 353 | event->state <= PERF_EVENT_STATE_OFF) |
354 | continue; | 354 | continue; |
355 | 355 | ||