Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3917972imu; Mon, 7 Jan 2019 11:54:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN6+ufwzoRB51GfaqMAn3xKCjTTv8vYAAK6q14S71NyREHORVciQq7LnKupMfGwqDIk2/dh6 X-Received: by 2002:a63:c24c:: with SMTP id l12mr12145105pgg.146.1546890893313; Mon, 07 Jan 2019 11:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546890893; cv=none; d=google.com; s=arc-20160816; b=XX6Oij5vYz37DnwxBmHbs1LWMPOKJdZ2hPoRKJ44jsN/VWiLaBQ6XHcqkXokfFVTMv RCUBLzrX5qIBtGl49AA/oPR8oEU64pvctynwQRPDLdwhhvTq+AQHl6VUu0WaJn8CcpDq zs3GJghR/iZ+l/v8RwLKVcYYQ2f3osLxv5Nhu+Bj2X2YBWqEtow2QRgljhlgJ7QWsbZf KO/yBo+cqjMD+X24PJSjrbpXN6aEWXxjJX2pkvx7rNU6ogFr4mJV1pvgREm/gDvucdYY tuRIdLWF+TVk5jCoVo6BW+dwA2pThYMXfcOJwpKyzQonH/TNKGEGpdzAlFA2HLClWm/C Jh9A== 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=tnkPfBty42LT9SdO0nVsxDW+60phPDDJticm0shFuVY=; b=Sg2F2jsC9dCsWf4pDgUHgGccojDw86eAgnD4zJV+I4ldQfFPvpCE14wRt8i8KrQduL 5BCFs3rLvyEL5wwPn57hJ+S6qEXYDmMNGMJHNNNuadZMf77mpxluEEOiCRvKnHMbit42 8sZWjH6jTBX1vz0mhwLv1VecB3xKu2eIuTFy+sCP3bGfhqI/Tie+7pJ6S97Msl1Cm+jg MovJrDLSQULKfHmT3U9//ATIKX/wPKtgnUWXWyHS/9hlJ9k+JnARD5ijTe1Wwp61Swsl DgNVvHk2DxD9tEI6TKkLwOTWEvVwe6NPaAHXVfLK2/TGF7fP0DHCd9N3cSutk/6KqFxe VmJQ== 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 j22si19641991pfi.252.2019.01.07.11.54.37; Mon, 07 Jan 2019 11:54:53 -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 S1730590AbfAGQ20 (ORCPT + 99 others); Mon, 7 Jan 2019 11:28:26 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34428 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727274AbfAGQ2Z (ORCPT ); Mon, 7 Jan 2019 11:28:25 -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 77E8B1684; Mon, 7 Jan 2019 08:28:24 -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 034A03F5A0; Mon, 7 Jan 2019 08:28:19 -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 09/13] powerpc: perf/core: use PERF_PMU_CAP_NO_EXCLUDE for exclude incapable PMUs Date: Mon, 7 Jan 2019 16:27:26 +0000 Message-Id: <1546878450-20341-10-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 For PowerPC PMUs that do not support context exclusion let's advertise the PERF_PMU_CAP_NO_EXCLUDE capability. This ensures that perf will prevent us from handling events where any exclusion flags are set. Let's also remove the now unnecessary check for exclusion flags. Signed-off-by: Andrew Murray Reviewed-by: Madhavan Srinivasan Acked-by: Michael Ellerman --- arch/powerpc/perf/hv-24x7.c | 10 +--------- arch/powerpc/perf/hv-gpci.c | 10 +--------- arch/powerpc/perf/imc-pmu.c | 19 +------------------ 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 72238ee..d2b8e60 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1306,15 +1306,6 @@ static int h_24x7_event_init(struct perf_event *event) return -EINVAL; } - /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest) - return -EINVAL; - /* no branch sampling */ if (has_branch_stack(event)) return -EOPNOTSUPP; @@ -1577,6 +1568,7 @@ static struct pmu h_24x7_pmu = { .start_txn = h_24x7_event_start_txn, .commit_txn = h_24x7_event_commit_txn, .cancel_txn = h_24x7_event_cancel_txn, + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, }; static int hv_24x7_init(void) diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c index 43fabb3..735e77b 100644 --- a/arch/powerpc/perf/hv-gpci.c +++ b/arch/powerpc/perf/hv-gpci.c @@ -232,15 +232,6 @@ static int h_gpci_event_init(struct perf_event *event) return -EINVAL; } - /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest) - return -EINVAL; - /* no branch sampling */ if (has_branch_stack(event)) return -EOPNOTSUPP; @@ -285,6 +276,7 @@ static struct pmu h_gpci_pmu = { .start = h_gpci_event_start, .stop = h_gpci_event_stop, .read = h_gpci_event_update, + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, }; static int hv_gpci_init(void) diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index f292a3f..b1c37cc 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -473,15 +473,6 @@ static int nest_imc_event_init(struct perf_event *event) if (event->hw.sample_period) return -EINVAL; - /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest) - return -EINVAL; - if (event->cpu < 0) return -EINVAL; @@ -748,15 +739,6 @@ static int core_imc_event_init(struct perf_event *event) if (event->hw.sample_period) return -EINVAL; - /* unsupported modes and filters */ - if (event->attr.exclude_user || - event->attr.exclude_kernel || - event->attr.exclude_hv || - event->attr.exclude_idle || - event->attr.exclude_host || - event->attr.exclude_guest) - return -EINVAL; - if (event->cpu < 0) return -EINVAL; @@ -1069,6 +1051,7 @@ static int update_pmu_ops(struct imc_pmu *pmu) pmu->pmu.stop = imc_event_stop; pmu->pmu.read = imc_event_update; pmu->pmu.attr_groups = pmu->attr_groups; + pmu->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE; pmu->attr_groups[IMC_FORMAT_ATTR] = &imc_format_group; switch (pmu->domain) { -- 2.7.4