Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

For drivers 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>
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>

authored by

Andrew Murray and committed by
Ingo Molnar
30656398 cafa780e

+9 -38
+1 -9
drivers/perf/arm-cci.c
··· 1327 1327 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) 1328 1328 return -EOPNOTSUPP; 1329 1329 1330 - /* We have no filtering of any kind */ 1331 - if (event->attr.exclude_user || 1332 - event->attr.exclude_kernel || 1333 - event->attr.exclude_hv || 1334 - event->attr.exclude_idle || 1335 - event->attr.exclude_host || 1336 - event->attr.exclude_guest) 1337 - return -EINVAL; 1338 - 1339 1330 /* 1340 1331 * Following the example set by other "uncore" PMUs, we accept any CPU 1341 1332 * and rewrite its affinity dynamically rather than having perf core ··· 1424 1433 .stop = cci_pmu_stop, 1425 1434 .read = pmu_read, 1426 1435 .attr_groups = pmu_attr_groups, 1436 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 1427 1437 }; 1428 1438 1429 1439 cci_pmu->plat_device = pdev;
+2 -4
drivers/perf/arm-ccn.c
··· 741 741 return -EOPNOTSUPP; 742 742 } 743 743 744 - if (has_branch_stack(event) || event->attr.exclude_user || 745 - event->attr.exclude_kernel || event->attr.exclude_hv || 746 - event->attr.exclude_idle || event->attr.exclude_host || 747 - event->attr.exclude_guest) { 744 + if (has_branch_stack(event)) { 748 745 dev_dbg(ccn->dev, "Can't exclude execution levels!\n"); 749 746 return -EINVAL; 750 747 } ··· 1287 1290 .read = arm_ccn_pmu_event_read, 1288 1291 .pmu_enable = arm_ccn_pmu_enable, 1289 1292 .pmu_disable = arm_ccn_pmu_disable, 1293 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 1290 1294 }; 1291 1295 1292 1296 /* No overflow interrupt? Have to use a timer instead. */
+2 -7
drivers/perf/arm_dsu_pmu.c
··· 562 562 return -EINVAL; 563 563 } 564 564 565 - if (has_branch_stack(event) || 566 - event->attr.exclude_user || 567 - event->attr.exclude_kernel || 568 - event->attr.exclude_hv || 569 - event->attr.exclude_idle || 570 - event->attr.exclude_host || 571 - event->attr.exclude_guest) { 565 + if (has_branch_stack(event)) { 572 566 dev_dbg(dsu_pmu->pmu.dev, "Can't support filtering\n"); 573 567 return -EINVAL; 574 568 } ··· 729 735 .read = dsu_pmu_read, 730 736 731 737 .attr_groups = dsu_pmu_attr_groups, 738 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 732 739 }; 733 740 734 741 rc = perf_pmu_register(&dsu_pmu->pmu, name, -1);
+1
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
··· 396 396 .stop = hisi_uncore_pmu_stop, 397 397 .read = hisi_uncore_pmu_read, 398 398 .attr_groups = hisi_ddrc_pmu_attr_groups, 399 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 399 400 }; 400 401 401 402 ret = perf_pmu_register(&ddrc_pmu->pmu, name, -1);
+1
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
··· 407 407 .stop = hisi_uncore_pmu_stop, 408 408 .read = hisi_uncore_pmu_read, 409 409 .attr_groups = hisi_hha_pmu_attr_groups, 410 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 410 411 }; 411 412 412 413 ret = perf_pmu_register(&hha_pmu->pmu, name, -1);
+1
drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
··· 397 397 .stop = hisi_uncore_pmu_stop, 398 398 .read = hisi_uncore_pmu_read, 399 399 .attr_groups = hisi_l3c_pmu_attr_groups, 400 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 400 401 }; 401 402 402 403 ret = perf_pmu_register(&l3c_pmu->pmu, name, -1);
-9
drivers/perf/hisilicon/hisi_uncore_pmu.c
··· 142 142 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) 143 143 return -EOPNOTSUPP; 144 144 145 - /* counters do not have these bits */ 146 - if (event->attr.exclude_user || 147 - event->attr.exclude_kernel || 148 - event->attr.exclude_host || 149 - event->attr.exclude_guest || 150 - event->attr.exclude_hv || 151 - event->attr.exclude_idle) 152 - return -EINVAL; 153 - 154 145 /* 155 146 * The uncore counters not specific to any CPU, so cannot 156 147 * support per-task
+1 -9
drivers/perf/thunderx2_pmu.c
··· 424 424 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) 425 425 return -EINVAL; 426 426 427 - /* We have no filtering of any kind */ 428 - if (event->attr.exclude_user || 429 - event->attr.exclude_kernel || 430 - event->attr.exclude_hv || 431 - event->attr.exclude_idle || 432 - event->attr.exclude_host || 433 - event->attr.exclude_guest) 434 - return -EINVAL; 435 - 436 427 if (event->cpu < 0) 437 428 return -EINVAL; 438 429 ··· 563 572 .start = tx2_uncore_event_start, 564 573 .stop = tx2_uncore_event_stop, 565 574 .read = tx2_uncore_event_read, 575 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 566 576 }; 567 577 568 578 tx2_pmu->pmu.name = devm_kasprintf(dev, GFP_KERNEL,