perf/core, arch/powerpc: use PERF_PMU_CAP_NO_EXCLUDE for exclusion incapable PMUs
authorAndrew Murray <andrew.murray@arm.com>
Thu, 10 Jan 2019 13:53:31 +0000 (13:53 +0000)
committerIngo Molnar <mingo@kernel.org>
Mon, 21 Jan 2019 10:01:26 +0000 (11:01 +0100)
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 <andrew.murray@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: robin.murphy@arm.com
Cc: suzuki.poulose@arm.com
Link: https://lkml.kernel.org/r/1547128414-50693-10-git-send-email-andrew.murray@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/powerpc/perf/hv-24x7.c
arch/powerpc/perf/hv-gpci.c
arch/powerpc/perf/imc-pmu.c

index 72238eedc360fa1d24fa382c2d696097739d44c5..d2b8e6061933aa855a752bc2bf1cd79c0822b7c2 100644 (file)
@@ -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)
index 43fabb3cae0fa2cd1895732332f8929cb88e147e..735e77b09cdb77c6bd3a1ca6be887cbecb326840 100644 (file)
@@ -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)
index f292a3f284f1cfaf15ecc5084efe2214206ed8d3..b1c37cc3fa98bfcb34d5b4904e351ebe7496e9cf 100644 (file)
@@ -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) {