From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F83EC04EB8 for ; Mon, 10 Dec 2018 03:51:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 016062081F for ; Mon, 10 Dec 2018 03:51:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 016062081F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726374AbeLJDvm (ORCPT ); Sun, 9 Dec 2018 22:51:42 -0500 Received: from ozlabs.org ([203.11.71.1]:39177 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbeLJDvm (ORCPT ); Sun, 9 Dec 2018 22:51:42 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43Cpz75ClMz9s47; Mon, 10 Dec 2018 14:51:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Andrew Murray , 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 Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v3 09/12] powerpc: perf/core: use PERF_PMU_CAP_NO_EXCLUDE for exclude incapable PMUs In-Reply-To: <1544114849-47266-10-git-send-email-andrew.murray@arm.com> References: <1544114849-47266-1-git-send-email-andrew.murray@arm.com> <1544114849-47266-10-git-send-email-andrew.murray@arm.com> Date: Mon, 10 Dec 2018 14:51:31 +1100 Message-ID: <87bm5uf398.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew Murray writes: > 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 > --- > 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(-) Looks good. Acked-by: Michael Ellerman (powerpc) cheers > 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 1fafc32b..1dbb0ee 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