From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755570AbcKVMbo (ORCPT ); Tue, 22 Nov 2016 07:31:44 -0500 Received: from terminus.zytor.com ([198.137.202.10]:41866 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755546AbcKVMbm (ORCPT ); Tue, 22 Nov 2016 07:31:42 -0500 Date: Tue, 22 Nov 2016 04:30:58 -0800 From: tip-bot for Peter Zijlstra Message-ID: Cc: alexander.shishkin@linux.intel.com, vince@deater.net, peterz@infradead.org, hpa@zytor.com, vincent.weaver@maine.edu, torvalds@linux-foundation.org, eranian@google.com, acme@redhat.com, kan.liang@intel.com, linux-kernel@vger.kernel.org, jolsa@redhat.com, mingo@kernel.org, tglx@linutronix.de Reply-To: eranian@google.com, vincent.weaver@maine.edu, torvalds@linux-foundation.org, alexander.shishkin@linux.intel.com, hpa@zytor.com, peterz@infradead.org, vince@deater.net, tglx@linutronix.de, mingo@kernel.org, jolsa@redhat.com, acme@redhat.com, linux-kernel@vger.kernel.org, kan.liang@intel.com In-Reply-To: <20161118125354.GQ3117@twins.programming.kicks-ass.net> References: <20161118125354.GQ3117@twins.programming.kicks-ass.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86/intel/uncore: Allow only a single PMU/box within an events group Git-Commit-ID: 033ac60c7f21f9996a0fab2fd04f334afbf77b33 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 033ac60c7f21f9996a0fab2fd04f334afbf77b33 Gitweb: http://git.kernel.org/tip/033ac60c7f21f9996a0fab2fd04f334afbf77b33 Author: Peter Zijlstra AuthorDate: Fri, 18 Nov 2016 13:53:54 +0100 Committer: Ingo Molnar CommitDate: Tue, 22 Nov 2016 12:36:59 +0100 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 Tested-by: Jiri Olsa Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Kan Liang Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: Vince Weaver Link: http://lkml.kernel.org/r/20161118125354.GQ3117@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar --- arch/x86/events/intel/uncore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index efca268..dbaaf7dc 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, */ static int uncore_pmu_event_init(struct perf_event *event); -static bool is_uncore_event(struct perf_event *event) +static bool is_box_event(struct intel_uncore_box *box, struct perf_event *event) { - return event->pmu->event_init == uncore_pmu_event_init; + return &box->pmu->pmu == event->pmu; } static int @@ -340,7 +340,7 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, n = box->n_events; - if (is_uncore_event(leader)) { + if (is_box_event(box, leader)) { box->event_list[n] = leader; n++; } @@ -349,7 +349,7 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, return n; list_for_each_entry(event, &leader->sibling_list, group_entry) { - if (!is_uncore_event(event) || + if (!is_box_event(box, event) || event->state <= PERF_EVENT_STATE_OFF) continue;