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

perf/core, arch/arm: Use PERF_PMU_CAP_NO_EXCLUDE for exclusion incapable PMUs

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: Shawn Guo <shawnguo@kernel.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: 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-7-git-send-email-andrew.murray@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Andrew Murray and committed by
Ingo Molnar
cafa780e 1d899c0e

+3 -15
+2 -7
arch/arm/mach-imx/mmdc.c
··· 294 294 return -EOPNOTSUPP; 295 295 } 296 296 297 - if (event->attr.exclude_user || 298 - event->attr.exclude_kernel || 299 - event->attr.exclude_hv || 300 - event->attr.exclude_idle || 301 - event->attr.exclude_host || 302 - event->attr.exclude_guest || 303 - event->attr.sample_period) 297 + if (event->attr.sample_period) 304 298 return -EINVAL; 305 299 306 300 if (cfg < 0 || cfg >= MMDC_NUM_COUNTERS) ··· 450 456 .start = mmdc_pmu_event_start, 451 457 .stop = mmdc_pmu_event_stop, 452 458 .read = mmdc_pmu_event_update, 459 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 453 460 }, 454 461 .mmdc_base = mmdc_base, 455 462 .dev = dev,
+1 -8
arch/arm/mm/cache-l2x0-pmu.c
··· 314 314 event->attach_state & PERF_ATTACH_TASK) 315 315 return -EINVAL; 316 316 317 - if (event->attr.exclude_user || 318 - event->attr.exclude_kernel || 319 - event->attr.exclude_hv || 320 - event->attr.exclude_idle || 321 - event->attr.exclude_host || 322 - event->attr.exclude_guest) 323 - return -EINVAL; 324 - 325 317 if (event->cpu < 0) 326 318 return -EINVAL; 327 319 ··· 536 544 .del = l2x0_pmu_event_del, 537 545 .event_init = l2x0_pmu_event_init, 538 546 .attr_groups = l2x0_pmu_attr_groups, 547 + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, 539 548 }; 540 549 541 550 l2x0_pmu_reset();