For drivers that do not support context exclusion let's advertise the
authorAndrew Murray <andrew.murray@arm.com>
Thu, 10 Jan 2019 13:53:29 +0000 (13:53 +0000)
committerIngo Molnar <mingo@kernel.org>
Mon, 21 Jan 2019 10:01:24 +0000 (11:01 +0100)
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>
Acked-by: Will Deacon <will.deacon@arm.com>
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: Michael Ellerman <mpe@ellerman.id.au>
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: 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-8-git-send-email-andrew.murray@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/perf/arm-cci.c
drivers/perf/arm-ccn.c
drivers/perf/arm_dsu_pmu.c
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
drivers/perf/hisilicon/hisi_uncore_pmu.c
drivers/perf/thunderx2_pmu.c

index 1bfeb160c5b16b841f34415efbfaba97972f747b..bfd03e0233084e4c1a9bc11882f4f0695f6ed71e 100644 (file)
@@ -1327,15 +1327,6 @@ static int cci_pmu_event_init(struct perf_event *event)
        if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
                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)
-               return -EINVAL;
-
        /*
         * Following the example set by other "uncore" PMUs, we accept any CPU
         * and rewrite its affinity dynamically rather than having perf core
@@ -1433,6 +1424,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)
                .stop           = cci_pmu_stop,
                .read           = pmu_read,
                .attr_groups    = pmu_attr_groups,
+               .capabilities   = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        cci_pmu->plat_device = pdev;
index 7dd850e02f192e43fbb9ad3ab6868975d4170abe..2ae76026e947fc38f0fb4ab1c33b601f42cc7e51 100644 (file)
@@ -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)) {
                dev_dbg(ccn->dev, "Can't exclude execution levels!\n");
                return -EINVAL;
        }
@@ -1290,6 +1287,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
                .read = arm_ccn_pmu_event_read,
                .pmu_enable = arm_ccn_pmu_enable,
                .pmu_disable = arm_ccn_pmu_disable,
+               .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        /* No overflow interrupt? Have to use a timer instead. */
index 660cb8ac886ac9bb11319c5205f6dfd451264a8d..5851de56bbd03d1ee05045cda3adf2a0c4dafb3d 100644 (file)
@@ -562,13 +562,7 @@ static int dsu_pmu_event_init(struct perf_event *event)
                return -EINVAL;
        }
 
-       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)) {
                dev_dbg(dsu_pmu->pmu.dev, "Can't support filtering\n");
                return -EINVAL;
        }
@@ -735,6 +729,7 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)
                .read           = dsu_pmu_read,
 
                .attr_groups    = dsu_pmu_attr_groups,
+               .capabilities   = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        rc = perf_pmu_register(&dsu_pmu->pmu, name, -1);
index 69372e2bc93c7df0ce3921d6b9666773d80bbef2..0eba947c2ee9035ed5a07fb9cc707cf15139bb0a 100644 (file)
@@ -396,6 +396,7 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev)
                .stop           = hisi_uncore_pmu_stop,
                .read           = hisi_uncore_pmu_read,
                .attr_groups    = hisi_ddrc_pmu_attr_groups,
+               .capabilities   = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        ret = perf_pmu_register(&ddrc_pmu->pmu, name, -1);
index 443906e0aff3edad67ebd2514473b1f11f3dbeea..2553a844ebf60771b3b75e1c60b2a03aa217cf3d 100644 (file)
@@ -407,6 +407,7 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev)
                .stop           = hisi_uncore_pmu_stop,
                .read           = hisi_uncore_pmu_read,
                .attr_groups    = hisi_hha_pmu_attr_groups,
+               .capabilities   = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        ret = perf_pmu_register(&hha_pmu->pmu, name, -1);
index 0bde5d919b2eb49db7c0a8dc3d5f99b028b1930d..cf1cc34f402af8c20aee9b81183d92c19d05072b 100644 (file)
@@ -397,6 +397,7 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev)
                .stop           = hisi_uncore_pmu_stop,
                .read           = hisi_uncore_pmu_read,
                .attr_groups    = hisi_l3c_pmu_attr_groups,
+               .capabilities   = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        ret = perf_pmu_register(&l3c_pmu->pmu, name, -1);
index 9efd2413240cb43ceb0471363cbd679ca776748c..f028cbc3443c466654495cb079fc5cc472a109cd 100644 (file)
@@ -142,15 +142,6 @@ int hisi_uncore_pmu_event_init(struct perf_event *event)
        if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
                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)
-               return -EINVAL;
-
        /*
         *  The uncore counters not specific to any CPU, so cannot
         *  support per-task
index c9a1701d3e542998ee08ae54dea08347fc40ca19..43d76c85da56b7a4941e28f435c2877f3d512a08 100644 (file)
@@ -424,15 +424,6 @@ static int tx2_uncore_event_init(struct perf_event *event)
        if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
                return -EINVAL;
 
-       /* 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)
-               return -EINVAL;
-
        if (event->cpu < 0)
                return -EINVAL;
 
@@ -572,6 +563,7 @@ static int tx2_uncore_pmu_register(
                .start          = tx2_uncore_event_start,
                .stop           = tx2_uncore_event_stop,
                .read           = tx2_uncore_event_read,
+               .capabilities   = PERF_PMU_CAP_NO_EXCLUDE,
        };
 
        tx2_pmu->pmu.name = devm_kasprintf(dev, GFP_KERNEL,