From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933053AbcITPun (ORCPT ); Tue, 20 Sep 2016 11:50:43 -0400 Received: from mga14.intel.com ([192.55.52.115]:58872 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932932AbcITPuc (ORCPT ); Tue, 20 Sep 2016 11:50:32 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,368,1470726000"; d="scan'208";a="763759634" From: Alexander Shishkin To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, Arnaldo Carvalho de Melo , tglx@linutronix.de, Alexander Shishkin Subject: [PATCH 2/2] perf: Limit matching exclusive events to one PMU Date: Tue, 20 Sep 2016 18:48:11 +0300 Message-Id: <20160920154811.3255-3-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160920154811.3255-1-alexander.shishkin@linux.intel.com> References: <20160920154811.3255-1-alexander.shishkin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An "exclusive" PMU is the one that can only have one event scheduled in at any given time. There may be more than one of such PMUs in a system, though, like Intel PT and BTS. It should be allowed to have one event for either of those inside the same context (there may be other constraints that may prevent this, but those would be hardware-specific). However, the exclusivity code is written so that only one event from any of the "exclusive" PMUs is allowed in a context. Fix this by making the exclusive event filter explicitly match two events' PMUs. Signed-off-by: Alexander Shishkin --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index fedba316cc..7c0d263f6b 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3958,7 +3958,7 @@ static void exclusive_event_destroy(struct perf_event *event) static bool exclusive_event_match(struct perf_event *e1, struct perf_event *e2) { - if ((e1->pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE) && + if ((e1->pmu == e2->pmu) && (e1->cpu == e2->cpu || e1->cpu == -1 || e2->cpu == -1)) -- 2.9.3