Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3862449imu; Mon, 7 Jan 2019 10:50:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5RKTrW1ltGsHemoWZp3+k5Dn2BbEhFp50n0wv6od1cG9jocUs1u/nGvs/BGoSmu4Kdoksw X-Received: by 2002:a63:413:: with SMTP id 19mr11774935pge.7.1546887018307; Mon, 07 Jan 2019 10:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546887018; cv=none; d=google.com; s=arc-20160816; b=ojCIV6B0b1m0DfxkpWrynjF0ysFyb8fBg6E/CHtIMETZxmhWwWq/RLSJe3qbOxrO9U t8BBTEfz2/lftOoFKsPAC3kHjYz27MWm2utGcf80ePGf9ZbKEuWDlmg09T1zg+jYph2A clISJauQTGuHcWCAHm4SezpMTdpxAhNWzg9SxTqXlulWAe0rAbfEFXPuIbjX7mJn6ne5 fiyovGYxh9YwoMO+lSfGg2/mZJlCmXznyLRB+b0xTimmK1AM3VMqNzs4j3m+JHuRAr7F FfWJULYJGS552lrCaoUmbSNRkdjNDawrm6cic3nDn0vsluvsQyQqFDEvpflszryro8ez Y6lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=EVU8yF+Da+Ebx1jODoypa6LDXbwtTjwen6qQivT9B7A=; b=UbBepiJ23rCoyunzBfTuKahfHy8UOCE71C3Xi/fOAYO2oUa0QgjOyBypzyOqUUM2Z4 P6c0JBbfk1KhFBlnVhKnwrU1bfkF2Yo8nVTpp5xSU/7EN/euqmmeWTsmOXx4MNHkjCvj DQzXmqVodscEQli2WbDM6MgeGEXm8Cs7ZOmthaRQGoj2rvIidRyIiOuYVJk9XgblWlav joG74U6NhSZQxOpMZzji5e2gXi8CImv+50wl4DoS/hfEbleQxGQL2hkvZ2Rxn/v+HUrn +Kcqy2mvRIYH9ZbIoZYw8N3APFvmdmxD4RHRY4+cDK/lO1IfnxXlLyx2/Vjm/6rEFQ70 e0Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35si18008448plf.177.2019.01.07.10.50.03; Mon, 07 Jan 2019 10:50:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730491AbfAGQ2H (ORCPT + 99 others); Mon, 7 Jan 2019 11:28:07 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34252 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730428AbfAGQ2F (ORCPT ); Mon, 7 Jan 2019 11:28:05 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 220801596; Mon, 7 Jan 2019 08:28:05 -0800 (PST) Received: from e119886-lin.cambridge.arm.com (unknown [10.37.6.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A181B3F5A0; Mon, 7 Jan 2019 08:28:00 -0800 (PST) From: Andrew Murray To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Richard Henderson , Ivan Kokshaysky , Matt Turner , Will Deacon , Mark Rutland , Shawn Guo , Sascha Hauer , Benjamin Herrenschmidt , Paul Mackerras , Thomas Gleixner , Borislav Petkov , Russell King , suzuki.poulose@arm.com, robin.murphy@arm.com, Michael Ellerman Cc: x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org Subject: [PATCH v4 05/13] arm: perf: conditionally use PERF_PMU_CAP_NO_EXCLUDE Date: Mon, 7 Jan 2019 16:27:22 +0000 Message-Id: <1546878450-20341-6-git-send-email-andrew.murray@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546878450-20341-1-git-send-email-andrew.murray@arm.com> References: <1546878450-20341-1-git-send-email-andrew.murray@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ARM PMU driver can be used to represent a variety of ARM based PMUs. Some of these PMUs do not provide support for context exclusion, where this is the case we advertise the PERF_PMU_CAP_NO_EXCLUDE capability to ensure that perf prevents us from handling events where any exclusion flags are set. Signed-off-by: Andrew Murray Acked-by: Will Deacon --- drivers/perf/arm_pmu.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index d0b7dd8..eec75b9 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -357,13 +357,6 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) } static int -event_requires_mode_exclusion(struct perf_event_attr *attr) -{ - return attr->exclude_idle || attr->exclude_user || - attr->exclude_kernel || attr->exclude_hv; -} - -static int __hw_perf_event_init(struct perf_event *event) { struct arm_pmu *armpmu = to_arm_pmu(event->pmu); @@ -393,9 +386,8 @@ __hw_perf_event_init(struct perf_event *event) /* * Check whether we need to exclude the counter from certain modes. */ - if ((!armpmu->set_event_filter || - armpmu->set_event_filter(hwc, &event->attr)) && - event_requires_mode_exclusion(&event->attr)) { + if (armpmu->set_event_filter && + armpmu->set_event_filter(hwc, &event->attr)) { pr_debug("ARM performance counters do not support " "mode exclusion\n"); return -EOPNOTSUPP; @@ -867,6 +859,9 @@ int armpmu_register(struct arm_pmu *pmu) if (ret) return ret; + if (!pmu->set_event_filter) + pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE; + ret = perf_pmu_register(&pmu->pmu, pmu->name, -1); if (ret) goto out_destroy; -- 2.7.4