Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3230318imu; Sat, 24 Nov 2018 00:37:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/WZUVIQ+7VM3vUPO8RXmA9vEUz/al7ow7pqEunnHKOG+NiNxLznDXdA3b2uVKVr1WF81LIL X-Received: by 2002:a17:902:9a42:: with SMTP id x2-v6mr18959586plv.126.1543048679565; Sat, 24 Nov 2018 00:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048679; cv=none; d=google.com; s=arc-20160816; b=TsqWMbGW20QxAlAYV43+frADj9B9PdFJY873wxCBAV9Wg4DqBuqO/IzMvQ3HC5Iibl Zf0U2pr42GeTBqQ76sf+YYa3FpG6uwfww0pq7MQiaUN3Izq/DKhrdY8GpmHHQ4T0ybhU ND+zrCNh2GX99kHlKhrfMt8PWKlVDvZ8FJ0C/LAVAF2lDJXHjwRye7wKIOaIzDIQ7C9p A38B9upFnfsBrliTO7lkVo+qENX3CcelELsStwwVz6hbEaFVN7nyCBvsF0uJi53o/87o N8Jd34rQuvU1+2hYjO4XbFP11ZE8n40AlUP+ejZbpdkzyt0vR/SPqZpn3fVXEC6Pt9l4 EyRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zzO6Skcebtm3m41EeeIBtAKL6CCKVKlT3OJ14yDpDFY=; b=xi1UgELosjzIZxRG2CpT21eAGUO1eHFHpLDO+3wP2dkgv0b9qwJi7CKD70YiUlDM/J /3zMvoVEOWhCucJu60pUQfbUtMS/LDQNv7SEG4F9MvHtEWsIrVw2rnhBcb1GY0a7Uyiq gycKRnvh2MKJYBbsdguh10eGOgwPDBnlsSd0XR5wHa6/InPWzmZ5ovk9IEYpl3b9kpkA i/U46hZaHs/kVx2jU3Yfe0th1UMWalmpW7CBNfHdEt/GeTzgmJFu/V7sll5aNPlJKZ6I 3tyBFniMMT/nn8ePVaOniYXGjEwrIsxaMt3eyIrIhxRPjcIGkBLVzPrz3e/b4q0W5Jgj AAOA== 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 w12si32562120pfn.212.2018.11.24.00.37.45; Sat, 24 Nov 2018 00:37:59 -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 S2410071AbeKXBPl (ORCPT + 99 others); Fri, 23 Nov 2018 20:15:41 -0500 Received: from foss.arm.com ([217.140.101.70]:46416 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391009AbeKXBPk (ORCPT ); Fri, 23 Nov 2018 20:15:40 -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 35EB4362E; Fri, 23 Nov 2018 06:31:16 -0800 (PST) Received: from localhost (unknown [10.37.6.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 93E7C3F575; Fri, 23 Nov 2018 06:31:15 -0800 (PST) Date: Fri, 23 Nov 2018 14:31:13 +0000 From: Andrew Murray To: Mark Rutland Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Shawn Guo , Sascha Hauer , Will Deacon , Benjamin Herrenschmidt , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/10] drivers/perf: perf/core: generalise event exclusion checking with perf macro Message-ID: <20181123143113.GA1617@e119886-lin.cambridge.arm.com> References: <1542363853-13849-1-git-send-email-andrew.murray@arm.com> <1542363853-13849-10-git-send-email-andrew.murray@arm.com> <20181119160352.ua2lx72l754imiek@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119160352.ua2lx72l754imiek@lakrids.cambridge.arm.com> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 04:03:52PM +0000, Mark Rutland wrote: > On Fri, Nov 16, 2018 at 10:24:12AM +0000, Andrew Murray wrote: > > Replace checking of perf event exclusion flags with perf macro. > > > > This is a functional change as exclude_host and exclude_guest are added > > in the following files: > > > > - drivers/perf/qcom_l2_pmu.c > > - drivers/perf/qcom_l3_pmu.c > > - drivers/perf/arm_pmu.c > > > > And exclude_idle and exclude_hv are added in these files: > > > > - drivers/perf/xgene_pmu.c > > FWIW, that all sounds fine to me. > > Assuming you fix up the 'macro' nit: > > Acked-by: Mark Rutland > > ... unless we go for Peter's core cap for this. Yeah I'm going to re-spin with the core cap approach - but thanks anyway. Thanks, Andrew Murray > > Thanks, > Mark. > > > Signed-off-by: Andrew Murray > > --- > > drivers/perf/arm-cci.c | 7 +------ > > drivers/perf/arm-ccn.c | 5 +---- > > drivers/perf/arm_dsu_pmu.c | 7 +------ > > drivers/perf/arm_pmu.c | 9 +-------- > > drivers/perf/hisilicon/hisi_uncore_pmu.c | 7 +------ > > drivers/perf/qcom_l2_pmu.c | 3 +-- > > drivers/perf/qcom_l3_pmu.c | 3 +-- > > drivers/perf/xgene_pmu.c | 3 +-- > > 8 files changed, 8 insertions(+), 36 deletions(-) > > > > diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c > > index 1bfeb16..d749f19 100644 > > --- a/drivers/perf/arm-cci.c > > +++ b/drivers/perf/arm-cci.c > > @@ -1328,12 +1328,7 @@ static int cci_pmu_event_init(struct perf_event *event) > > return -EOPNOTSUPP; > > > > /* We have no filtering of any kind */ > > - 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) > > + if (event_has_exclude_flags(event)) > > return -EINVAL; > > > > /* > > diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c > > index 7dd850e..9a22a95 100644 > > --- a/drivers/perf/arm-ccn.c > > +++ b/drivers/perf/arm-ccn.c > > @@ -741,10 +741,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) > > return -EOPNOTSUPP; > > } > > > > - if (has_branch_stack(event) || event->attr.exclude_user || > > - event->attr.exclude_kernel || event->attr.exclude_hv || > > - event->attr.exclude_idle || event->attr.exclude_host || > > - event->attr.exclude_guest) { > > + if (has_branch_stack(event) || event_has_exclude_flags(event)) { > > dev_dbg(ccn->dev, "Can't exclude execution levels!\n"); > > return -EINVAL; > > } > > diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c > > index 660cb8a..300ff3d 100644 > > --- a/drivers/perf/arm_dsu_pmu.c > > +++ b/drivers/perf/arm_dsu_pmu.c > > @@ -563,12 +563,7 @@ static int dsu_pmu_event_init(struct perf_event *event) > > } > > > > if (has_branch_stack(event) || > > - event->attr.exclude_user || > > - event->attr.exclude_kernel || > > - event->attr.exclude_hv || > > - event->attr.exclude_idle || > > - event->attr.exclude_host || > > - event->attr.exclude_guest) { > > + event_has_exclude_flags(event)) { > > dev_dbg(dsu_pmu->pmu.dev, "Can't support filtering\n"); > > return -EINVAL; > > } > > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c > > index 7f01f6f..a03634f 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); > > @@ -395,7 +388,7 @@ __hw_perf_event_init(struct perf_event *event) > > */ > > if ((!armpmu->set_event_filter || > > armpmu->set_event_filter(hwc, &event->attr)) && > > - event_requires_mode_exclusion(&event->attr)) { > > + event_has_exclude_flags(event)) { > > pr_debug("ARM performance counters do not support " > > "mode exclusion\n"); > > return -EOPNOTSUPP; > > diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c > > index 9efd241..d3edff9 100644 > > --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c > > +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c > > @@ -143,12 +143,7 @@ int hisi_uncore_pmu_event_init(struct perf_event *event) > > return -EOPNOTSUPP; > > > > /* counters do not have these bits */ > > - if (event->attr.exclude_user || > > - event->attr.exclude_kernel || > > - event->attr.exclude_host || > > - event->attr.exclude_guest || > > - event->attr.exclude_hv || > > - event->attr.exclude_idle) > > + if (event_has_exclude_flags(event)) > > return -EINVAL; > > > > /* > > diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c > > index 842135c..d7d85a2 100644 > > --- a/drivers/perf/qcom_l2_pmu.c > > +++ b/drivers/perf/qcom_l2_pmu.c > > @@ -510,8 +510,7 @@ static int l2_cache_event_init(struct perf_event *event) > > } > > > > /* We cannot filter accurately so we just don't allow it. */ > > - if (event->attr.exclude_user || event->attr.exclude_kernel || > > - event->attr.exclude_hv || event->attr.exclude_idle) { > > + if (event_has_exclude_flags(event)) { > > dev_dbg_ratelimited(&l2cache_pmu->pdev->dev, > > "Can't exclude execution levels\n"); > > return -EOPNOTSUPP; > > diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c > > index 2dc63d6..f27af67 100644 > > --- a/drivers/perf/qcom_l3_pmu.c > > +++ b/drivers/perf/qcom_l3_pmu.c > > @@ -497,8 +497,7 @@ static int qcom_l3_cache__event_init(struct perf_event *event) > > /* > > * There are no per-counter mode filters in the PMU. > > */ > > - if (event->attr.exclude_user || event->attr.exclude_kernel || > > - event->attr.exclude_hv || event->attr.exclude_idle) > > + if (event_has_exclude_flags(event)) > > return -EINVAL; > > > > /* > > diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c > > index 0e31f13..1fcd5a0 100644 > > --- a/drivers/perf/xgene_pmu.c > > +++ b/drivers/perf/xgene_pmu.c > > @@ -915,8 +915,7 @@ static int xgene_perf_event_init(struct perf_event *event) > > return -EINVAL; > > > > /* SOC counters do not have usr/os/guest/host bits */ > > - if (event->attr.exclude_user || event->attr.exclude_kernel || > > - event->attr.exclude_host || event->attr.exclude_guest) > > + if (event_has_exclude_flags(event)) > > return -EINVAL; > > > > if (event->cpu < 0) > > -- > > 2.7.4 > >