[REGRESSION] Perf (userspace) broken on big.LITTLE systems since v6.5

From: Hector Martin
Date: Tue Nov 21 2023 - 07:09:03 EST


Perf broke on all Apple ARM64 systems (tested almost everything), and
according to maz also on Juno (so, probably all big.LITTLE) since v6.5.

Test command:

sudo taskset -c 0 ./perf stat -e apple_icestorm_pmu/cycles/ -e
apple_firestorm_pmu/cycles/ -e cycles ls

Since this is taskset to CPU #0 (LITTLE core, icestorm), only events for
icestorm are expected.

I bisected the breakage to two distinct points:

5ea8f2ccffb is the first bad commit. With its parent, the output is as
expected (same as v6.4):

3,297,462 apple_icestorm_pmu/cycles/

<not counted> apple_firestorm_pmu/cycles/
(0.00%)
<not counted> cycles
(0.00%)

With 5ea8f2ccffb everything breaks:

<not supported> apple_icestorm_pmu/cycles/

<not supported> apple_firestorm_pmu/cycles/

<not counted> cycles
(0.00%)

Somewhere along the way to 82fe2e45cdb00 things get even worse (didn't
bother bisecting this range). With its parent:

<not supported> apple_icestorm_pmu/cycles/

<not supported> apple_firestorm_pmu/cycles/

<not supported> apple_icestorm_pmu/cycles/

<not supported> apple_firestorm_pmu/cycles/

Then 82fe2e45cdb00 leads to the current v6.5 behavior:

<not counted> apple_icestorm_pmu/cycles/
(0.00%)
<not counted> apple_firestorm_pmu/cycles/
(0.00%)
<not counted> cycles
(0.00%)

If I taskset the task to CPU#2 (big core, firestorm), I get events:

1,454,858 apple_icestorm_pmu/cycles/

1,454,760 apple_firestorm_pmu/cycles/

1,454,384 cycles


So the current behavior is that all output seems to come from the
firestorm PMU event counter, regardless of requested event.

This is all unchanged and still broken in v6.7-rc2.

- Hector