Legacy hardware/cache events as json
Subsystems (2)
Ian Rogers
reviewercover Legacy hardware/cache events as json
Mirroring similar work for software events in commit 6e9fa4131abb ("perf parse-events: Remove non-json software events"). These changes migrate the legacy hardware and cache events to json. With no hard coded legacy hardware or cache events the wild card, case insensitivity, etc. is consistent for events. This does, however, mean events like cycles will wild card against all PMUs. A change does the same was originally posted and merged from:
https://lore.kernel.org/r/[email protected]
and reverted by Linus in commit 4f1b067359ac ("Revert "perf
parse-events: Prefer sysfs/JSON hardware events over legacy"") due to his dislike for the cycles behavior on ARM. Earlier patches in this series make perf record event opening failures non-fatal and hide the cycles event's failure to open on ARM in perf record, so it is expected the behavior will now be transparent in perf record on ARM. perf stat with a cycles event will wildcard open the event on all PMUs.
The change to support legacy events with PMUs was done to clean up Intel's hybrid PMU implementation. Having sysfs/json events with increased priority to legacy was requested by Mark Rutland
<[email protected]> to fix Apple-M PMU issues wrt broken legacy
events on that PMU. It was requested that RISC-V be able to add events to the perf tool json so the PMU driver didn't need to map legacy events to config encodings:
https://lore.kernel.org/lkml/[email protected]/
A previous series of patches decreasing legacy hardware event priorities was posted in:
https://lore.kernel.org/lkml/[email protected]/
Namhyung Kim <[email protected]> mentioned that hardware and software events can be implemented similarly:
https://lore.kernel.org/lkml/[email protected]/
and this patch series achieves this.
The perf list behavior before is:
```
$ perf list hw
List of pre-defined events (to be used in -e or -M):
branch-instructions OR branches [Hardware event]
branch-misses [Hardware event]
bus-cycles [Hardware event]
cache-misses [Hardware event]
cache-references [Hardware event]
cpu-cycles OR cycles [Hardware event]
instructions [Hardware event]
ref-cycles [Hardware event]
$ perf list hwcache
List of pre-defined events (to be used in -e or -M):
cache:
L1-dcache-loads OR cpu/L1-dcache-loads/
L1-dcache-load-misses OR cpu/L1-dcache-load-misses/
L1-dcache-stores OR cpu/L1-dcache-stores/
L1-icache-load-misses OR cpu/L1-icache-load-misses/
LLC-loads OR cpu/LLC-loads/
LLC-load-misses OR cpu/LLC-load-misses/
LLC-stores OR cpu/LLC-stores/
LLC-store-misses OR cpu/LLC-store-misses/
dTLB-loads OR cpu/dTLB-loads/
dTLB-load-misses OR cpu/dTLB-load-misses/
dTLB-stores OR cpu/dTLB-stores/
dTLB-store-misses OR cpu/dTLB-store-misses/
iTLB-load-misses OR cpu/iTLB-load-misses/
branch-loads OR cpu/branch-loads/
branch-load-misses OR cpu/branch-load-misses/
node-loads OR cpu/node-loads/
node-load-misses OR cpu/node-load-misses/
node-stores OR cpu/node-stores/
node-store-misses OR cpu/node-store-misses/
```
and after it is:
```
$ perf list hw
legacy hardware:
branch-instructions
[Retired branch instructions [This event is an alias of branches].
Unit: cpu]
branch-misses
[Mispredicted branch instructions. Unit: cpu]
branches
[Retired branch instructions [This event is an alias of
branch-instructions]. Unit: cpu]
bus-cycles
[Bus cycles,which can be different from total cycles. Unit: cpu]
cache-misses
[Cache misses. Usually this indicates Last Level Cache misses; this is
intended to be used in conjunction with the
PERF_COUNT_HW_CACHE_REFERENCES event to calculate cache miss rates.
Unit: cpu]
cache-references
[Cache accesses. Usually this indicates Last Level Cache accesses but
this may vary depending on your CPU. This may include prefetches and
coherency messages; again this depends on the design of your CPU.
Unit: cpu]
cpu-cycles
[Total cycles. Be wary of what happens during CPU frequency scaling
[This event is an alias of cycles]. Unit: cpu]
cycles
[Total cycles. Be wary of what happens during CPU frequency scaling
[This event is an alias of cpu-cycles]. Unit: cpu]
instructions
[Retired instructions. Be careful,these can be affected by various
issues,most notably hardware interrupt counts. Unit: cpu]
ref-cycles
[Total cycles; not affected by CPU frequency scaling. Unit: cpu]
$ perf list hwcache
legacy cache:
bpc
[Branch prediction unit read accesses. Unit: cpu]
bpc-access
[Branch prediction unit read accesses. Unit: cpu]
bpc-load
[Branch prediction unit read accesses. Unit: cpu]
bpc-load-access
[Branch prediction unit read accesses. Unit: cpu]
bpc-load-miss
[Branch prediction unit read misses. Unit: cpu]
bpc-load-misses
[Branch prediction unit read misses. Unit: cpu]
bpc-load-ops
[Branch prediction unit read accesses. Unit: cpu]
bpc-load-reference
[Branch prediction unit read accesses. Unit: cpu]
bpc-load-refs
[Branch prediction unit read accesses. Unit: cpu]
bpc-loads
[Branch prediction unit read accesses. Unit: cpu]
bpc-loads-access
[Branch prediction unit read accesses. Unit: cpu]
bpc-loads-miss
[Branch prediction unit read misses. Unit: cpu]
bpc-loads-misses
[Branch prediction unit read misses. Unit: cpu]
bpc-loads-ops
[Branch prediction unit read accesses. Unit: cpu]
bpc-loads-reference
[Branch prediction unit read accesses. Unit: cpu]
bpc-loads-refs
[Branch prediction unit read accesses. Unit: cpu]
bpc-miss
[Branch prediction unit read misses. Unit: cpu]
bpc-misses
[Branch prediction unit read misses. Unit: cpu]
bpc-ops
[Branch prediction unit read accesses. Unit: cpu]
bpc-read
[Branch prediction unit read accesses. Unit: cpu]
bpc-read-access
[Branch prediction unit read accesses. Unit: cpu]
bpc-read-miss
[Branch prediction unit read misses. Unit: cpu]
bpc-read-misses
[Branch prediction unit read misses. Unit: cpu]
bpc-read-ops
[Branch prediction unit read accesses. Unit: cpu]
bpc-read-reference
[Branch prediction unit read accesses. Unit: cpu]
bpc-read-refs
[Branch prediction unit read accesses. Unit: cpu]
bpc-reference
[Branch prediction unit read accesses. Unit: cpu]
bpc-refs
[Branch prediction unit read accesses. Unit: cpu]
bpu
[Branch prediction unit read accesses. Unit: cpu]
bpu-access
[Branch prediction unit read accesses. Unit: cpu]
bpu-load
[Branch prediction unit read accesses. Unit: cpu]
bpu-load-access
[Branch prediction unit read accesses. Unit: cpu]
bpu-load-miss
[Branch prediction unit read misses. Unit: cpu]
bpu-load-misses
[Branch prediction unit read misses. Unit: cpu]
bpu-load-ops
[Branch prediction unit read accesses. Unit: cpu]
bpu-load-reference
[Branch prediction unit read accesses. Unit: cpu]
bpu-load-refs
[Branch prediction unit read accesses. Unit: cpu]
bpu-loads
[Branch prediction unit read accesses. Unit: cpu]
bpu-loads-access
[Branch prediction unit read accesses. Unit: cpu]
bpu-loads-miss
[Branch prediction unit read misses. Unit: cpu]
bpu-loads-misses
[Branch prediction unit read misses. Unit: cpu]
bpu-loads-ops
[Branch prediction unit read accesses. Unit: cpu]
bpu-loads-reference
[Branch prediction unit read accesses. Unit: cpu]
bpu-loads-refs
[Branch prediction unit read accesses. Unit: cpu]
bpu-miss
[Branch prediction unit read misses. Unit: cpu]
bpu-misses
[Branch prediction unit read misses. Unit: cpu]
bpu-ops
[Branch prediction unit read accesses. Unit: cpu]
bpu-read
[Branch prediction unit read accesses. Unit: cpu]
bpu-read-access
[Branch prediction unit read accesses. Unit: cpu]
bpu-read-miss
[Branch prediction unit read misses. Unit: cpu]
bpu-read-misses
[Branch prediction unit read misses. Unit: cpu]
bpu-read-ops
[Branch prediction unit read accesses. Unit: cpu]
bpu-read-reference
[Branch prediction unit read accesses. Unit: cpu]
bpu-read-refs
[Branch prediction unit read accesses. Unit: cpu]
bpu-reference
[Branch prediction unit read accesses. Unit: cpu]
bpu-refs
[Branch prediction unit read accesses. Unit: cpu]
branch
[Branch prediction unit read accesses. Unit: cpu]
branch-access
[Branch prediction unit read accesses. Unit: cpu]
branch-load
[Branch prediction unit read accesses. Unit: cpu]
branch-load-access
[Branch prediction unit read accesses. Unit: cpu]
branch-load-miss
[Branch prediction unit read misses. Unit: cpu]
branch-load-misses
[Branch prediction unit read misses. Unit: cpu]
branch-load-ops
[Branch prediction unit read accesses. Unit: cpu]
branch-load-reference
[Branch prediction unit read accesses. Unit: cpu]
branch-load-refs
[Branch prediction unit read accesses. Unit: cpu]
branch-loads
[Branch prediction unit read accesses. Unit: cpu]
branch-loads-access
[Branch prediction unit read accesses. Unit: cpu]
branch-loads-miss
[Branch prediction unit read misses. Unit: cpu]
branch-loads-misses
[Branch prediction unit read misses. Unit: cpu]
branch-loads-ops
[Branch prediction unit read accesses. Unit: cpu]
branch-loads-reference
[Branch prediction unit read accesses. Unit: cpu]
branch-loads-refs
[Branch prediction unit read accesses. Unit: cpu]
branch-miss
[Branch prediction unit read misses. Unit: cpu]
branch-ops
[Branch prediction unit read accesses. Unit: cpu]
branch-read
[Branch prediction unit read accesses. Unit: cpu]
branch-read-access
[Branch prediction unit read accesses. Unit: cpu]
branch-read-miss
[Branch prediction unit read misses. Unit: cpu]
branch-read-misses
[Branch prediction unit read misses. Unit: cpu]
branch-read-ops
[Branch prediction unit read accesses. Unit: cpu]
branch-read-reference
[Branch prediction unit read accesses. Unit: cpu]
branch-read-refs
[Branch prediction unit read accesses. Unit: cpu]
branch-reference
[Branch prediction unit read accesses. Unit: cpu]
branch-refs
[Branch prediction unit read accesses. Unit: cpu]
branches-access
[Branch prediction unit read accesses. Unit: cpu]
branches-load
[Branch prediction unit read accesses. Unit: cpu]
branches-load-access
[Branch prediction unit read accesses. Unit: cpu]
branches-load-miss
[Branch prediction unit read misses. Unit: cpu]
branches-load-misses
[Branch prediction unit read misses. Unit: cpu]
branches-load-ops
[Branch prediction unit read accesses. Unit: cpu]
branches-load-reference
[Branch prediction unit read accesses. Unit: cpu]
branches-load-refs
[Branch prediction unit read accesses. Unit: cpu]
branches-loads
[Branch prediction unit read accesses. Unit: cpu]
branches-loads-access
[Branch prediction unit read accesses. Unit: cpu]
branches-loads-miss
[Branch prediction unit read misses. Unit: cpu]
branches-loads-misses
[Branch prediction unit read misses. Unit: cpu]
branches-loads-ops
[Branch prediction unit read accesses. Unit: cpu]
branches-loads-reference
[Branch prediction unit read accesses. Unit: cpu]
branches-loads-refs
[Branch prediction unit read accesses. Unit: cpu]
branches-miss
[Branch prediction unit read misses. Unit: cpu]
branches-misses
[Branch prediction unit read misses. Unit: cpu]
branches-ops
[Branch prediction unit read accesses. Unit: cpu]
branches-read
[Branch prediction unit read accesses. Unit: cpu]
branches-read-access
[Branch prediction unit read accesses. Unit: cpu]
branches-read-miss
[Branch prediction unit read misses. Unit: cpu]
branches-read-misses
[Branch prediction unit read misses. Unit: cpu]
branches-read-ops
[Branch prediction unit read accesses. Unit: cpu]
branches-read-reference
[Branch prediction unit read accesses. Unit: cpu]
branches-read-refs
[Branch prediction unit read accesses. Unit: cpu]
branches-reference
[Branch prediction unit read accesses. Unit: cpu]
branches-refs
[Branch prediction unit read accesses. Unit: cpu]
btb
[Branch prediction unit read accesses. Unit: cpu]
btb-access
[Branch prediction unit read accesses. Unit: cpu]
btb-load
[Branch prediction unit read accesses. Unit: cpu]
btb-load-access
[Branch prediction unit read accesses. Unit: cpu]
btb-load-miss
[Branch prediction unit read misses. Unit: cpu]
btb-load-misses
[Branch prediction unit read misses. Unit: cpu]
btb-load-ops
[Branch prediction unit read accesses. Unit: cpu]
btb-load-reference
[Branch prediction unit read accesses. Unit: cpu]
btb-load-refs
[Branch prediction unit read accesses. Unit: cpu]
btb-loads
[Branch prediction unit read accesses. Unit: cpu]
btb-loads-access
[Branch prediction unit read accesses. Unit: cpu]
btb-loads-miss
[Branch prediction unit read misses. Unit: cpu]
btb-loads-misses
[Branch prediction unit read misses. Unit: cpu]
btb-loads-ops
[Branch prediction unit read accesses. Unit: cpu]
btb-loads-reference
[Branch prediction unit read accesses. Unit: cpu]
btb-loads-refs
[Branch prediction unit read accesses. Unit: cpu]
btb-miss
[Branch prediction unit read misses. Unit: cpu]
btb-misses
[Branch prediction unit read misses. Unit: cpu]
btb-ops
[Branch prediction unit read accesses. Unit: cpu]
btb-read
[Branch prediction unit read accesses. Unit: cpu]
btb-read-access
[Branch prediction unit read accesses. Unit: cpu]
btb-read-miss
[Branch prediction unit read misses. Unit: cpu]
btb-read-misses
[Branch prediction unit read misses. Unit: cpu]
btb-read-ops
[Branch prediction unit read accesses. Unit: cpu]
btb-read-reference
[Branch prediction unit read accesses. Unit: cpu]
btb-read-refs
[Branch prediction unit read accesses. Unit: cpu]
btb-reference
[Branch prediction unit read accesses. Unit: cpu]
btb-refs
[Branch prediction unit read accesses. Unit: cpu]
d-tlb
[Data TLB read accesses. Unit: cpu]
d-tlb-access
[Data TLB read accesses. Unit: cpu]
d-tlb-load
[Data TLB read accesses. Unit: cpu]
d-tlb-load-access
[Data TLB read accesses. Unit: cpu]
d-tlb-load-miss
[Data TLB read misses. Unit: cpu]
d-tlb-load-misses
[Data TLB read misses. Unit: cpu]
d-tlb-load-ops
[Data TLB read accesses. Unit: cpu]
d-tlb-load-reference
[Data TLB read accesses. Unit: cpu]
d-tlb-load-refs
[Data TLB read accesses. Unit: cpu]
d-tlb-loads
[Data TLB read accesses. Unit: cpu]
d-tlb-loads-access
[Data TLB read accesses. Unit: cpu]
d-tlb-loads-miss
[Data TLB read misses. Unit: cpu]
d-tlb-loads-misses
[Data TLB read misses. Unit: cpu]
d-tlb-loads-ops
[Data TLB read accesses. Unit: cpu]
d-tlb-loads-reference
[Data TLB read accesses. Unit: cpu]
d-tlb-loads-refs
[Data TLB read accesses. Unit: cpu]
d-tlb-miss
[Data TLB read misses. Unit: cpu]
d-tlb-misses
[Data TLB read misses. Unit: cpu]
d-tlb-ops
[Data TLB read accesses. Unit: cpu]
d-tlb-read
[Data TLB read accesses. Unit: cpu]
d-tlb-read-access
[Data TLB read accesses. Unit: cpu]
d-tlb-read-miss
[Data TLB read misses. Unit: cpu]
d-tlb-read-misses
[Data TLB read misses. Unit: cpu]
d-tlb-read-ops
[Data TLB read accesses. Unit: cpu]
d-tlb-read-reference
[Data TLB read accesses. Unit: cpu]
d-tlb-read-refs
[Data TLB read accesses. Unit: cpu]
d-tlb-reference
[Data TLB read accesses. Unit: cpu]
d-tlb-refs
[Data TLB read accesses. Unit: cpu]
d-tlb-store
[Data TLB write accesses. Unit: cpu]
d-tlb-store-access
[Data TLB write accesses. Unit: cpu]
d-tlb-store-miss
[Data TLB write misses. Unit: cpu]
d-tlb-store-misses
[Data TLB write misses. Unit: cpu]
d-tlb-store-ops
[Data TLB write accesses. Unit: cpu]
d-tlb-store-reference
[Data TLB write accesses. Unit: cpu]
d-tlb-store-refs
[Data TLB write accesses. Unit: cpu]
d-tlb-stores
[Data TLB write accesses. Unit: cpu]
d-tlb-stores-access
[Data TLB write accesses. Unit: cpu]
d-tlb-stores-miss
[Data TLB write misses. Unit: cpu]
d-tlb-stores-misses
[Data TLB write misses. Unit: cpu]
d-tlb-stores-ops
[Data TLB write accesses. Unit: cpu]
d-tlb-stores-reference
[Data TLB write accesses. Unit: cpu]
d-tlb-stores-refs
[Data TLB write accesses. Unit: cpu]
d-tlb-write
[Data TLB write accesses. Unit: cpu]
d-tlb-write-access
[Data TLB write accesses. Unit: cpu]
d-tlb-write-miss
[Data TLB write misses. Unit: cpu]
d-tlb-write-misses
[Data TLB write misses. Unit: cpu]
d-tlb-write-ops
[Data TLB write accesses. Unit: cpu]
d-tlb-write-reference
[Data TLB write accesses. Unit: cpu]
d-tlb-write-refs
[Data TLB write accesses. Unit: cpu]
data-tlb
[Data TLB read accesses. Unit: cpu]
data-tlb-access
[Data TLB read accesses. Unit: cpu]
data-tlb-load
[Data TLB read accesses. Unit: cpu]
data-tlb-load-access
[Data TLB read accesses. Unit: cpu]
data-tlb-load-miss
[Data TLB read misses. Unit: cpu]
data-tlb-load-misses
[Data TLB read misses. Unit: cpu]
data-tlb-load-ops
[Data TLB read accesses. Unit: cpu]
data-tlb-load-reference
[Data TLB read accesses. Unit: cpu]
data-tlb-load-refs
[Data TLB read accesses. Unit: cpu]
data-tlb-loads
[Data TLB read accesses. Unit: cpu]
data-tlb-loads-access
[Data TLB read accesses. Unit: cpu]
data-tlb-loads-miss
[Data TLB read misses. Unit: cpu]
data-tlb-loads-misses
[Data TLB read misses. Unit: cpu]
data-tlb-loads-ops
[Data TLB read accesses. Unit: cpu]
data-tlb-loads-reference
[Data TLB read accesses. Unit: cpu]
data-tlb-loads-refs
[Data TLB read accesses. Unit: cpu]
data-tlb-miss
[Data TLB read misses. Unit: cpu]
data-tlb-misses
[Data TLB read misses. Unit: cpu]
data-tlb-ops
[Data TLB read accesses. Unit: cpu]
data-tlb-read
[Data TLB read accesses. Unit: cpu]
data-tlb-read-access
[Data TLB read accesses. Unit: cpu]
data-tlb-read-miss
[Data TLB read misses. Unit: cpu]
data-tlb-read-misses
[Data TLB read misses. Unit: cpu]
data-tlb-read-ops
[Data TLB read accesses. Unit: cpu]
data-tlb-read-reference
[Data TLB read accesses. Unit: cpu]
data-tlb-read-refs
[Data TLB read accesses. Unit: cpu]
data-tlb-reference
[Data TLB read accesses. Unit: cpu]
data-tlb-refs
[Data TLB read accesses. Unit: cpu]
data-tlb-store
[Data TLB write accesses. Unit: cpu]
data-tlb-store-access
[Data TLB write accesses. Unit: cpu]
data-tlb-store-miss
[Data TLB write misses. Unit: cpu]
data-tlb-store-misses
[Data TLB write misses. Unit: cpu]
data-tlb-store-ops
[Data TLB write accesses. Unit: cpu]
data-tlb-store-reference
[Data TLB write accesses. Unit: cpu]
data-tlb-store-refs
[Data TLB write accesses. Unit: cpu]
data-tlb-stores
[Data TLB write accesses. Unit: cpu]
data-tlb-stores-access
[Data TLB write accesses. Unit: cpu]
data-tlb-stores-miss
[Data TLB write misses. Unit: cpu]
data-tlb-stores-misses
[Data TLB write misses. Unit: cpu]
data-tlb-stores-ops
[Data TLB write accesses. Unit: cpu]
data-tlb-stores-reference
[Data TLB write accesses. Unit: cpu]
data-tlb-stores-refs
[Data TLB write accesses. Unit: cpu]
data-tlb-write
[Data TLB write accesses. Unit: cpu]
data-tlb-write-access
[Data TLB write accesses. Unit: cpu]
data-tlb-write-miss
[Data TLB write misses. Unit: cpu]
data-tlb-write-misses
[Data TLB write misses. Unit: cpu]
data-tlb-write-ops
[Data TLB write accesses. Unit: cpu]
data-tlb-write-reference
[Data TLB write accesses. Unit: cpu]
data-tlb-write-refs
[Data TLB write accesses. Unit: cpu]
dtlb
[Data TLB read accesses. Unit: cpu]
dtlb-access
[Data TLB read accesses. Unit: cpu]
dtlb-load
[Data TLB read accesses. Unit: cpu]
dtlb-load-access
[Data TLB read accesses. Unit: cpu]
dtlb-load-miss
[Data TLB read misses. Unit: cpu]
dtlb-load-misses
[Data TLB read misses. Unit: cpu]
dtlb-load-ops
[Data TLB read accesses. Unit: cpu]
dtlb-load-reference
[Data TLB read accesses. Unit: cpu]
dtlb-load-refs
[Data TLB read accesses. Unit: cpu]
dtlb-loads
[Data TLB read accesses. Unit: cpu]
dtlb-loads-access
[Data TLB read accesses. Unit: cpu]
dtlb-loads-miss
[Data TLB read misses. Unit: cpu]
dtlb-loads-misses
[Data TLB read misses. Unit: cpu]
dtlb-loads-ops
[Data TLB read accesses. Unit: cpu]
dtlb-loads-reference
[Data TLB read accesses. Unit: cpu]
dtlb-loads-refs
[Data TLB read accesses. Unit: cpu]
dtlb-miss
[Data TLB read misses. Unit: cpu]
dtlb-misses
[Data TLB read misses. Unit: cpu]
dtlb-ops
[Data TLB read accesses. Unit: cpu]
dtlb-read
[Data TLB read accesses. Unit: cpu]
dtlb-read-access
[Data TLB read accesses. Unit: cpu]
dtlb-read-miss
[Data TLB read misses. Unit: cpu]
dtlb-read-misses
[Data TLB read misses. Unit: cpu]
dtlb-read-ops
[Data TLB read accesses. Unit: cpu]
dtlb-read-reference
[Data TLB read accesses. Unit: cpu]
dtlb-read-refs
[Data TLB read accesses. Unit: cpu]
dtlb-reference
[Data TLB read accesses. Unit: cpu]
dtlb-refs
[Data TLB read accesses. Unit: cpu]
dtlb-store
[Data TLB write accesses. Unit: cpu]
dtlb-store-access
[Data TLB write accesses. Unit: cpu]
dtlb-store-miss
[Data TLB write misses. Unit: cpu]
dtlb-store-misses
[Data TLB write misses. Unit: cpu]
dtlb-store-ops
[Data TLB write accesses. Unit: cpu]
dtlb-store-reference
[Data TLB write accesses. Unit: cpu]
dtlb-store-refs
[Data TLB write accesses. Unit: cpu]
dtlb-stores
[Data TLB write accesses. Unit: cpu]
dtlb-stores-access
[Data TLB write accesses. Unit: cpu]
dtlb-stores-miss
[Data TLB write misses. Unit: cpu]
dtlb-stores-misses
[Data TLB write misses. Unit: cpu]
dtlb-stores-ops
[Data TLB write accesses. Unit: cpu]
dtlb-stores-reference
[Data TLB write accesses. Unit: cpu]
dtlb-stores-refs
[Data TLB write accesses. Unit: cpu]
dtlb-write
[Data TLB write accesses. Unit: cpu]
dtlb-write-access
[Data TLB write accesses. Unit: cpu]
dtlb-write-miss
[Data TLB write misses. Unit: cpu]
dtlb-write-misses
[Data TLB write misses. Unit: cpu]
dtlb-write-ops
[Data TLB write accesses. Unit: cpu]
dtlb-write-reference
[Data TLB write accesses. Unit: cpu]
dtlb-write-refs
[Data TLB write accesses. Unit: cpu]
i-tlb-load-miss
[Instruction TLB read misses. Unit: cpu]
i-tlb-load-misses
[Instruction TLB read misses. Unit: cpu]
i-tlb-loads-miss
[Instruction TLB read misses. Unit: cpu]
i-tlb-loads-misses
[Instruction TLB read misses. Unit: cpu]
i-tlb-miss
[Instruction TLB read misses. Unit: cpu]
i-tlb-misses
[Instruction TLB read misses. Unit: cpu]
i-tlb-read-miss
[Instruction TLB read misses. Unit: cpu]
i-tlb-read-misses
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-load-miss
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-load-misses
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-loads-miss
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-loads-misses
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-miss
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-misses
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-read-miss
[Instruction TLB read misses. Unit: cpu]
instruction-tlb-read-misses
[Instruction TLB read misses. Unit: cpu]
itlb-load-miss
[Instruction TLB read misses. Unit: cpu]
itlb-load-misses
[Instruction TLB read misses. Unit: cpu]
itlb-loads-miss
[Instruction TLB read misses. Unit: cpu]
itlb-loads-misses
[Instruction TLB read misses. Unit: cpu]
itlb-miss
[Instruction TLB read misses. Unit: cpu]
itlb-misses
[Instruction TLB read misses. Unit: cpu]
itlb-read-miss
[Instruction TLB read misses. Unit: cpu]
itlb-read-misses
[Instruction TLB read misses. Unit: cpu]
l1-d
[Level 1 data cache read accesses. Unit: cpu]
l1-d-access
[Level 1 data cache read accesses. Unit: cpu]
l1-d-load
[Level 1 data cache read accesses. Unit: cpu]
l1-d-load-access
[Level 1 data cache read accesses. Unit: cpu]
l1-d-load-miss
[Level 1 data cache read misses. Unit: cpu]
l1-d-load-misses
[Level 1 data cache read misses. Unit: cpu]
l1-d-load-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-d-load-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-d-load-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-d-loads
[Level 1 data cache read accesses. Unit: cpu]
l1-d-loads-access
[Level 1 data cache read accesses. Unit: cpu]
l1-d-loads-miss
[Level 1 data cache read misses. Unit: cpu]
l1-d-loads-misses
[Level 1 data cache read misses. Unit: cpu]
l1-d-loads-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-d-loads-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-d-loads-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-d-miss
[Level 1 data cache read misses. Unit: cpu]
l1-d-misses
[Level 1 data cache read misses. Unit: cpu]
l1-d-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-d-read
[Level 1 data cache read accesses. Unit: cpu]
l1-d-read-access
[Level 1 data cache read accesses. Unit: cpu]
l1-d-read-miss
[Level 1 data cache read misses. Unit: cpu]
l1-d-read-misses
[Level 1 data cache read misses. Unit: cpu]
l1-d-read-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-d-read-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-d-read-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-d-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-d-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-d-store
[Level 1 data cache write accesses. Unit: cpu]
l1-d-store-access
[Level 1 data cache write accesses. Unit: cpu]
l1-d-store-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-d-store-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-d-store-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-d-stores
[Level 1 data cache write accesses. Unit: cpu]
l1-d-stores-access
[Level 1 data cache write accesses. Unit: cpu]
l1-d-stores-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-d-stores-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-d-stores-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-d-write
[Level 1 data cache write accesses. Unit: cpu]
l1-d-write-access
[Level 1 data cache write accesses. Unit: cpu]
l1-d-write-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-d-write-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-d-write-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-data
[Level 1 data cache read accesses. Unit: cpu]
l1-data-access
[Level 1 data cache read accesses. Unit: cpu]
l1-data-load
[Level 1 data cache read accesses. Unit: cpu]
l1-data-load-access
[Level 1 data cache read accesses. Unit: cpu]
l1-data-load-miss
[Level 1 data cache read misses. Unit: cpu]
l1-data-load-misses
[Level 1 data cache read misses. Unit: cpu]
l1-data-load-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-data-load-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-data-load-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-data-loads
[Level 1 data cache read accesses. Unit: cpu]
l1-data-loads-access
[Level 1 data cache read accesses. Unit: cpu]
l1-data-loads-miss
[Level 1 data cache read misses. Unit: cpu]
l1-data-loads-misses
[Level 1 data cache read misses. Unit: cpu]
l1-data-loads-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-data-loads-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-data-loads-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-data-miss
[Level 1 data cache read misses. Unit: cpu]
l1-data-misses
[Level 1 data cache read misses. Unit: cpu]
l1-data-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-data-read
[Level 1 data cache read accesses. Unit: cpu]
l1-data-read-access
[Level 1 data cache read accesses. Unit: cpu]
l1-data-read-miss
[Level 1 data cache read misses. Unit: cpu]
l1-data-read-misses
[Level 1 data cache read misses. Unit: cpu]
l1-data-read-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-data-read-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-data-read-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-data-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-data-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-data-store
[Level 1 data cache write accesses. Unit: cpu]
l1-data-store-access
[Level 1 data cache write accesses. Unit: cpu]
l1-data-store-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-data-store-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-data-store-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-data-stores
[Level 1 data cache write accesses. Unit: cpu]
l1-data-stores-access
[Level 1 data cache write accesses. Unit: cpu]
l1-data-stores-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-data-stores-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-data-stores-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-data-write
[Level 1 data cache write accesses. Unit: cpu]
l1-data-write-access
[Level 1 data cache write accesses. Unit: cpu]
l1-data-write-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-data-write-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-data-write-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-access
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-load
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-load-access
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-load-miss
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-load-misses
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-load-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-load-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-load-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-loads
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-loads-access
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-loads-miss
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-loads-misses
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-loads-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-loads-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-loads-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-miss
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-misses
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-read
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-read-access
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-read-miss
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-read-misses
[Level 1 data cache read misses. Unit: cpu]
l1-dcache-read-ops
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-read-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-read-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-reference
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-refs
[Level 1 data cache read accesses. Unit: cpu]
l1-dcache-store
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-store-access
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-store-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-store-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-store-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-stores
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-stores-access
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-stores-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-stores-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-stores-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-write
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-write-access
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-write-ops
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-write-reference
[Level 1 data cache write accesses. Unit: cpu]
l1-dcache-write-refs
[Level 1 data cache write accesses. Unit: cpu]
l1-i-load-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-load-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-loads-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-loads-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-read-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-i-read-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-load-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-load-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-loads-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-loads-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-read-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-icache-read-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-load-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-load-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-loads-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-loads-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-read-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1-instruction-read-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1d
[Level 1 data cache read accesses. Unit: cpu]
l1d-access
[Level 1 data cache read accesses. Unit: cpu]
l1d-load
[Level 1 data cache read accesses. Unit: cpu]
l1d-load-access
[Level 1 data cache read accesses. Unit: cpu]
l1d-load-miss
[Level 1 data cache read misses. Unit: cpu]
l1d-load-misses
[Level 1 data cache read misses. Unit: cpu]
l1d-load-ops
[Level 1 data cache read accesses. Unit: cpu]
l1d-load-reference
[Level 1 data cache read accesses. Unit: cpu]
l1d-load-refs
[Level 1 data cache read accesses. Unit: cpu]
l1d-loads
[Level 1 data cache read accesses. Unit: cpu]
l1d-loads-access
[Level 1 data cache read accesses. Unit: cpu]
l1d-loads-miss
[Level 1 data cache read misses. Unit: cpu]
l1d-loads-misses
[Level 1 data cache read misses. Unit: cpu]
l1d-loads-ops
[Level 1 data cache read accesses. Unit: cpu]
l1d-loads-reference
[Level 1 data cache read accesses. Unit: cpu]
l1d-loads-refs
[Level 1 data cache read accesses. Unit: cpu]
l1d-miss
[Level 1 data cache read misses. Unit: cpu]
l1d-misses
[Level 1 data cache read misses. Unit: cpu]
l1d-ops
[Level 1 data cache read accesses. Unit: cpu]
l1d-read
[Level 1 data cache read accesses. Unit: cpu]
l1d-read-access
[Level 1 data cache read accesses. Unit: cpu]
l1d-read-miss
[Level 1 data cache read misses. Unit: cpu]
l1d-read-misses
[Level 1 data cache read misses. Unit: cpu]
l1d-read-ops
[Level 1 data cache read accesses. Unit: cpu]
l1d-read-reference
[Level 1 data cache read accesses. Unit: cpu]
l1d-read-refs
[Level 1 data cache read accesses. Unit: cpu]
l1d-reference
[Level 1 data cache read accesses. Unit: cpu]
l1d-refs
[Level 1 data cache read accesses. Unit: cpu]
l1d-store
[Level 1 data cache write accesses. Unit: cpu]
l1d-store-access
[Level 1 data cache write accesses. Unit: cpu]
l1d-store-ops
[Level 1 data cache write accesses. Unit: cpu]
l1d-store-reference
[Level 1 data cache write accesses. Unit: cpu]
l1d-store-refs
[Level 1 data cache write accesses. Unit: cpu]
l1d-stores
[Level 1 data cache write accesses. Unit: cpu]
l1d-stores-access
[Level 1 data cache write accesses. Unit: cpu]
l1d-stores-ops
[Level 1 data cache write accesses. Unit: cpu]
l1d-stores-reference
[Level 1 data cache write accesses. Unit: cpu]
l1d-stores-refs
[Level 1 data cache write accesses. Unit: cpu]
l1d-write
[Level 1 data cache write accesses. Unit: cpu]
l1d-write-access
[Level 1 data cache write accesses. Unit: cpu]
l1d-write-ops
[Level 1 data cache write accesses. Unit: cpu]
l1d-write-reference
[Level 1 data cache write accesses. Unit: cpu]
l1d-write-refs
[Level 1 data cache write accesses. Unit: cpu]
l1i-load-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1i-load-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1i-loads-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1i-loads-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1i-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1i-misses
[Level 1 instruction cache read misses. Unit: cpu]
l1i-read-miss
[Level 1 instruction cache read misses. Unit: cpu]
l1i-read-misses
[Level 1 instruction cache read misses. Unit: cpu]
llc
[Last level cache read accesses. Unit: cpu]
llc-access
[Last level cache read accesses. Unit: cpu]
llc-load
[Last level cache read accesses. Unit: cpu]
llc-load-access
[Last level cache read accesses. Unit: cpu]
llc-load-miss
[Last level cache read misses. Unit: cpu]
llc-load-misses
[Last level cache read misses. Unit: cpu]
llc-load-ops
[Last level cache read accesses. Unit: cpu]
llc-load-reference
[Last level cache read accesses. Unit: cpu]
llc-load-refs
[Last level cache read accesses. Unit: cpu]
llc-loads
[Last level cache read accesses. Unit: cpu]
llc-loads-access
[Last level cache read accesses. Unit: cpu]
llc-loads-miss
[Last level cache read misses. Unit: cpu]
llc-loads-misses
[Last level cache read misses. Unit: cpu]
llc-loads-ops
[Last level cache read accesses. Unit: cpu]
llc-loads-reference
[Last level cache read accesses. Unit: cpu]
llc-loads-refs
[Last level cache read accesses. Unit: cpu]
llc-miss
[Last level cache read misses. Unit: cpu]
llc-misses
[Last level cache read misses. Unit: cpu]
llc-ops
[Last level cache read accesses. Unit: cpu]
llc-read
[Last level cache read accesses. Unit: cpu]
llc-read-access
[Last level cache read accesses. Unit: cpu]
llc-read-miss
[Last level cache read misses. Unit: cpu]
llc-read-misses
[Last level cache read misses. Unit: cpu]
llc-read-ops
[Last level cache read accesses. Unit: cpu]
llc-read-reference
[Last level cache read accesses. Unit: cpu]
llc-read-refs
[Last level cache read accesses. Unit: cpu]
llc-reference
[Last level cache read accesses. Unit: cpu]
llc-refs
[Last level cache read accesses. Unit: cpu]
llc-store
[Last level cache write accesses. Unit: cpu]
llc-store-access
[Last level cache write accesses. Unit: cpu]
llc-store-miss
[Last level cache write misses. Unit: cpu]
llc-store-misses
[Last level cache write misses. Unit: cpu]
llc-store-ops
[Last level cache write accesses. Unit: cpu]
llc-store-reference
[Last level cache write accesses. Unit: cpu]
llc-store-refs
[Last level cache write accesses. Unit: cpu]
llc-stores
[Last level cache write accesses. Unit: cpu]
llc-stores-access
[Last level cache write accesses. Unit: cpu]
llc-stores-miss
[Last level cache write misses. Unit: cpu]
llc-stores-misses
[Last level cache write misses. Unit: cpu]
llc-stores-ops
[Last level cache write accesses. Unit: cpu]
llc-stores-reference
[Last level cache write accesses. Unit: cpu]
llc-stores-refs
[Last level cache write accesses. Unit: cpu]
llc-write
[Last level cache write accesses. Unit: cpu]
llc-write-access
[Last level cache write accesses. Unit: cpu]
llc-write-miss
[Last level cache write misses. Unit: cpu]
llc-write-misses
[Last level cache write misses. Unit: cpu]
llc-write-ops
[Last level cache write accesses. Unit: cpu]
llc-write-reference
[Last level cache write accesses. Unit: cpu]
llc-write-refs
[Last level cache write accesses. Unit: cpu]
node
[Local memory read accesses. Unit: cpu]
node-access
[Local memory read accesses. Unit: cpu]
node-load
[Local memory read accesses. Unit: cpu]
node-load-access
[Local memory read accesses. Unit: cpu]
node-load-miss
[Local memory read misses. Unit: cpu]
node-load-misses
[Local memory read misses. Unit: cpu]
node-load-ops
[Local memory read accesses. Unit: cpu]
node-load-reference
[Local memory read accesses. Unit: cpu]
node-load-refs
[Local memory read accesses. Unit: cpu]
node-loads
[Local memory read accesses. Unit: cpu]
node-loads-access
[Local memory read accesses. Unit: cpu]
node-loads-miss
[Local memory read misses. Unit: cpu]
node-loads-misses
[Local memory read misses. Unit: cpu]
node-loads-ops
[Local memory read accesses. Unit: cpu]
node-loads-reference
[Local memory read accesses. Unit: cpu]
node-loads-refs
[Local memory read accesses. Unit: cpu]
node-miss
[Local memory read misses. Unit: cpu]
node-misses
[Local memory read misses. Unit: cpu]
node-ops
[Local memory read accesses. Unit: cpu]
node-read
[Local memory read accesses. Unit: cpu]
node-read-access
[Local memory read accesses. Unit: cpu]
node-read-miss
[Local memory read misses. Unit: cpu]
node-read-misses
[Local memory read misses. Unit: cpu]
node-read-ops
[Local memory read accesses. Unit: cpu]
node-read-reference
[Local memory read accesses. Unit: cpu]
node-read-refs
[Local memory read accesses. Unit: cpu]
node-reference
[Local memory read accesses. Unit: cpu]
node-refs
[Local memory read accesses. Unit: cpu]
node-store
[Local memory write accesses. Unit: cpu]
node-store-access
[Local memory write accesses. Unit: cpu]
node-store-miss
[Local memory write misses. Unit: cpu]
node-store-misses
[Local memory write misses. Unit: cpu]
node-store-ops
[Local memory write accesses. Unit: cpu]
node-store-reference
[Local memory write accesses. Unit: cpu]
node-store-refs
[Local memory write accesses. Unit: cpu]
node-stores
[Local memory write accesses. Unit: cpu]
node-stores-access
[Local memory write accesses. Unit: cpu]
node-stores-miss
[Local memory write misses. Unit: cpu]
node-stores-misses
[Local memory write misses. Unit: cpu]
node-stores-ops
[Local memory write accesses. Unit: cpu]
node-stores-reference
[Local memory write accesses. Unit: cpu]
node-stores-refs
[Local memory write accesses. Unit: cpu]
node-write
[Local memory write accesses. Unit: cpu]
node-write-access
[Local memory write accesses. Unit: cpu]
node-write-miss
[Local memory write misses. Unit: cpu]
node-write-misses
[Local memory write misses. Unit: cpu]
node-write-ops
[Local memory write accesses. Unit: cpu]
node-write-reference
[Local memory write accesses. Unit: cpu]
node-write-refs
[Local memory write accesses. Unit: cpu]
```Ian Rogers (13):
perf parse-events: Fix legacy cache events if event is duplicated in a
PMU
perf perf_api_probe: Avoid scanning all PMUs, try software PMU first perf record: Skip don't fail for events that don't open perf jevents: Support copying the source json files to OUTPUT perf pmu: Don't eagerly parse event terms
perf pmu: Factor term parsing into a perf_event_attr into a helper perf parse-events: Add terms for legacy hardware and cache config
values
perf jevents: Add legacy json terms and default_core event table
helper
perf pmu: Add and use legacy_terms in alias information perf jevents: Add legacy-hardware and legacy-cache json perf print-events: Remove print_hwcache_events
perf print-events: Remove print_symbol_events
perf parse-events: Remove hard coded legacy hardware and cache parsing
tools/perf/Makefile.perf | 21 +- tools/perf/builtin-list.c | 34 +- tools/perf/builtin-record.c | 89 +- tools/perf/pmu-events/Build | 24 +- .../arch/common/common/legacy-hardware.json | 72 + tools/perf/pmu-events/empty-pmu-events.c | 2763 ++++++++++++++++- tools/perf/pmu-events/jevents.py | 24 + tools/perf/pmu-events/make_legacy_cache.py | 131 + tools/perf/pmu-events/pmu-events.h | 1 + tools/perf/tests/pmu-events.c | 24 +- tools/perf/util/parse-events.c | 265 +- tools/perf/util/parse-events.h | 13 +- tools/perf/util/parse-events.l | 54 +- tools/perf/util/parse-events.y | 114 +- tools/perf/util/perf_api_probe.c | 27 +- tools/perf/util/pmu.c | 282 +- tools/perf/util/print-events.c | 112 - tools/perf/util/print-events.h | 4 - 18 files changed, 3313 insertions(+), 741 deletions(-) create mode 100644 tools/perf/pmu-events/arch/common/common/legacy-hardware.json create mode 100755 tools/perf/pmu-events/make_legacy_cache.py
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 1/13 perf parse-events: Fix legacy cache events if event is duplicated in a PMU
The term list when adding an event to a PMU is expected to have the event name for the alias lookup. Also, set found_supported so that -EINVAL isn't returned.
PMUs and lower priority")
--- tools/perf/util/parse-events.c | 28 +++++++++++++++++++++++++++- tools/perf/util/parse-events.h | 3 ++- tools/perf/util/parse-events.y | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-)
tools/perf/util/parse-events.c +27 -1
@@ -465,8 +465,10 @@ static int parse_events_add_pmu(struct parse_events_state *parse_state,int parse_events_add_cache (struct list_head *list,int *idx,const char *name,struct parse_events_state *parse_state, -struct parse_events_terms *parsed_terms) +struct parse_events_terms *parsed_terms, +void *loc_) { +YYLTYPE *loc = loc_;struct perf_pmu *pmu =NULL ;bool found_supported = false;const char *config_name =get_config_name (parsed_terms);
@@ -487,12 +489,36 @@ int parse_events_add_cache(struct list_head *list, int *idx, const char *name,* The PMU has the event so add as not a legacy cache * event. */ +struct parse_events_terms temp_terms; +struct parse_events_term *term; +char *config =strdup (name); + +if (!config) + goto out_err; + +parse_events_terms__init (&temp_terms); +if (!parsed_terms) + parsed_terms = &temp_terms; + +if (parse_events_term__num (&term, +PARSE_EVENTS__TERM_TYPE_USER , + config,/*num=*/ 1 ,/*novalue=*/ true, + loc,/*loc_val=*/ NULL ) <0 ) { +zfree (&config); + goto out_err; + } +list_add (&term->list, &parsed_terms->terms); + ret =parse_events_add_pmu (parse_state, list, pmu, parsed_terms, first_wildcard_match,/*alternate_hw_config=*/ PERF_COUNT_HW_MAX ); +list_del_init (&term->list); +parse_events_term__delete (term); +parse_events_terms__exit (&temp_terms);if (ret) goto out_err; + found_supported = true;if (first_wildcard_match ==NULL ) first_wildcard_match = container_of(list->prev, struct evsel, core.node);
tools/perf/util/parse-events.h +2 -1
@@ -235,7 +235,8 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, bool wildcard);int parse_events_add_cache (struct list_head *list,int *idx,const char *name,struct parse_events_state *parse_state, -struct parse_events_terms *parsed_terms); +struct parse_events_terms *parsed_terms, +void *loc);int parse_events__decode_legacy_cache (const char *name,int pmu_type,__u64 *config); int parse_events_add_breakpoint(struct parse_events_state *parse_state, struct list_head *list,
tools/perf/util/parse-events.y +1 -1
@@ -353,7 +353,7 @@ PE_LEGACY_CACHE opt_event_config if (!list) YYNOMEM; - err = parse_events_add_cache(list, &parse_state->idx, $1, parse_state, $2); + err = parse_events_add_cache(list, &parse_state->idx, $1, parse_state, $2, &@1); parse_events_terms__delete($2); free($1);
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 2/13 perf perf_api_probe: Avoid scanning all PMUs, try software PMU first
In reply to Ian RogersScan the software PMU first rather than last as it is the least likely to fail the probe. Specifying the software PMU by name was enabled by commit 9957d8c801fe ("perf jevents: Add common software event json"). For hardware events, add core PMU names when getting events to probe so that not all PMUs are scanned. For example, when legacy events support wildcards and for the event "cycles:u" on x86, we want to only scan the "cpu" PMU and not all uncore PMUs for the event too.
--- tools/perf/util/perf_api_probe.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
tools/perf/util/perf_api_probe.c +19 -8
@@ -59,10 +59,10 @@ static int perf_do_probe_api(setup_probe_fn_t fn, struct perf_cpu cpu, const chastatic bool perf_probe_api (setup_probe_fn_t fn) { -const char *try[] = {"cycles:u" ,"instructions:u" ,"cpu-clock:u" ,NULL }; +struct perf_pmu *pmu;struct perf_cpu_map *cpus;struct perf_cpu cpu; -int ret, i =0 ; +int ret =0 ; cpus =perf_cpu_map__new_online_cpus ();if (!cpus)
@@ -70,12 +70,23 @@ static bool perf_probe_api(setup_probe_fn_t fn) cpu =perf_cpu_map__cpu (cpus,0 );perf_cpu_map__put (cpus); -do { - ret =perf_do_probe_api (fn, cpu, try[i++]); -if (!ret) -return true; - }while (ret == -EAGAIN && try[i]); - + ret =perf_do_probe_api (fn, cpu,"software/cpu-clock/u" ); +if (!ret) +return true; + + pmu =perf_pmus__scan_core (/*pmu=*/ NULL ); +if (pmu) { +const char *try[] = {"cycles" ,"instructions" ,NULL }; +char buf[256 ]; +int i =0 ; + +while (ret == -EAGAIN && try[i]) { +snprintf (buf,sizeof (buf),"%s/%s/u" , pmu->name, try[i++]); + ret =perf_do_probe_api (fn, cpu, buf); +if (!ret) +return true; + } + }return false; }
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 3/13 perf record: Skip don't fail for events that don't open
In reply to Ian RogersWhilst for many tools it is an expected behavior that failure to open a perf event is a failure, ARM decided to name PMU events the same as legacy events and then failed to rename such events on a server uncore SLC PMU. As perf's default behavior when no PMU is specified is to open the event on all PMUs that advertise/"have" the event, this yielded failures when trying to make the priority of legacy and sysfs/json events uniform - something requested by RISC-V and ARM. A legacy event user on ARM hardware may find their event opened on an uncore PMU which for perf record will fail. Arnaldo suggested skipping such events which this patch implements. Rather than have the skipping conditional on running on ARM, the skipping is done on all architectures as such a fundamental behavioral difference could lead to problems with tools built/depending on perf.
An example of perf record failing to open events on x86 is:
```
$ perf record -e data_read,cycles,LLC-prefetch-read -a sleep 0.1
Error:
Failure to open event 'data_read' on PMU 'uncore_imc_free_running_0' which will be removed.
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (data_read).
"dmesg | grep -i perf" may provide additional information.
Error:
Failure to open event 'data_read' on PMU 'uncore_imc_free_running_1' which will be removed.
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (data_read).
"dmesg | grep -i perf" may provide additional information.
Error:
Failure to open event 'LLC-prefetch-read' on PMU 'cpu' which will be removed.
The LLC-prefetch-read event is not supported.
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 2.188 MB perf.data (87 samples) ]
$ perf report --stats
Aggregated stats:
TOTAL events: 17255
MMAP events: 284 ( 1.6%)
COMM events: 1961 (11.4%)
EXIT events: 1 ( 0.0%)
FORK events: 1960 (11.4%)
SAMPLE events: 87 ( 0.5%)
MMAP2 events: 12836 (74.4%)
KSYMBOL events: 83 ( 0.5%)
BPF_EVENT events: 36 ( 0.2%)
FINISHED_ROUND events: 2 ( 0.0%)
ID_INDEX events: 1 ( 0.0%)
THREAD_MAP events: 1 ( 0.0%)
CPU_MAP events: 1 ( 0.0%)
TIME_CONV events: 1 ( 0.0%)
FINISHED_INIT events: 1 ( 0.0%)
cycles stats:
SAMPLE events: 87
```If all events fail to open then the perf record will fail:
``` $ perf record -e LLC-prefetch-read true Error: Failure to open event 'LLC-prefetch-read' on PMU 'cpu' which will be removed. The LLC-prefetch-read event is not supported. Error: Failure to open any events for recording ```
As an evlist may have dummy events that open when all command line events fail we ignore dummy events when detecting if at least some events open. This still permits the dummy event on its own to be used as a permission check:
``` $ perf record -e dummy true [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.046 MB perf.data ] ``` but allows failure when a dummy event is implicilty inserted or when there are insufficient permissions to open it: ``` $ perf record -e LLC-prefetch-read -a true Error: Failure to open event 'LLC-prefetch-read' on PMU 'cpu' which will be removed. The LLC-prefetch-read event is not supported. Error: Failure to open any events for recording ```
As the first parsed event in an evlist is marked as tracking, removing this event can remove tracking from the evlist, removing mmap events and breaking symbolization. To avoid this, if a tracking event is removed then the next event has tracking added.
The issue with legacy events is that on RISC-V they want the driver to not have mappings from legacy to non-legacy config encodings for each vendor/model due to size, complexity and difficulty to update. It was reported that on ARM Apple-M? CPUs the legacy mapping in the driver was broken and the sysfs/json events should always take precedent, however, it isn't clear this is still the case. It is the case that without working around this issue a legacy event like cycles without a PMU can encode differently than when specified with a PMU - the non-PMU version favoring legacy encodings, the PMU one avoiding legacy encodings. Legacy events are also case sensitive while sysfs/json events are not.
The patch removes events and then adjusts the idx value for each evsel. This is done so that the dense xyarrays used for file descriptors, etc. don't contain broken entries.
On ARM it could be common following this change to see a lot of warnings for the cycles event due to many ARM PMUs advertising the cycles event (ARM inconsistently have events bus_cycles and then cycles implying CPU cycles, they also sometimes have a cpu_cycles event). As cycles is a popular event, avoid potentially spamming users with error messages on ARM when there are multiple cycles events in the evlist, the error is still shown when verbose is enabled.
Prior versions without adding the tracking data and not warning for cycles on ARM was:
--- tools/perf/builtin-record.c | 89 ++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 7 deletions(-)
tools/perf/builtin-record.c +82 -7
@@ -983,7 +983,6 @@ static int record__config_tracking_events(struct record *rec)*/ if (opts->target.initial_delay ||target__has_cpu (&opts->target) ||perf_pmus__num_core_pmus () >1 ) { -/* * User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed.
@@ -1388,10 +1387,27 @@ static int record__open(struct record *rec)struct perf_session *session = rec->session;struct record_opts *opts = &rec->opts;int rc =0 ; +bool skipped = false; +bool removed_tracking = false;evlist__for_each_entry (evlist, pos) { +if (removed_tracking) { +/* +* Normally the head of the list has tracking enabled +* for sideband data like mmaps. If this event is +* removed, make sure to add tracking to the next +* processed event. +*/ +if (!pos->tracking) { + pos->tracking = true; +evsel__config (pos, opts, &callchain_param); + } + removed_tracking = false; + } try_again:if (evsel__open (pos, pos->core.cpus, pos->core.threads) <0 ) { +bool report_error = true; +if (evsel__fallback (pos, &opts->target, errno, msg,sizeof (msg))) {if (verbose >0 )ui__warning ("%s\n" , msg);
@@ -1403,15 +1419,74 @@ static int record__open(struct record *rec) pos =evlist__reset_weak_group (evlist, pos, true); goto try_again; } - rc = -errno; -evsel__open_strerror (pos, &opts->target, errno, msg,sizeof (msg)); -ui__error ("%s\n" , msg); - goto out; +#if defined(__aarch64__) || defined(__arm__) +if (strstr (evsel__name (pos),"cycles" )) { +struct evsel *pos2; +/* +* Unfortunately ARM has many events named +* "cycles" on PMUs like the system-level (L3) +* cache which don't support sampling. Only +* display such failures to open when there is +* only 1 cycles event or verbose is enabled. +*/ +evlist__for_each_entry (evlist, pos2) { +if (pos2 == pos) +continue ; +if (strstr (evsel__name (pos2),"cycles" )) { + report_error = false; +break ; + } + } + } +#endif +if (report_error || verbose >0 ) { +ui__error ("Failure to open event '%s' on PMU '%s' which will be " +"removed.\n%s\n" , +evsel__name (pos),evsel__pmu_name (pos), msg); + } +if (pos->tracking) + removed_tracking = true; + pos->skippable = true; + skipped = true; + }else { + pos->supported = true; } - - pos->supported = true; } +if (skipped) { +struct evsel *tmp; +int idx =0 ; +bool evlist_empty = true; + +/* Remove evsels that failed to open and update indices. */ +evlist__for_each_entry_safe (evlist, tmp, pos) { +if (pos->skippable) { +evlist__remove (evlist, pos); +continue ; + } + +/* +* Note, dummy events may be command line parsed or +* added by the tool. We care about supporting `perf +* record -e dummy` which may be used as a permission +* check. Dummy events that are added to the command +* line and opened along with other events that fail, +* will still fail as if the dummy events were tool +* added events for the sake of code simplicity. +*/ +if (!evsel__is_dummy_event (pos)) + evlist_empty = false; + } +evlist__for_each_entry (evlist, pos) { + pos->core.idx = idx++; + } +/* If list is empty then fail. */ +if (evlist_empty) { +ui__error ("Failure to open any events for recording.\n" ); + rc =-1 ; + goto out; + } + }if (symbol_conf.kptr_restrict && !evlist__exclude_kernel (evlist)) {pr_warning ( "WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,\n"
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 4/13 perf jevents: Support copying the source json files to OUTPUT
In reply to Ian RogersThe jevents command expects all json files to be organized under a single directory. When generating json files from scripts (to reduce laborious copy and paste in the json) we don't want to generate the json into the source directory if there is an OUTPUT directory specified. This change adds a GEN_JSON for this case where the GEN_JSON copies the JSON files to OUTPUT, only when OUTPUT is specified. The Makefile.perf clean code is updated to clean up this directory when present.
This patch is part of:
https://lore.kernel.org/lkml/[email protected]/
which was similarly adding support for generating json in scripts for the consumption of jevents.py.
--- tools/perf/Makefile.perf | 21 ++++++++++++++++----- tools/perf/pmu-events/Build | 18 ++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-)
tools/perf/Makefile.perf +16 -5
@@ -1272,9 +1272,24 @@ endif # CONFIG_PERF_BPF_SKEL bpf-skel-clean: $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) $(SKEL_OUT)/vmlinux.h +pmu-events-clean: +ifeq ($(OUTPUT),) + $(call QUIET_CLEAN, pmu-events) $(RM) \ + pmu-events/pmu-events.c \ + pmu-events/metric_test.log \ + pmu-events/test-empty-pmu-events.c \ + pmu-events/empty-pmu-events.log +else # When an OUTPUT directory is present, clean up the copied pmu-events/arch directory. + $(call QUIET_CLEAN, pmu-events) $(RM) -r $(OUTPUT)pmu-events/arch \ + $(OUTPUT)pmu-events/pmu-events.c \ + $(OUTPUT)pmu-events/metric_test.log \ + $(OUTPUT)pmu-events/test-empty-pmu-events.c \ + $(OUTPUT)pmu-events/empty-pmu-events.log +endif + clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \ arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \ - tests-coresight-targets-clean + tests-coresight-targets-clean pmu-events-clean $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \ $(OUTPUT)perf-iostat $(LANG_BINDINGS) $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \
@@ -1287,10 +1302,6 @@ clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $( $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \ $(OUTPUT)util/intel-pt-decoder/inat-tables.c \ $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \ - $(OUTPUT)pmu-events/pmu-events.c \ - $(OUTPUT)pmu-events/test-empty-pmu-events.c \ - $(OUTPUT)pmu-events/empty-pmu-events.log \ - $(OUTPUT)pmu-events/metric_test.log \ $(OUTPUT)$(fadvise_advice_array) \ $(OUTPUT)$(fsconfig_arrays) \ $(OUTPUT)$(fsmount_arrays) \
tools/perf/pmu-events/Build +12 -6
@@ -1,7 +1,6 @@ pmu-events-y += pmu-events.o JDIR = pmu-events/arch/$(SRCARCH) -JSON = $(shell [ -d $(JDIR) ] && \ - find $(JDIR) -name '*.json' -o -name 'mapfile.csv') +JSON = $(shell find pmu-events/arch -name *.json -o -name *.csv) JDIR_TEST = pmu-events/arch/test JSON_TEST = $(shell [ -d $(JDIR_TEST) ] && \ find $(JDIR_TEST) -name '*.json')
@@ -29,13 +28,20 @@ $(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C) $(call rule_mkdir) $(Q)$(call echo-cmd,gen)cp $< $@ else +# Copy checked-in json for generation. +$(OUTPUT)pmu-events/arch/%: pmu-events/arch/% + $(call rule_mkdir) + $(Q)$(call echo-cmd,gen)cp $< $@ + +GEN_JSON = $(patsubst %,$(OUTPUT)%,$(JSON)) + $(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY) $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(PYTHON) $< 2> $@ || (cat $@ && false) -$(TEST_EMPTY_PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) +$(TEST_EMPTY_PMU_EVENTS_C): $(GEN_JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) $(call rule_mkdir) - $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) none none pmu-events/arch $@ + $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) none none $(OUTPUT)pmu-events/arch $@ $(EMPTY_PMU_EVENTS_TEST_LOG): $(EMPTY_PMU_EVENTS_C) $(TEST_EMPTY_PMU_EVENTS_C) $(call rule_mkdir)
@@ -63,10 +69,10 @@ $(OUTPUT)%.pylint_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false) -$(PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) \ +$(PMU_EVENTS_C): $(GEN_JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) \ $(EMPTY_PMU_EVENTS_TEST_LOG) $(PMU_EVENTS_MYPY_TEST_LOGS) $(PMU_EVENTS_PYLINT_TEST_LOGS) $(call rule_mkdir) - $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@ + $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) $(OUTPUT)pmu-events/arch $@ endif # pmu-events.c file is generated in the OUTPUT directory so it needs a
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 5/13 perf pmu: Don't eagerly parse event terms
In reply to Ian RogersWhen an event/alias is created for a PMU the terms are eagerly parsed using parse_events_terms. For a command like perf stat or perf record, the particularly event/alias will be found, the terms parsed, the terms cloned for use in the event parsing, and then the terms used to configure the perf_event_attr. Events/aliases may be eagerly loaded, such as from sysfs or in perf list, in which case the aliases terms will be little or never used. To avoid redundant work, to avoid cloning, and to reduce memory overhead, hold the terms for an event as a string until they need handling as a term list. This may introduce duplicate parsing if an event is repeated in a list, but this situation is expected to be uncommon.
Measuring the number of instructions before and after with a sysfs event and perf stat, there is a minor reduction in the number of instructions executed by 0.3%.
--- tools/perf/tests/pmu-events.c | 24 +------ tools/perf/util/parse-events.c | 3 +- tools/perf/util/parse-events.h | 1 - tools/perf/util/pmu.c | 111 ++++++++++++++++++++------------- 4 files changed, 70 insertions(+), 69 deletions(-)
tools/perf/tests/pmu-events.c +2 -22
@@ -22,10 +22,6 @@ struct perf_pmu_test_event {/* used for matching against events from generated pmu-events.c */ struct pmu_event event; -/* used for matching against event aliases */ -/* extra events for aliases */ -const char *alias_str; -/* * Note: For when PublicDescription does not exist in the JSON, we * will have no long_desc in pmu_event.long_desc, but long_desc may
@@ -52,7 +48,6 @@ static const struct perf_pmu_test_event bp_l1_btb_correct = { .desc = "L1 BTB Correction", .topic = "branch", }, - .alias_str = "event=0x8a", }; static const struct perf_pmu_test_event bp_l2_btb_correct = {
@@ -63,7 +58,6 @@ static const struct perf_pmu_test_event bp_l2_btb_correct = { .desc = "L2 BTB Correction", .topic = "branch", }, - .alias_str = "event=0x8b", }; static const struct perf_pmu_test_event segment_reg_loads_any = {
@@ -74,7 +68,6 @@ static const struct perf_pmu_test_event segment_reg_loads_any = { .desc = "Number of segment register loads", .topic = "other", }, - .alias_str = "event=0x6,period=0x30d40,umask=0x80", }; static const struct perf_pmu_test_event dispatch_blocked_any = {
@@ -85,7 +78,6 @@ static const struct perf_pmu_test_event dispatch_blocked_any = { .desc = "Memory cluster signals to block micro-op dispatch for any reason", .topic = "other", }, - .alias_str = "event=0x9,period=0x30d40,umask=0x20", }; static const struct perf_pmu_test_event eist_trans = {
@@ -96,7 +88,6 @@ static const struct perf_pmu_test_event eist_trans = { .desc = "Number of Enhanced Intel SpeedStep(R) Technology (EIST) transitions", .topic = "other", }, - .alias_str = "event=0x3a,period=0x30d40", }; static const struct perf_pmu_test_event l3_cache_rd = {
@@ -108,7 +99,6 @@ static const struct perf_pmu_test_event l3_cache_rd = { .long_desc = "Attributable Level 3 cache access, read", .topic = "cache", }, - .alias_str = "event=0x40", .alias_long_desc = "Attributable Level 3 cache access, read", };
@@ -130,7 +120,6 @@ static const struct perf_pmu_test_event uncore_hisi_ddrc_flux_wcmd = { .topic = "uncore", .pmu = "hisi_sccl,ddrc", }, - .alias_str = "event=0x2", .matching_pmu = "hisi_sccl1_ddrc2", };
@@ -142,7 +131,6 @@ static const struct perf_pmu_test_event unc_cbo_xsnp_response_miss_eviction = { .topic = "uncore", .pmu = "uncore_cbox", }, - .alias_str = "event=0x22,umask=0x81", .matching_pmu = "uncore_cbox_0", };
@@ -154,7 +142,6 @@ static const struct perf_pmu_test_event uncore_hyphen = { .topic = "uncore", .pmu = "uncore_cbox", }, - .alias_str = "event=0xe0", .matching_pmu = "uncore_cbox_0", };
@@ -166,7 +153,6 @@ static const struct perf_pmu_test_event uncore_two_hyph = { .topic = "uncore", .pmu = "uncore_cbox", }, - .alias_str = "event=0xc0", .matching_pmu = "uncore_cbox_0", };
@@ -178,7 +164,6 @@ static const struct perf_pmu_test_event uncore_hisi_l3c_rd_hit_cpipe = { .topic = "uncore", .pmu = "hisi_sccl,l3c", }, - .alias_str = "event=0x7", .matching_pmu = "hisi_sccl3_l3c7", };
@@ -190,7 +175,6 @@ static const struct perf_pmu_test_event uncore_imc_free_running_cache_miss = { .topic = "uncore", .pmu = "uncore_imc_free_running", }, - .alias_str = "event=0x12", .matching_pmu = "uncore_imc_free_running_0", };
@@ -202,7 +186,6 @@ static const struct perf_pmu_test_event uncore_imc_cache_hits = { .topic = "uncore", .pmu = "uncore_imc", }, - .alias_str = "event=0x34", .matching_pmu = "uncore_imc_0", };
@@ -226,7 +209,6 @@ static const struct perf_pmu_test_event sys_ddr_pmu_write_cycles = { .pmu = "uncore_sys_ddr_pmu", .compat = "v8", }, - .alias_str = "event=0x2b", .matching_pmu = "uncore_sys_ddr_pmu0", };
@@ -239,7 +221,6 @@ static const struct perf_pmu_test_event sys_ccn_pmu_read_cycles = { .pmu = "uncore_sys_ccn_pmu", .compat = "0x01", }, - .alias_str = "config=0x2c", .matching_pmu = "uncore_sys_ccn_pmu4", };
@@ -252,7 +233,6 @@ static const struct perf_pmu_test_event sys_cmn_pmu_hnf_cache_miss = { .pmu = "uncore_sys_cmn_pmu", .compat = "(434|436|43c|43a).*", }, - .alias_str = "eventid=0x1,type=0x5", .matching_pmu = "uncore_sys_cmn_pmu0", };
@@ -374,9 +354,9 @@ static int compare_alias_to_test_event(struct pmu_event_info *alias,return -1 ; } -if (!is_same (alias->str, test_event->alias_str)) { +if (!is_same (alias->str, test_event->event.event)) {pr_debug ("testing aliases PMU %s: mismatched str, %s vs %s\n" , - pmu_name, alias->str, test_event->alias_str); + pmu_name, alias->str, test_event->event.event);return -1 ; }
tools/perf/util/parse-events.c +2 -1
@@ -40,6 +40,7 @@ static int get_config_terms(const struct parse_events_terms *head_config, struct list_head *head_terms);static int parse_events_terms__copy (const struct parse_events_terms *src,struct parse_events_terms *dest); +static int parse_events_terms__to_strbuf (const struct parse_events_terms *terms,struct strbuf *sb);const struct event_symbol event_symbols_hw[PERF_COUNT_HW_MAX ] = { [PERF_COUNT_HW_CPU_CYCLES ] = {
@@ -2849,7 +2850,7 @@ void parse_events_terms__delete(struct parse_events_terms *terms)free (terms); } -int parse_events_terms__to_strbuf (const struct parse_events_terms *terms,struct strbuf *sb) +static int parse_events_terms__to_strbuf (const struct parse_events_terms *terms,struct strbuf *sb) {struct parse_events_term *term;bool first = true;
tools/perf/util/parse-events.h +0 -1
@@ -199,7 +199,6 @@ void parse_events_terms__delete(struct parse_events_terms *terms);void parse_events_terms__init (struct parse_events_terms *terms);void parse_events_terms__exit (struct parse_events_terms *terms);int parse_events_terms (struct parse_events_terms *terms,const char *str,FILE *input); -int parse_events_terms__to_strbuf (const struct parse_events_terms *terms,struct strbuf *sb);struct parse_events_modifier {u8 precise;/* Number of repeated 'p' for precision. */
tools/perf/util/pmu.c +66 -45
211 lines not on this page · raw message
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 6/13 perf pmu: Factor term parsing into a perf_event_attr into a helper
In reply to Ian RogersFactor existing functionality in perf_pmu__name_from_config into a helper that will be used in later patches.
--- tools/perf/util/pmu.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
tools/perf/util/pmu.c +19 -14
@@ -1766,6 +1766,24 @@ static int check_info_data(struct perf_pmu *pmu,return 0 ; } +static int perf_pmu__parse_terms_to_attr (struct perf_pmu *pmu,const char *terms_str, +struct perf_event_attr *attr) +{ +struct parse_events_terms terms; +int ret; + +parse_events_terms__init (&terms); + ret =parse_events_terms (&terms, terms_str,/*input=*/ NULL ); +if (ret) { +pr_debug ("Failed to parse terms '%s': %d\n" , terms_str, ret); +parse_events_terms__exit (&terms); +return ret; + } + ret =perf_pmu__config (pmu, attr, &terms,/*apply_hardcoded=*/ true,/*err=*/ NULL ); +parse_events_terms__exit (&terms); +return ret; +} +/* * Find alias in the terms list and replace it with the terms * defined for the alias
@@ -2598,21 +2616,8 @@ const char *perf_pmu__name_from_config(struct perf_pmu *pmu, u64 config)hashmap__for_each_entry (pmu->aliases, entry, bkt) {struct perf_pmu_alias *event = entry->pvalue;struct perf_event_attr attr = {.config =0 ,}; -struct parse_events_terms terms; -int ret; +int ret =perf_pmu__parse_terms_to_attr (pmu, event->terms, &attr); -parse_events_terms__init (&terms); - ret =parse_events_terms (&terms, event->terms,/*input=*/ NULL ); -if (ret) { -pr_debug ("Failed to parse '%s' terms '%s': %d\n" , - event->name, event->terms, ret); -parse_events_terms__exit (&terms); -continue ; - } - ret =perf_pmu__config (pmu, &attr, &terms,/*apply_hardcoded=*/ true, -/*err=*/ NULL ); - -parse_events_terms__exit (&terms);if (ret ==0 && config == attr.config)return event->name; }
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 7/13 perf parse-events: Add terms for legacy hardware and cache config values
In reply to Ian RogersAdd the PMU terms legacy-hardware-config and legacy-cache-config. These terms are similar to the config term in that their values are assigned to the perf_event_attr config value. They differ in that the PMU type is switched to be either PERF_TYPE_HARDWARE or PERF_TYPE_HW_CACHE, and the PMU type is moved into the extended type information of the config value. This will allow later patches to add legacy events to json.
An example use of the terms is in the following:
```
$ perf stat -vv -e 'cpu/legacy-hardware-config=1/,cpu/legacy-cache-config=0x10001/' true
Using CPUID GenuineIntel-6-8D-1
Attempt to add: cpu/legacy-hardware-config=0x1/
..after resolving event: cpu/legacy-hardware-config=0x1/
Attempt to add: cpu/legacy-cache-config=0x10001/
..after resolving event: cpu/legacy-cache-config=0x10001/
Control descriptor is not initialized
------------------------------------------------------------
perf_event_attr:
type 0 (PERF_TYPE_HARDWARE)
size 136
config 0x1 (PERF_COUNT_HW_INSTRUCTIONS)
sample_type IDENTIFIER
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
disabled 1
inherit 1
enable_on_exec 1
------------------------------------------------------------
sys_perf_event_open: pid 994937 cpu -1 group_fd -1 flags 0x8 = 3
------------------------------------------------------------
perf_event_attr:
type 3 (PERF_TYPE_HW_CACHE)
size 136
config 0x10001 (PERF_COUNT_HW_CACHE_RESULT_MISS | PERF_COUNT_HW_CACHE_OP_READ | PERF_COUNT_HW_CACHE_L1I)
sample_type IDENTIFIER
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
disabled 1
inherit 1
enable_on_exec 1
------------------------------------------------------------
sys_perf_event_open: pid 994937 cpu -1 group_fd -1 flags 0x8 = 4
cpu/legacy-hardware-config=1/: -1: 1364046 414756 414756
cpu/legacy-cache-config=0x10001/: -1: 57453 414756 414756
cpu/legacy-hardware-config=1/: 1364046 414756 414756
cpu/legacy-cache-config=0x10001/: 57453 414756 414756
Performance counter stats for 'true':
1,364,046 cpu/legacy-hardware-config=1/
57,453 cpu/legacy-cache-config=0x10001/
0.001988593 seconds time elapsed
0.002194000 seconds user
0.000000000 seconds sys
```--- tools/perf/util/parse-events.c | 70 ++++++++++++++++++++++++++++++++++ tools/perf/util/parse-events.h | 4 +- tools/perf/util/parse-events.l | 2 + tools/perf/util/pmu.c | 29 ++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-)
tools/perf/util/parse-events.c +70 -0
@@ -860,6 +860,8 @@ const char *parse_events__term_type_str(enum parse_events__term_type term_type) [PARSE_EVENTS__TERM_TYPE_RAW] = "raw", [PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE] = "legacy-cache", [PARSE_EVENTS__TERM_TYPE_HARDWARE] = "hardware", + [PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG] = "legacy-hardware-config", + [PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG] = "legacy-cache-config", [PARSE_EVENTS__TERM_TYPE_CPU] = "cpu", };if ((unsigned int )term_type >= __PARSE_EVENTS__TERM_TYPE_NR)
@@ -911,6 +913,8 @@ config_term_avail(enum parse_events__term_type term_type, struct parse_events_ercase PARSE_EVENTS__TERM_TYPE_RAW :case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE :case PARSE_EVENTS__TERM_TYPE_HARDWARE : +case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG : +case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :default :if (!err)return false;
@@ -1068,6 +1072,8 @@ do { \case PARSE_EVENTS__TERM_TYPE_USER :case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE :case PARSE_EVENTS__TERM_TYPE_HARDWARE : +case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG : +case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :default : parse_events_error__handle(err, term->err_term, strdup(parse_events__term_type_str(term->type_term)),
@@ -1090,10 +1096,68 @@ do { \#undef CHECK_TYPE_VAL } +static bool check_pmu_is_core (__u32 type,const struct parse_events_term *term, +struct parse_events_error *err) +{ +struct perf_pmu *pmu =NULL ; + +/* Avoid loading all PMUs with perf_pmus__find_by_type, just scan the core ones. */ +while ((pmu =perf_pmus__scan_core (pmu)) !=NULL ) { +if (pmu->type == type) +return true; + } +parse_events_error__handle (err, term->err_val, +strdup ("needs a core PMU" ), +NULL ); +return false; +} +static int config_term_pmu (struct perf_event_attr *attr,struct parse_events_term *term,struct parse_events_error *err) { +if (term->type_term ==PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG ) { +if (check_type_val (term, err,PARSE_EVENTS__TERM_TYPE_NUM )) +return -EINVAL ; +if (term->val.num >=PERF_COUNT_HW_MAX ) { +parse_events_error__handle (err, term->err_val, +strdup ("too big" ), +NULL ); +return -EINVAL ; + } +if (!check_pmu_is_core (attr->type, term, err)) +return -EINVAL ; + attr->config = term->val.num; +if (perf_pmus__supports_extended_type ()) + attr->config |= (__u64 )attr->type <<PERF_PMU_TYPE_SHIFT ; + attr->type =PERF_TYPE_HARDWARE ; +return 0 ; + } +if (term->type_term ==PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG ) { +int cache_type, cache_op, cache_result; + +if (check_type_val (term, err,PARSE_EVENTS__TERM_TYPE_NUM )) +return -EINVAL ; + cache_type = term->val.num &0xFF ; + cache_op = (term->val.num >>8 ) &0xFF ; + cache_result = (term->val.num >>16 ) &0xFF ; +if ((term->val.num & ~0xFFFFFF ) || + cache_type >=PERF_COUNT_HW_CACHE_MAX || + cache_op >=PERF_COUNT_HW_CACHE_OP_MAX || + cache_result >=PERF_COUNT_HW_CACHE_RESULT_MAX ) { +parse_events_error__handle (err, term->err_val, +strdup ("too big" ), +NULL ); +return -EINVAL ; + } +if (!check_pmu_is_core (attr->type, term, err)) +return -EINVAL ; + attr->config = term->val.num; +if (perf_pmus__supports_extended_type ()) + attr->config |= (__u64 )attr->type <<PERF_PMU_TYPE_SHIFT ; + attr->type =PERF_TYPE_HW_CACHE ; +return 0 ; + }if (term->type_term ==PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE ) {struct perf_pmu *pmu =perf_pmus__find_by_type (attr->type);
@@ -1180,6 +1244,8 @@ static int config_term_tracepoint(struct perf_event_attr *attr,case PARSE_EVENTS__TERM_TYPE_CONFIG1 :case PARSE_EVENTS__TERM_TYPE_CONFIG2 :case PARSE_EVENTS__TERM_TYPE_CONFIG3 : +case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG : +case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :case PARSE_EVENTS__TERM_TYPE_NAME :case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD :case PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ :
@@ -1321,6 +1387,8 @@ do { \case PARSE_EVENTS__TERM_TYPE_CONFIG1 :case PARSE_EVENTS__TERM_TYPE_CONFIG2 :case PARSE_EVENTS__TERM_TYPE_CONFIG3 : +case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG : +case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :case PARSE_EVENTS__TERM_TYPE_NAME :case PARSE_EVENTS__TERM_TYPE_METRIC_ID :case PARSE_EVENTS__TERM_TYPE_RAW :
@@ -1359,6 +1427,8 @@ static int get_config_chgs(struct perf_pmu *pmu, struct parse_events_terms *headcase PARSE_EVENTS__TERM_TYPE_CONFIG1 :case PARSE_EVENTS__TERM_TYPE_CONFIG2 :case PARSE_EVENTS__TERM_TYPE_CONFIG3 : +case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG : +case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :case PARSE_EVENTS__TERM_TYPE_NAME :case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD :case PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ :
tools/perf/util/parse-events.h +3 -1
@@ -83,7 +83,9 @@ enum parse_events__term_type {PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE ,PARSE_EVENTS__TERM_TYPE_HARDWARE ,PARSE_EVENTS__TERM_TYPE_CPU , -#define __PARSE_EVENTS__TERM_TYPE_NR (PARSE_EVENTS__TERM_TYPE_CPU + 1) +PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG , +PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG , +#define __PARSE_EVENTS__TERM_TYPE_NR (PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG + 1) }; struct parse_events_term {
tools/perf/util/parse-events.l +2 -0
@@ -336,6 +336,8 @@ aux-action { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_ACTION); } aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); } metric-id { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); } cpu { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CPU); } +legacy-hardware-config { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG); } +legacy-cache-config { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG); } cpu-cycles|cycles { return hw_term(yyscanner, PERF_COUNT_HW_CPU_CYCLES); } stalled-cycles-frontend|idle-cycles-frontend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } stalled-cycles-backend|idle-cycles-backend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }
tools/perf/util/pmu.c +29 -0
@@ -1535,6 +1535,33 @@ static int pmu_config_term(const struct perf_pmu *pmu,assert (term->type_val ==PARSE_EVENTS__TERM_TYPE_NUM );pmu_format_value (bits, term->val.num, &attr->config3, zero);break ; +case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG : +assert (term->type_val ==PARSE_EVENTS__TERM_TYPE_NUM ); +assert (term->val.num <PERF_COUNT_HW_MAX ); +assert (pmu->is_core); + attr->config = term->val.num; +if (perf_pmus__supports_extended_type ()) + attr->config |= (__u64 )pmu->type <<PERF_PMU_TYPE_SHIFT ; + attr->type =PERF_TYPE_HARDWARE ; +break ; +case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG : { +int cache_type, cache_op, cache_result; + +assert (term->type_val ==PARSE_EVENTS__TERM_TYPE_NUM ); + cache_type = term->val.num &0xFF ; + cache_op = (term->val.num >>8 ) &0xFF ; + cache_result = (term->val.num >>16 ) &0xFF ; +assert ((term->val.num & ~0xFFFFFF ) ==0 ); +assert (cache_type <PERF_COUNT_HW_CACHE_MAX ); +assert (cache_op <PERF_COUNT_HW_CACHE_OP_MAX ); +assert (cache_result <PERF_COUNT_HW_CACHE_RESULT_MAX ); +assert (pmu->is_core); + attr->config = term->val.num; +if (perf_pmus__supports_extended_type ()) + attr->config |= (__u64 )pmu->type <<PERF_PMU_TYPE_SHIFT ; + attr->type =PERF_TYPE_HW_CACHE ; +break ; + }case PARSE_EVENTS__TERM_TYPE_USER :/* Not hardcoded. */ return -EINVAL ; case PARSE_EVENTS__TERM_TYPE_NAME ... PARSE_EVENTS__TERM_TYPE_CPU:
@@ -1926,6 +1953,8 @@ int perf_pmu__for_each_format(struct perf_pmu *pmu, void *state, pmu_format_call"config1=0..0xffffffffffffffff" ,"config2=0..0xffffffffffffffff" ,"config3=0..0xffffffffffffffff" , +"legacy-hardware-config=0..9," , +"legacy-cache-config=0..0xffffff," ,"name=string" ,"period=number" , "freq=number",
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 8/13 perf jevents: Add legacy json terms and default_core event table helper
In reply to Ian RogersAdd json LegacyConfigCode and LegacyCacheCode values that translate to legacy-hardware-config and legacy-cache-config event terms respectively.
Add perf_pmu__default_core_events_table as a means to find a default_core event table that will later contain legacy events.
--- tools/perf/pmu-events/empty-pmu-events.c | 18 ++++++++++++++++++ tools/perf/pmu-events/jevents.py | 24 ++++++++++++++++++++++++ tools/perf/pmu-events/pmu-events.h | 1 + 3 files changed, 43 insertions(+)
tools/perf/pmu-events/empty-pmu-events.c +18 -0
@@ -482,6 +482,8 @@ int pmu_events_table__find_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, void *data) { +if (!table) +return PMU_EVENTS__NOT_FOUND ;for (size_t i =0 ; i < table->num_pmus; i++) {const struct pmu_table_entry *table_pmu = &table->pmus[i];const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
@@ -707,6 +709,22 @@ const struct pmu_events_table *perf_pmu__find_events_table(struct perf_pmu *pmu)return NULL ; } +const struct pmu_events_table *perf_pmu__default_core_events_table (void ) +{ +int i =0 ; + +for (;;) { +const struct pmu_events_map *map = &pmu_events_map[i++]; + +if (!map->arch) +break ; + +if (!strcmp (map->cpuid,"common" )) +return &map->event_table; + } +return NULL ; +} +const struct pmu_metrics_table *pmu_metrics_table__find (void ) {struct perf_cpu cpu = {-1 };
tools/perf/pmu-events/jevents.py +24 -0
@@ -325,6 +325,8 @@ class JsonEvent: eventcode |= int(jd['ExtSel']) << 8 configcode = int(jd['ConfigCode'], 0) if 'ConfigCode' in jd else None eventidcode = int(jd['EventidCode'], 0) if 'EventidCode' in jd else None + legacy_hw_config = int(jd['LegacyConfigCode'], 0) if 'LegacyConfigCode' in jd else None + legacy_cache_config = int(jd['LegacyCacheCode'], 0) if 'LegacyCacheCode' in jd else None self.name = jd['EventName'].lower() if 'EventName' in jd else None self.topic = '' self.compat = jd.get('Compat')
@@ -370,6 +372,10 @@ class JsonEvent: event = f'config={llx(configcode)}' elif eventidcode is not None: event = f'eventid={llx(eventidcode)}' + elif legacy_hw_config is not None: + event = f'legacy-hardware-config={llx(legacy_hw_config)}' + elif legacy_cache_config is not None: + event = f'legacy-cache-config={llx(legacy_cache_config)}' else: event = f'event={llx(eventcode)}' event_fields = [
@@ -972,6 +978,8 @@ int pmu_events_table__find_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, void *data) { + if (!table) + return PMU_EVENTS__NOT_FOUND; for (size_t i = 0; i < table->num_pmus; i++) { const struct pmu_table_entry *table_pmu = &table->pmus[i]; const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
@@ -1197,6 +1205,22 @@ const struct pmu_events_table *perf_pmu__find_events_table(struct perf_pmu *pmu) return NULL; } +const struct pmu_events_table *perf_pmu__default_core_events_table(void) +{ + int i = 0; + + for (;;) { + const struct pmu_events_map *map = &pmu_events_map[i++]; + + if (!map->arch) + break; + + if (!strcmp(map->cpuid, "common")) + return &map->event_table; + } + return NULL; +} + const struct pmu_metrics_table *pmu_metrics_table__find(void) { struct perf_cpu cpu = {-1};
tools/perf/pmu-events/pmu-events.h +1 -0
@@ -125,6 +125,7 @@ int pmu_metrics_table__find_metric(const struct pmu_metrics_table *table, void *data);const struct pmu_events_table *perf_pmu__find_events_table (struct perf_pmu *pmu); +const struct pmu_events_table *perf_pmu__default_core_events_table (void );const struct pmu_metrics_table *pmu_metrics_table__find (void );const struct pmu_events_table *find_core_events_table (const char *arch,const char *cpuid);const struct pmu_metrics_table *find_core_metrics_table (const char *arch,const char *cpuid);
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 9/13 perf pmu: Add and use legacy_terms in alias information
In reply to Ian RogersAdd support to finding/adding events from the default_core event table. If an event already exists from sysfs/json then the default_core configuration is saved in the legacy_terms string. Lazily use the legacy_terms string to set a legacy hardware or cache event as deprecated if the core PMU doesn't support it. Use the legacy terms string to set the alternate_hw_config, avoiding the value needing to be passed from the parse_events parser.
--- tools/perf/util/pmu.c | 133 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 115 insertions(+), 18 deletions(-)
tools/perf/util/pmu.c +115 -18
@@ -69,6 +69,11 @@ struct perf_pmu_alias {char *topic;/** @terms: Owned copy of the event terms. */ char *terms; +/** +* @legacy_terms: If the event aliases a legacy event, holds a copy +* ofthe legacy event string. +*/ +char *legacy_terms;/** * @pmu_name: The name copied from the json struct pmu_event. This can * differ from the PMU name as it won't have suffixes.
@@ -101,6 +106,12 @@ struct perf_pmu_alias {* default. */ bool deprecated; +/** +* @legacy_deprecated_checked: Legacy events may not be supported by the +* PMU need to be checked. If they aren't supported they are marked +* deprecated. +*/ +bool legacy_deprecated_checked;/** @from_sysfs: Was the alias from sysfs or a json event? */ bool from_sysfs;/** @info_loaded: Have the scale, unit and other values been read from disk? */
@@ -430,6 +441,7 @@ static void perf_pmu_free_alias(struct perf_pmu_alias *alias)zfree (&alias->topic);zfree (&alias->pmu_name);zfree (&alias->terms); +zfree (&alias->legacy_terms);free (alias); }
@@ -522,6 +534,7 @@ static void read_alias_info(struct perf_pmu *pmu, struct perf_pmu_alias *alias)struct update_alias_data {struct perf_pmu *pmu;struct perf_pmu_alias *alias; +bool legacy; }; static int update_alias(const struct pmu_event *pe,
@@ -537,8 +550,13 @@ static int update_alias(const struct pmu_event *pe,assign_str (pe->name,"topic" , &data->alias->topic, pe->topic); data->alias->per_pkg = pe->perpkg;if (pe->event) { -zfree (&data->alias->terms); - data->alias->terms =strdup (pe->event); +if (data->legacy) { +zfree (&data->alias->legacy_terms); + data->alias->legacy_terms =strdup (pe->event); + }else { +zfree (&data->alias->terms); + data->alias->terms =strdup (pe->event); + } }if (!ret && pe->unit) {char *unit;
@@ -625,7 +643,6 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,return ret; } } - alias->name =strdup (name); alias->desc = desc ?strdup (desc) :NULL ; alias->long_desc = long_desc ?strdup (long_desc) :NULL ;
@@ -647,10 +664,24 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,struct update_alias_data data = { .pmu = pmu, .alias = alias, + .legacy = false, }; -if (pmu_events_table__find_event (pmu->events_table, pmu, name, - update_alias, &data) ==0 ) +if ((pmu_events_table__find_event (pmu->events_table, pmu, name, + update_alias, &data) ==0 )) { +/* +* Override sysfs encodings with json encodings +* specific to the cpuid. +*/ pmu->cpu_common_json_aliases++; + } +if (pmu->is_core) { +/* Add in legacy encodings. */ + data.legacy = true; +if (pmu_events_table__find_event ( +perf_pmu__default_core_events_table (), + pmu, name, update_alias, &data) ==0 ) + pmu->cpu_common_json_aliases++; + } } pmu->sysfs_aliases++;break ;
@@ -1057,13 +1088,16 @@ void pmu_add_cpu_aliases_table(struct perf_pmu *pmu, const struct pmu_events_tabstatic void pmu_add_cpu_aliases (struct perf_pmu *pmu) { -if (!pmu->events_table) +if (!pmu->events_table && !pmu->is_core)return ;if (pmu->cpu_aliases_added)return ;pmu_add_cpu_aliases_table (pmu, pmu->events_table); +if (pmu->is_core) +pmu_add_cpu_aliases_table (pmu,perf_pmu__default_core_events_table ()); + pmu->cpu_aliases_added = true; }
@@ -1740,10 +1774,14 @@ static struct perf_pmu_alias *pmu_find_alias(struct perf_pmu *pmu,return alias;/* Alias doesn't exist, try to get it from the json events. */ -if (pmu->events_table && -pmu_events_table__find_event (pmu->events_table, pmu, name, - pmu_add_cpu_aliases_map_callback, - pmu) ==0 ) { +if ((pmu_events_table__find_event (pmu->events_table, pmu, name, + pmu_add_cpu_aliases_map_callback, + pmu) ==0 ) || + (pmu->is_core && +pmu_events_table__find_event (perf_pmu__default_core_events_table (), + pmu, name, + pmu_add_cpu_aliases_map_callback, + pmu) ==0 )) { alias =perf_pmu__find_alias (pmu, name,/*load=*/ false); }return alias;
@@ -1867,6 +1905,20 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct parse_events_terms *head_if (ret)return ret; +if (alias->legacy_terms) { +struct perf_event_attr attr = {.config =0 ,}; + + ret =perf_pmu__parse_terms_to_attr (pmu, alias->legacy_terms, &attr); +if (ret) { +parse_events_error__handle (err, term->err_term, +strdup ("Error evaluating legacy terms" ), +NULL ); +return ret; + } +if (attr.type ==PERF_TYPE_HARDWARE ) + *alternate_hw_config = attr.config; + } +if (alias->per_pkg) info->per_pkg = true;
@@ -2037,7 +2089,11 @@ bool perf_pmu__have_event(struct perf_pmu *pmu, const char *name)return true;if (pmu->cpu_aliases_added || !pmu->events_table)return false; -return pmu_events_table__find_event (pmu->events_table, pmu, name,NULL ,NULL ) ==0 ; +if (pmu_events_table__find_event (pmu->events_table, pmu, name,NULL ,NULL ) ==0 ) +return true; +return pmu->is_core && +pmu_events_table__find_event (perf_pmu__default_core_events_table (), + pmu, name,NULL ,NULL ) ==0 ; }size_t perf_pmu__num_events (struct perf_pmu *pmu)
@@ -2054,13 +2110,18 @@ size_t perf_pmu__num_events(struct perf_pmu *pmu)pmu_aliases_parse (pmu); nr = pmu->sysfs_aliases + pmu->sys_json_aliases; -if (pmu->cpu_aliases_added) - nr += pmu->cpu_json_aliases; -else if (pmu->events_table) - nr +=pmu_events_table__num_events (pmu->events_table, pmu) - - pmu->cpu_common_json_aliases; -else +if (pmu->cpu_aliases_added) { + nr += pmu->cpu_json_aliases; + }else if (pmu->events_table || pmu->is_core) { + nr +=pmu_events_table__num_events (pmu->events_table, pmu); +if (pmu->is_core) { + nr +=pmu_events_table__num_events ( +perf_pmu__default_core_events_table (), pmu); + } + nr -= pmu->cpu_common_json_aliases; + }else {assert (pmu->cpu_json_aliases ==0 && pmu->cpu_common_json_aliases ==0 ); + }if (perf_pmu__is_tool (pmu)) nr -=tool_pmu__num_skip_events ();
@@ -2122,6 +2183,42 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,return buf; } +static bool perf_pmu_alias__check_deprecated (struct perf_pmu *pmu,struct perf_pmu_alias *alias) +{ +struct perf_event_attr attr = {.config =0 ,}; +const char *check_terms; +bool has_legacy_config; + +if (alias->legacy_deprecated_checked) +return alias->deprecated; + + alias->legacy_deprecated_checked = true; +if (alias->deprecated) +return true; + + check_terms = alias->terms; + has_legacy_config = +strstr (check_terms,"legacy-hardware-config=" ) !=NULL || +strstr (check_terms,"legacy-cache-config=" ) !=NULL ; +if (!has_legacy_config && alias->legacy_terms) { + check_terms = alias->legacy_terms; + has_legacy_config = +strstr (check_terms,"legacy-hardware-config=" ) !=NULL || +strstr (check_terms,"legacy-cache-config=" ) !=NULL ; + } +if (!has_legacy_config) +return false; + +if (perf_pmu__parse_terms_to_attr (pmu, check_terms, &attr) !=0 ) { +/* Parsing failed, set as deprecated. */ + alias->deprecated = true; + }else if (attr.type <PERF_TYPE_MAX ) { +/* Flag unsupported legacy events as deprecated. */ + alias->deprecated = !is_event_supported (attr.type, attr.config); + } +return alias->deprecated; +} +int perf_pmu__for_each_event (struct perf_pmu *pmu,bool skip_duplicate_pmus,void *state,pmu_event_callback cb) {
@@ -2179,7 +2276,7 @@ int perf_pmu__for_each_event(struct perf_pmu *pmu, bool skip_duplicate_pmus, "%.*s/%s/", (int)pmu_name_len, info.pmu_name, event->terms) + 1; info.str = event->terms; info.topic = event->topic; - info.deprecated = event->deprecated; + info.deprecated =perf_pmu_alias__check_deprecated (pmu, event); ret =cb (state, &info);if (ret) goto out;
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 10/13 perf jevents: Add legacy-hardware and legacy-cache json
In reply to Ian RogersThe legacy-hardware.json is added containing hardware events similarly to the software.json file. A difference is that for the software PMU the name is known and matches sysfs. In the legacy-hardware.json no Unit/PMU is specified for the events meaning default_core is used and the events will appear for all core PMUs.
There are potentially 1216 legacy cache events, rather than list them in a json file add a make_legacy_cache.py helper to generate them.
By using json for legacy hardware and cache events: descriptions of the events can be added; events can be marked as deprecated, such as those misleadingly named l2; and the name lookup becomes case insensitive.
The C string encoding all the perf events and metrics is increated in size by 123,499 bytes which will increase the perf binary size. Later changes will remove hard coded event parsing for legacy hardware and cache events, turning parsing overhead into a binary search during event lookup.
--- tools/perf/pmu-events/Build | 8 +- .../arch/common/common/legacy-hardware.json | 72 + tools/perf/pmu-events/empty-pmu-events.c | 2745 ++++++++++++++++- tools/perf/pmu-events/make_legacy_cache.py | 131 + 4 files changed, 2816 insertions(+), 140 deletions(-) create mode 100644 tools/perf/pmu-events/arch/common/common/legacy-hardware.json create mode 100755 tools/perf/pmu-events/make_legacy_cache.py
tools/perf/pmu-events/Build +7 -1
@@ -12,6 +12,8 @@ PMU_EVENTS_C = $(OUTPUT)pmu-events/pmu-events.c METRIC_TEST_LOG = $(OUTPUT)pmu-events/metric_test.log TEST_EMPTY_PMU_EVENTS_C = $(OUTPUT)pmu-events/test-empty-pmu-events.c EMPTY_PMU_EVENTS_TEST_LOG = $(OUTPUT)pmu-events/empty-pmu-events.log +LEGACY_CACHE_PY = pmu-events/make_legacy_cache.py +LEGACY_CACHE_JSON = $(OUTPUT)pmu-events/arch/common/common/legacy-cache.json ifeq ($(JEVENTS_ARCH),) JEVENTS_ARCH=$(SRCARCH)
@@ -33,7 +35,11 @@ $(OUTPUT)pmu-events/arch/%: pmu-events/arch/% $(call rule_mkdir) $(Q)$(call echo-cmd,gen)cp $< $@ -GEN_JSON = $(patsubst %,$(OUTPUT)%,$(JSON)) +$(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY) + $(call rule_mkdir) + $(Q)$(call echo-cmd,gen)$(PYTHON) $(LEGACY_CACHE_PY) > $@ + +GEN_JSON = $(patsubst %,$(OUTPUT)%,$(JSON)) $(LEGACY_CACHE_JSON) $(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY) $(call rule_mkdir)
tools/perf/pmu-events/arch/common/common/legacy-hardware.json new file +72 -0
72 lines not on this page · raw message
tools/perf/pmu-events/empty-pmu-events.c +2606 -139
2,839 lines not on this page · raw message
tools/perf/pmu-events/make_legacy_cache.py new file +131 -0
69 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Part of the diff is not shown here. View the raw message.
Ian Rogers
reviewerPATCH 11/13 perf print-events: Remove print_hwcache_events
In reply to Ian RogersNow legacy cache events are in json there's no need for a specific printing routine. To support the previous filtered version use an event glob of "legacy cache" which matches the topic of the json events.
--- tools/perf/builtin-list.c | 16 +++++++--- tools/perf/util/print-events.c | 55 ---------------------------------- tools/perf/util/print-events.h | 1 - 3 files changed, 12 insertions(+), 60 deletions(-)
tools/perf/builtin-list.c +12 -4
@@ -652,9 +652,18 @@ int cmd_list(int argc, const char **argv) } default_ps.pmu_glob = old_pmu_glob; }else if (strcmp (argv[i],"cache" ) ==0 || -strcmp (argv[i],"hwcache" ) ==0 ) -print_hwcache_events (&print_cb, ps); -else if (strcmp (argv[i],"pmu" ) ==0 ) { +strcmp (argv[i],"hwcache" ) ==0 ) { +char *old_event_glob = default_ps.event_glob; + + default_ps.event_glob =strdup ("legacy cache" ); +if (!default_ps.event_glob) { + ret =-1 ; + goto out; + } +perf_pmus__print_pmu_events (&print_cb, ps); +zfree (&default_ps.event_glob); + default_ps.event_glob = old_event_glob; + }else if (strcmp (argv[i],"pmu" ) ==0 ) { default_ps.exclude_abi = true;perf_pmus__print_pmu_events (&print_cb, ps); default_ps.exclude_abi = false;
@@ -707,7 +716,6 @@ int cmd_list(int argc, const char **argv) default_ps.event_glob = s;print_symbol_events (&print_cb, ps,PERF_TYPE_HARDWARE , event_symbols_hw,PERF_COUNT_HW_MAX ); -print_hwcache_events (&print_cb, ps);perf_pmus__print_pmu_events (&print_cb, ps);print_sdt_events (&print_cb, ps); default_ps.metrics = true;
tools/perf/util/print-events.c +0 -55
67 lines not on this page · raw message
tools/perf/util/print-events.h +0 -1
@@ -32,7 +32,6 @@ struct print_callbacks {/** Print all events, the default when no options are specified. */ void print_events (const struct print_callbacks *print_cb,void *print_state); -int print_hwcache_events (const struct print_callbacks *print_cb,void *print_state);void print_sdt_events (const struct print_callbacks *print_cb,void *print_state); void print_symbol_events(const struct print_callbacks *print_cb, void *print_state, unsigned int type, const struct event_symbol *syms,
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 12/13 perf print-events: Remove print_symbol_events
In reply to Ian RogersNow legacy hardware events are in json there's no need for a specific printing routine that previously served for both hardware and software events. The associated event_symbols_hw is also removed. To support the previous filtered version use an event glob of "legacy hardware" which matches the topic of the json events.
--- tools/perf/builtin-list.c | 18 +++++++---- tools/perf/util/parse-events.c | 43 ------------------------- tools/perf/util/parse-events.h | 1 - tools/perf/util/print-events.c | 57 ---------------------------------- tools/perf/util/print-events.h | 3 -- 5 files changed, 12 insertions(+), 110 deletions(-)
tools/perf/builtin-list.c +12 -6
@@ -633,10 +633,18 @@ int cmd_list(int argc, const char **argv)zfree (&default_ps.pmu_glob); default_ps.pmu_glob = old_pmu_glob; }else if (strcmp (argv[i],"hw" ) ==0 || -strcmp (argv[i],"hardware" ) ==0 ) -print_symbol_events (&print_cb, ps,PERF_TYPE_HARDWARE , - event_symbols_hw,PERF_COUNT_HW_MAX ); -else if (strcmp (argv[i],"sw" ) ==0 || +strcmp (argv[i],"hardware" ) ==0 ) { +char *old_event_glob = default_ps.event_glob; + + default_ps.event_glob =strdup ("legacy hardware" ); +if (!default_ps.event_glob) { + ret =-1 ; + goto out; + } +perf_pmus__print_pmu_events (&print_cb, ps); +zfree (&default_ps.event_glob); + default_ps.event_glob = old_event_glob; + }else if (strcmp (argv[i],"sw" ) ==0 ||strcmp (argv[i],"software" ) ==0 ) {char *old_pmu_glob = default_ps.pmu_glob;static const char *const sw_globs[] = {"software" ,"tool" };
@@ -714,8 +722,6 @@ int cmd_list(int argc, const char **argv)continue ; } default_ps.event_glob = s; -print_symbol_events (&print_cb, ps,PERF_TYPE_HARDWARE , - event_symbols_hw,PERF_COUNT_HW_MAX );perf_pmus__print_pmu_events (&print_cb, ps);print_sdt_events (&print_cb, ps); default_ps.metrics = true;
tools/perf/util/parse-events.c +0 -43
49 lines not on this page · raw message
tools/perf/util/parse-events.h +0 -1
@@ -265,7 +265,6 @@ struct event_symbol {const char *symbol;const char *alias; }; -extern const struct event_symbol event_symbols_hw[];char *parse_events_formats_error_string (char *additional_terms);
tools/perf/util/print-events.c +0 -57
69 lines not on this page · raw message
tools/perf/util/print-events.h +0 -3
@@ -33,9 +33,6 @@ struct print_callbacks {/** Print all events, the default when no options are specified. */ void print_events (const struct print_callbacks *print_cb,void *print_state);void print_sdt_events (const struct print_callbacks *print_cb,void *print_state); -void print_symbol_events (const struct print_callbacks *print_cb,void *print_state, -unsigned int type,const struct event_symbol *syms, -unsigned int max);void metricgroup__print (const struct print_callbacks *print_cb,void *print_state);bool is_event_supported (u8 type,u64 config);
Signature · 1 line
2.51.0.268.g9569e192d0-goog
Ian Rogers
reviewerPATCH 13/13 perf parse-events: Remove hard coded legacy hardware and cache parsing
In reply to Ian RogersNow that legacy hardware and cache events are in json, having the lexer match the specific event is no longer necessary and generic PMU parsing can take place. Because of this remove the specific term parsing, event adding, and passing of alternate_hw_config which was now always PERF_COUNT_HW_MAX.
This mirrors a similar change for software events in commit 6e9fa4131abb ("perf parse-events: Remove non-json software events").
With no hard coded legacy hardware or cache events the wild card, case insensitivity, etc. is consistent for events. This does, however, mean events like cycles will wild card against all PMUs. A change does the same was originally posted and merged from:
https://lore.kernel.org/r/[email protected]
and reverted by Linus in commit 4f1b067359ac ("Revert "perf
parse-events: Prefer sysfs/JSON hardware events over legacy"") due to his dislike for the cycles behavior on ARM. Earlier patches in this series make perf record event opening failures non-fatal and hide the cycles event's failure to open on ARM in perf record, so it is expected the behavior will now be transparent in perf record. perf stat with a cycles event will wildcard open the event on all PMUs.
The change to support legacy events with PMUs was done to clean up Intel's hybrid PMU implementation. Having sysfs/json events with increased priority to legacy was requested by Mark Rutland <[email protected]> to fix Apple-M PMU issues wrt broken legacy events on that PMU. It was requested that RISC-V be able to add events to the perf tool json so the PMU driver didn't need to map legacy events to config encodings:
https://lore.kernel.org/lkml/[email protected]/
A previous series of patches decreasing legacy hardware event priorities was posted in:
https://lore.kernel.org/lkml/[email protected]/
Namhyung Kim <[email protected]> mentioned that hardware and software events can be implemented similarly:
https://lore.kernel.org/lkml/[email protected]/
--- tools/perf/util/parse-events.c | 191 ++------------------------------- tools/perf/util/parse-events.h | 8 +- tools/perf/util/parse-events.l | 52 --------- tools/perf/util/parse-events.y | 114 +------------------- tools/perf/util/pmu.c | 6 +- 5 files changed, 17 insertions(+), 354 deletions(-)
tools/perf/util/parse-events.c +10 -181
@@ -419,111 +419,7 @@ bool parse_events__filter_pmu(const struct parse_events_state *parse_state,static int parse_events_add_pmu (struct parse_events_state *parse_state,struct list_head *list,struct perf_pmu *pmu,const struct parse_events_terms *const_parsed_terms, -struct evsel *first_wildcard_match,u64 alternate_hw_config); - -int parse_events_add_cache (struct list_head *list,int *idx,const char *name, -struct parse_events_state *parse_state, -struct parse_events_terms *parsed_terms, -void *loc_) -{ -YYLTYPE *loc = loc_; -struct perf_pmu *pmu =NULL ; -bool found_supported = false; -const char *config_name =get_config_name (parsed_terms); -const char *metric_id =get_config_metric_id (parsed_terms); -struct perf_cpu_map *cpus =get_config_cpu (parsed_terms); -int ret =0 ; -struct evsel *first_wildcard_match =NULL ; - -while ((pmu =perf_pmus__scan_for_event (pmu, name)) !=NULL ) { -LIST_HEAD (config_terms); -struct perf_event_attr attr; - -if (parse_events__filter_pmu (parse_state, pmu)) -continue ; - -if (perf_pmu__have_event (pmu, name)) { -/* -* The PMU has the event so add as not a legacy cache -* event. -*/ -struct parse_events_terms temp_terms; -struct parse_events_term *term; -char *config =strdup (name); - -if (!config) - goto out_err; - -parse_events_terms__init (&temp_terms); -if (!parsed_terms) - parsed_terms = &temp_terms; - -if (parse_events_term__num (&term, -PARSE_EVENTS__TERM_TYPE_USER , - config,/*num=*/ 1 ,/*novalue=*/ true, - loc,/*loc_val=*/ NULL ) <0 ) { -zfree (&config); - goto out_err; - } -list_add (&term->list, &parsed_terms->terms); - - ret =parse_events_add_pmu (parse_state, list, pmu, - parsed_terms, - first_wildcard_match, -/*alternate_hw_config=*/ PERF_COUNT_HW_MAX ); -list_del_init (&term->list); -parse_events_term__delete (term); -parse_events_terms__exit (&temp_terms); -if (ret) - goto out_err; - found_supported = true; -if (first_wildcard_match ==NULL ) - first_wildcard_match = - container_of(list->prev, struct evsel, core.node); -continue ; - } - -if (!pmu->is_core) { -/* Legacy cache events are only supported by core PMUs. */ -continue ; - } - -memset (&attr,0 ,sizeof (attr)); - attr.type =PERF_TYPE_HW_CACHE ; - - ret =parse_events__decode_legacy_cache (name, pmu->type, &attr.config); -if (ret) -return ret; - - found_supported = true; - -if (parsed_terms) { -if (config_attr (&attr, parsed_terms, parse_state->error, - config_term_common)) { - ret = -EINVAL ; - goto out_err; - } -if (get_config_terms (parsed_terms, &config_terms)) { - ret = -ENOMEM ; - goto out_err; - } - } - -if (__add_event (list, idx, &attr,/*init_attr*/ true, config_name ?: name, - metric_id, pmu, &config_terms, first_wildcard_match, - cpus,/*alternate_hw_config=*/ PERF_COUNT_HW_MAX ) ==NULL ) - ret = -ENOMEM ; - -if (first_wildcard_match ==NULL ) - first_wildcard_match = container_of(list->prev, struct evsel, core.node); -free_config_terms (&config_terms); -if (ret) - goto out_err; - } -out_err: -perf_cpu_map__put (cpus); -return found_supported ?0 : -EINVAL ; -} +struct evsel *first_wildcard_match);static void tracepoint_error (struct parse_events_error *e,int err,const char *sys,const char *name,int column)
@@ -815,8 +711,6 @@ const char *parse_events__term_type_str(enum parse_events__term_type term_type) [PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE] = "aux-sample-size", [PARSE_EVENTS__TERM_TYPE_METRIC_ID] = "metric-id", [PARSE_EVENTS__TERM_TYPE_RAW] = "raw", - [PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE] = "legacy-cache", - [PARSE_EVENTS__TERM_TYPE_HARDWARE] = "hardware", [PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG] = "legacy-hardware-config", [PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG] = "legacy-cache-config", [PARSE_EVENTS__TERM_TYPE_CPU] = "cpu",
@@ -868,8 +762,6 @@ config_term_avail(enum parse_events__term_type term_type, struct parse_events_ercase PARSE_EVENTS__TERM_TYPE_AUX_ACTION :case PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE :case PARSE_EVENTS__TERM_TYPE_RAW : -case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE : -case PARSE_EVENTS__TERM_TYPE_HARDWARE :case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG :case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :default :
@@ -1027,8 +919,6 @@ do { \ }case PARSE_EVENTS__TERM_TYPE_DRV_CFG :case PARSE_EVENTS__TERM_TYPE_USER : -case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE : -case PARSE_EVENTS__TERM_TYPE_HARDWARE :case PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG :case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG :default :
@@ -1115,59 +1005,6 @@ static int config_term_pmu(struct perf_event_attr *attr, attr->type =PERF_TYPE_HW_CACHE ;return 0 ; } -if (term->type_term ==PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE ) { -struct perf_pmu *pmu =perf_pmus__find_by_type (attr->type); - -if (!pmu) { -char *err_str; - -if (asprintf (&err_str,"Failed to find PMU for type %d" , attr->type) >=0 ) -parse_events_error__handle (err, term->err_term, - err_str,/*help=*/ NULL ); -return -EINVAL ; - } -/* -* Rewrite the PMU event to a legacy cache one unless the PMU -* doesn't support legacy cache events or the event is present -* within the PMU. -*/ -if (perf_pmu__supports_legacy_cache (pmu) && - !perf_pmu__have_event (pmu, term->config)) { - attr->type =PERF_TYPE_HW_CACHE ; -return parse_events__decode_legacy_cache (term->config, pmu->type, - &attr->config); - }else { - term->type_term =PARSE_EVENTS__TERM_TYPE_USER ; - term->no_value = true; - } - } -if (term->type_term ==PARSE_EVENTS__TERM_TYPE_HARDWARE ) { -struct perf_pmu *pmu =perf_pmus__find_by_type (attr->type); - -if (!pmu) { -char *err_str; - -if (asprintf (&err_str,"Failed to find PMU for type %d" , attr->type) >=0 ) -parse_events_error__handle (err, term->err_term, - err_str,/*help=*/ NULL ); -return -EINVAL ; - } -/* -* If the PMU has a sysfs or json event prefer it over -* legacy. ARM requires this. -*/ -if (perf_pmu__have_event (pmu, term->config)) { - term->type_term =PARSE_EVENTS__TERM_TYPE_USER ; - term->no_value = true; - term->alternate_hw_config = true; - }else { - attr->type =PERF_TYPE_HARDWARE ; - attr->config = term->val.num; -if (perf_pmus__supports_extended_type ()) - attr->config |= (__u64 )pmu->type <<PERF_PMU_TYPE_SHIFT ; - } -return 0 ; - }if (term->type_term ==PARSE_EVENTS__TERM_TYPE_USER || term->type_term ==PARSE_EVENTS__TERM_TYPE_DRV_CFG ) {/*
@@ -1212,8 +1049,6 @@ static int config_term_tracepoint(struct perf_event_attr *attr,case PARSE_EVENTS__TERM_TYPE_PERCORE :case PARSE_EVENTS__TERM_TYPE_METRIC_ID :case PARSE_EVENTS__TERM_TYPE_RAW : -case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE : -case PARSE_EVENTS__TERM_TYPE_HARDWARE :case PARSE_EVENTS__TERM_TYPE_CPU :default :if (err) {
@@ -1349,8 +1184,6 @@ do { \case PARSE_EVENTS__TERM_TYPE_NAME :case PARSE_EVENTS__TERM_TYPE_METRIC_ID :case PARSE_EVENTS__TERM_TYPE_RAW : -case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE : -case PARSE_EVENTS__TERM_TYPE_HARDWARE :case PARSE_EVENTS__TERM_TYPE_CPU :default :break ;
@@ -1406,8 +1239,6 @@ static int get_config_chgs(struct perf_pmu *pmu, struct parse_events_terms *headcase PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE :case PARSE_EVENTS__TERM_TYPE_METRIC_ID :case PARSE_EVENTS__TERM_TYPE_RAW : -case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE : -case PARSE_EVENTS__TERM_TYPE_HARDWARE :case PARSE_EVENTS__TERM_TYPE_CPU :default :break ;
@@ -1533,8 +1364,9 @@ static bool config_term_percore(struct list_head *config_terms)static int parse_events_add_pmu (struct parse_events_state *parse_state,struct list_head *list,struct perf_pmu *pmu,const struct parse_events_terms *const_parsed_terms, -struct evsel *first_wildcard_match,u64 alternate_hw_config) +struct evsel *first_wildcard_match) { +u64 alternate_hw_config =PERF_COUNT_HW_MAX ;struct perf_event_attr attr;struct perf_pmu_info info;struct evsel *evsel;
@@ -1667,7 +1499,7 @@ static int parse_events_add_pmu(struct parse_events_state *parse_state, }int parse_events_multi_pmu_add (struct parse_events_state *parse_state, -const char *event_name,u64 hw_config, +const char *event_name,const struct parse_events_terms *const_parsed_terms,struct list_head **listp,void *loc_) {
@@ -1719,7 +1551,7 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,continue ;if (!parse_events_add_pmu (parse_state, list, pmu, - &parsed_terms, first_wildcard_match, hw_config)) { + &parsed_terms, first_wildcard_match)) {struct strbuf sb;strbuf_init (&sb,/*hint=*/ 0 );
@@ -1734,7 +1566,7 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,if (parse_state->fake_pmu) {if (!parse_events_add_pmu (parse_state, list,perf_pmus__fake_pmu (), &parsed_terms, - first_wildcard_match, hw_config)) { + first_wildcard_match)) {struct strbuf sb;strbuf_init (&sb,/*hint=*/ 0 );
@@ -1776,15 +1608,13 @@ int parse_events_multi_pmu_add_or_add_pmu(struct parse_events_state *parse_state/* Attempt to add to list assuming event_or_pmu is a PMU name. */ pmu =perf_pmus__find (event_or_pmu);if (pmu && !parse_events_add_pmu (parse_state, *listp, pmu, const_parsed_terms, - first_wildcard_match, -/*alternate_hw_config=*/ PERF_COUNT_HW_MAX )) + first_wildcard_match))return 0 ;if (parse_state->fake_pmu) {if (!parse_events_add_pmu (parse_state, *listp,perf_pmus__fake_pmu (), const_parsed_terms, - first_wildcard_match, -/*alternate_hw_config=*/ PERF_COUNT_HW_MAX )) + first_wildcard_match))return 0 ; }
@@ -1797,8 +1627,7 @@ int parse_events_multi_pmu_add_or_add_pmu(struct parse_events_state *parse_stateif (!parse_events_add_pmu (parse_state, *listp, pmu, const_parsed_terms, - first_wildcard_match, -/*alternate_hw_config=*/ PERF_COUNT_HW_MAX )) { + first_wildcard_match)) { ok++; parse_state->wild_card_pmus = true; }
@@ -1812,7 +1641,7 @@ int parse_events_multi_pmu_add_or_add_pmu(struct parse_events_state *parse_state/* Failure to add, assume event_or_pmu is an event name. */ zfree (listp); -if (!parse_events_multi_pmu_add (parse_state, event_or_pmu,PERF_COUNT_HW_MAX , +if (!parse_events_multi_pmu_add (parse_state, event_or_pmu, const_parsed_terms, listp, loc))return 0 ;
tools/perf/util/parse-events.h +1 -7
@@ -80,8 +80,6 @@ enum parse_events__term_type {PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE ,PARSE_EVENTS__TERM_TYPE_METRIC_ID ,PARSE_EVENTS__TERM_TYPE_RAW , -PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE , -PARSE_EVENTS__TERM_TYPE_HARDWARE ,PARSE_EVENTS__TERM_TYPE_CPU ,PARSE_EVENTS__TERM_TYPE_LEGACY_HARDWARE_CONFIG , PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE_CONFIG,
@@ -234,10 +232,6 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, u32 type, u64 config, const struct parse_events_terms *head_config, bool wildcard); -int parse_events_add_cache (struct list_head *list,int *idx,const char *name, -struct parse_events_state *parse_state, -struct parse_events_terms *parsed_terms, -void *loc);int parse_events__decode_legacy_cache (const char *name,int pmu_type,__u64 *config); int parse_events_add_breakpoint(struct parse_events_state *parse_state, struct list_head *list,
@@ -249,7 +243,7 @@ struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr, struct perf_pmu *pmu);int parse_events_multi_pmu_add (struct parse_events_state *parse_state, -const char *event_name,u64 hw_config, +const char *event_name,const struct parse_events_terms *const_parsed_terms,struct list_head **listp,void *loc);
tools/perf/util/parse-events.l +0 -52
92 lines not on this page · raw message
tools/perf/util/parse-events.y +3 -111
191 lines not on this page · raw message
tools/perf/util/pmu.c +3 -3
@@ -2031,10 +2031,10 @@ int perf_pmu__for_each_format(struct perf_pmu *pmu, void *state, pmu_format_call/* * max-events and driver-config are missing above as are the internal -* types user, metric-id, raw, legacy cache and hardware. Assert against -* the enum parse_events__term_type so they are kept in sync. +* types user, metric-id, and raw. Assert against the enum +* parse_events__term_type so they are kept in sync. */ -_Static_assert (ARRAY_SIZE (terms) == __PARSE_EVENTS__TERM_TYPE_NR -6 , +_Static_assert (ARRAY_SIZE (terms) == __PARSE_EVENTS__TERM_TYPE_NR -4 ,"perf_pmu__for_each_format()'s terms must be kept in sync with enum parse_events__term_type" );list_for_each_entry (format, &pmu->format, list) {perf_pmu_format__load (pmu, format);
Signature · 1 line
2.51.0.268.g9569e192d0-goog