Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2920348imu; Mon, 19 Nov 2018 08:05:44 -0800 (PST) X-Google-Smtp-Source: AJdET5fnhoh7/9uWFRL0usQQDGRf/1LX9gyBIfmbhnESpsxE7+AsFclGCUYxoUNJY57hcC47VKaH X-Received: by 2002:a63:bc02:: with SMTP id q2mr20837588pge.116.1542643544545; Mon, 19 Nov 2018 08:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542643544; cv=none; d=google.com; s=arc-20160816; b=QZdes7XWNTZDdzpslndvRZNIKbk8/8DLtPqMZi/lpnTqkdA+lB61HpbDJV/USZy0Qs PA4mXIDqDnHJJDsW66bSwKbpBPuX2kmfPy/JFCNw1z3HX/owIEuQS/gG/NYEVbb9fIwU COq5Ob85/vc5imN1ekqJC3UbAOtG1wcel796KOWHkZqLFGRGyGhtiELWLNeDHdzhl0k/ GtmR+U1mnQ+fCb6BJB9SfN71BP2q/gqY2VHou4VC5M7tJ7nwWfNwz1BRbcNsdyHWkS/V ywIK3+PM7TisCY7Vv1evGT/hQushmal48rsZ75g1ZK2rq6ED84E82C+QimljEhcM5Iri qMWQ== 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=y5cDymUYLPhT2w7H5xGoxOFG8hqRGtgTBs+JZ7ryQgA=; b=ADcqTeflrnnv8KheA8nisauHsc8bNJIwGtsZDIXFBj0Rtnp4zV10yFExKzpO+0IPCH 8XhsSd2gvRS83Bf3gqVH021L71DIutTKdl2wNtZRtvraBglCCWeoqYUJ630RnsxO/n0Z CyuSDHfKvrbVXJVMuQFlGA8dYdLBUrIROrzPtjTwHbdXg8J82s1gzoG1bNz/9EEHH63A RoSU4DzZ2WDi6+WlS4YViqTU1cebaECafpD38fSF4GKVkO+seF9SGE7xzffiDbxDbfIR hTbO2P+w1K7TGRqwSHuoebBZ42NFj0azCoYV8Lwt849NmS/3nQ654GrDc2q2/or/Tphq TBKg== 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 o9-v6si31216340plk.434.2018.11.19.08.05.19; Mon, 19 Nov 2018 08:05:44 -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 S1730000AbeKTC16 (ORCPT + 99 others); Mon, 19 Nov 2018 21:27:58 -0500 Received: from foss.arm.com ([217.140.101.70]:60430 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729796AbeKTC16 (ORCPT ); Mon, 19 Nov 2018 21:27:58 -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 A970680D; Mon, 19 Nov 2018 08:03:57 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2CC013F575; Mon, 19 Nov 2018 08:03:55 -0800 (PST) Date: Mon, 19 Nov 2018 16:03:52 +0000 From: Mark Rutland To: Andrew Murray 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: <20181119160352.ua2lx72l754imiek@lakrids.cambridge.arm.com> References: <1542363853-13849-1-git-send-email-andrew.murray@arm.com> <1542363853-13849-10-git-send-email-andrew.murray@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1542363853-13849-10-git-send-email-andrew.murray@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 >