mbox series

[0/2] arm_pmu: fix fallout from context handling rewrite

Message ID 20230216141240.3833272-1-mark.rutland@arm.com (mailing list archive)
Headers show
Series arm_pmu: fix fallout from context handling rewrite | expand

Message

Mark Rutland Feb. 16, 2023, 2:12 p.m. UTC
Janne reports [1] that perf has been broken on Apple M1 as of commit:

  bd27568117664b8b ("perf: Rewrite core context handling")

This is due to changes to pmu::filter_match() and
arm_pmu::filter_match(), which have been renamed and had their polarity
inverted, but the conversion was inconsistent, and so in some cases we
return the opposite result relative to what we had intended. This
results in consistently losing events on Apple M1.

That commit also (silently) removed the filtering of CHAIN events, which
is undesireable.

These patches fix and simplify the CPU filtering, and replace the CHAIN
event filtering with early rejection of CHAIN events, which is much
simpler.

Thanks,
Mark

[1] https://lore.kernel.org/asahi/20230215-arm_pmu_m1_regression-v1-1-f5a266577c8d@jannau.net/

Mark Rutland (2):
  arm_pmu: fix event CPU filtering
  arm64: perf: reject CHAIN events at creation time

 arch/arm64/kernel/perf_event.c | 15 ++++++++-------
 drivers/perf/arm_pmu.c         |  8 +-------
 include/linux/perf/arm_pmu.h   |  1 -
 3 files changed, 9 insertions(+), 15 deletions(-)

Comments

Will Deacon Feb. 16, 2023, 10:14 p.m. UTC | #1
On Thu, 16 Feb 2023 14:12:37 +0000, Mark Rutland wrote:
> Janne reports [1] that perf has been broken on Apple M1 as of commit:
> 
>   bd27568117664b8b ("perf: Rewrite core context handling")
> 
> This is due to changes to pmu::filter_match() and
> arm_pmu::filter_match(), which have been renamed and had their polarity
> inverted, but the conversion was inconsistent, and so in some cases we
> return the opposite result relative to what we had intended. This
> results in consistently losing events on Apple M1.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/2] arm_pmu: fix event CPU filtering
      https://git.kernel.org/arm64/c/61d038627343
[2/2] arm64: perf: reject CHAIN events at creation time
      https://git.kernel.org/arm64/c/853e2dac25c1

Cheers,