perf/core improvements and fixes
Subsystems (5)
Arnaldo Carvalho de Melo
maintainerHi Ingo/Thomas,
Please consider pulling,
Best regards,
- Arnaldo
The following changes since commit e1e9b78d3957a267346a86c8f2c433f6a332af65:
perf parse: Use YYABORT to clear stack after failure, plugging leaks (2019-11-12 08:34:16 -0300)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-5.5-20191119
for you to fetch changes up to a910e4666d61712840c78de33cc7f89de8affa78:
perf parse: Report initial event parsing error (2019-11-18 19:14:29 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
x86/insn:
Adrian Hunter:
- Add some more Intel instructions to the opcode map:
cldemote, encls, enclu, enclv, enqcmd, enqcmds, movdir64b, movdiri, pconfig, tpause, umonitor, umwait, wbnoinvd.
- The instruction decoding can be tested using the perf tools' "x86 instruction decoder - new instructions" test as folllows:
$ perf test -v "new " 2>&1 | grep -i cldemote
Decoded ok: 0f 1c 00 cldemote (%eax)
Decoded ok: 0f 1c 05 78 56 34 12 cldemote 0x12345678
Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%eax,%ecx,8)
Decoded ok: 0f 1c 00 cldemote (%rax)
Decoded ok: 41 0f 1c 00 cldemote (%r8)
Decoded ok: 0f 1c 04 25 78 56 34 12 cldemote 0x12345678
Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%rax,%rcx,8)
Decoded ok: 41 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%r8,%rcx,8) $ perf test -v "new " 2>&1 | grep -i tpause
Decoded ok: 66 0f ae f3 tpause %ebx
Decoded ok: 66 0f ae f3 tpause %ebx
Decoded ok: 66 41 0f ae f0 tpause %r8d
callchains:
Adrian Hunter:
- Fix segfault in thread__resolve_callchain_sample().
perf probe:
- Line fixes to show only lines where probes can be used with 'perf probe -L', and when reporting them via 'perf probe -l'.
- Support multiprobe events.
perf scripts python:
Adrian Hunter:
- Fix use of TRUE with SQLite < 3.23 in exported-sql-viewer.py.
perf maps:
- Trim 'struct map' by removing the rb_node member for sorting by map name, as that is only needed for processing kernel maps, and only when classifying symbols by section at load time. Sort them by name using qsort() and do lookups using bsearch() when map_groups__find_by_name() is used.
perf parse:
Ian Rogers:
- Report initial event parsing error, providing a less cryptic message to state that a PMU wasn't found in the system.
perf vendor events:
James Clark:
- Fix commas so that PMU event files for arm64, power8 and power nine become valid JSON.
libtraceevent:
Konstantin Khlebnikov:
- Fix parsing of event %o and %X argument types.
----------------------------------------------------------------
Adrian Hunter (4):
perf scripts python: exported-sql-viewer.py: Fix use of TRUE with SQLite perf callchain: Fix segfault in thread__resolve_callchain_sample() x86/insn: perf tools: Add some instructions to the new instructions test x86/insn: Add some Intel instructions to the opcode map
Arnaldo Carvalho de Melo (9):
perf maps: Purge the entries from maps->names in __maps__purge() perf maps: Do not use an rbtree to sort by map name perf map_groups: Add a front end cache for map lookups by name perf map: No need to adjust the long name of modules perf record: No need to process the synthesized MMAP events twice perf machine: No need to check if kernel module maps pre-exist perf map_groups: Auto sort maps by name, if needed perf map: Use bitmap for booleans
perf map: Move seldom used ->flags field to second cacheline
Ian Rogers (1):
perf parse: Report initial event parsing error
James Clark (3):
perf vendor events arm64: Fix commas so PMU event files are valid JSON perf vendor events power8: Fix commas so PMU event files are valid JSON perf vendor events power9: Fix commas so PMU event files are valid JSON
Konstantin Khlebnikov (1):
libtraceevent: Fix parsing of event %o and %X argument types
Masami Hiramatsu (7):
perf probe: Show correct statement line number by perf probe -l perf probe: Verify given line is a representive line perf probe: Do not show non representive lines by perf-probe -L perf probe: Generate event name with line number perf probe: Support multiprobe event
perf probe: Support DW_AT_const_value constant value perf probe: Trace a magic number if variable is not found
arch/x86/lib/x86-opcode-map.txt | 18 +- tools/arch/x86/lib/x86-opcode-map.txt | 18 +- tools/lib/traceevent/event-parse.c | 7 +- tools/perf/arch/powerpc/util/kvm-stat.c | 4 +- tools/perf/arch/x86/tests/insn-x86-dat-32.c | 52 + tools/perf/arch/x86/tests/insn-x86-dat-64.c | 62 ++ tools/perf/arch/x86/tests/insn-x86-dat-src.c | 109 ++ tools/perf/builtin-record.c | 29 +- tools/perf/builtin-stat.c | 2 + tools/perf/builtin-trace.c | 16 +- .../pmu-events/arch/arm64/ampere/emag/branch.json | 8 +- .../pmu-events/arch/arm64/ampere/emag/bus.json | 14 +- .../pmu-events/arch/arm64/ampere/emag/cache.json | 28 +- .../pmu-events/arch/arm64/ampere/emag/clock.json | 2 +- .../arch/arm64/ampere/emag/exception.json | 26 +- .../arch/arm64/ampere/emag/instruction.json | 28 +- .../arch/arm64/ampere/emag/intrinsic.json | 10 +- .../pmu-events/arch/arm64/ampere/emag/memory.json | 12 +- .../arch/arm64/ampere/emag/pipeline.json | 2 +- .../arch/arm64/arm/cortex-a53/branch.json | 2 +- .../pmu-events/arch/arm64/arm/cortex-a53/bus.json | 4 +- .../arch/arm64/arm/cortex-a53/other.json | 4 +- .../arm64/arm/cortex-a57-a72/core-imp-def.json | 120 +- .../pmu-events/arch/arm64/armv8-recommended.json | 158 +-- .../arch/arm64/cavium/thunderx2/core-imp-def.json | 74 +- .../arch/arm64/hisilicon/hip08/core-imp-def.json | 60 +- .../arch/arm64/hisilicon/hip08/uncore-ddrc.json | 18 +- .../arch/arm64/hisilicon/hip08/uncore-hha.json | 22 +- .../arch/arm64/hisilicon/hip08/uncore-l3c.json | 28 +- .../perf/pmu-events/arch/powerpc/power8/cache.json | 60 +- .../arch/powerpc/power8/floating-point.json | 6 +- .../pmu-events/arch/powerpc/power8/frontend.json | 158 +-- .../pmu-events/arch/powerpc/power8/marked.json | 266 ++--- .../pmu-events/arch/powerpc/power8/memory.json | 72 +- .../perf/pmu-events/arch/powerpc/power8/other.json | 1150 ++++++++++---------- .../pmu-events/arch/powerpc/power8/pipeline.json | 118 +- tools/perf/pmu-events/arch/powerpc/power8/pmc.json | 48 +- .../arch/powerpc/power8/translation.json | 60 +- .../perf/pmu-events/arch/powerpc/power9/cache.json | 44 +- .../arch/powerpc/power9/floating-point.json | 14 +- .../pmu-events/arch/powerpc/power9/frontend.json | 142 +-- .../pmu-events/arch/powerpc/power9/marked.json | 250 ++--- .../pmu-events/arch/powerpc/power9/memory.json | 52 +- .../perf/pmu-events/arch/powerpc/power9/other.json | 934 ++++++++-------- .../pmu-events/arch/powerpc/power9/pipeline.json | 212 ++-- tools/perf/pmu-events/arch/powerpc/power9/pmc.json | 48 +- .../arch/powerpc/power9/translation.json | 92 +- tools/perf/scripts/python/exported-sql-viewer.py | 12 +- tools/perf/tests/map_groups.c | 2 +- tools/perf/tests/parse-events.c | 3 +- tools/perf/util/dwarf-aux.c | 62 +- tools/perf/util/machine.c | 43 +- tools/perf/util/machine.h | 2 - tools/perf/util/map.c | 116 +- tools/perf/util/map.h | 7 +- tools/perf/util/map_groups.h | 21 +- tools/perf/util/metricgroup.c | 2 +- tools/perf/util/parse-events.c | 78 +- tools/perf/util/parse-events.h | 4 + tools/perf/util/probe-event.c | 19 +- tools/perf/util/probe-event.h | 3 + tools/perf/util/probe-file.c | 14 + tools/perf/util/probe-file.h | 2 + tools/perf/util/probe-finder.c | 116 +- tools/perf/util/probe-finder.h | 1 + tools/perf/util/symbol.c | 84 +- 66 files changed, 2888 insertions(+), 2366 deletions(-)
Arnaldo Carvalho de Melo
maintainerPATCH 1/25 perf vendor events arm64: Fix commas so PMU event files are valid JSON
From: James Clark <[email protected]>
No functional change.
Add and remove extra commas in the arm64 JSON files so that the files can be parsed and validated by other utilities such as Python that fail to parse invalid JSON.
Committer testing:
Before:
$ diffstat -l -p1 /wb/1.patch | while read filename ; do echo $filename ; cat $filename | json_verify ; done
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
parse error: unallowed token at this point in JSON text
[ { "PublicDescrip
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
parse error: unallowed token at this point in JSON text
[ { "PublicDescrip
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/arm/cortex-a53/branch.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent": "BR
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/arm/cortex-a53/bus.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent":
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/arm/cortex-a53/other.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent":
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/arm/cortex-a57-a72/core-imp-def.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/armv8-recommended.json
parse error: after array element, I expect ',' or ']'
[ { "PublicDescrip
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/core-imp-def.json
parse error: invalid object key (must be a string)
[ { "ArchStdEvent"
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
parse error: invalid object key (must be a string)
[ { "EventCode": "0x00
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
parse error: invalid object key (must be a string)
[ { "EventCode": "0x00
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
parse error: invalid object key (must be a string)
[ { "EventCode": "0x00
(right here) ------^
JSON is invalid
$After:
$ diffstat -l -p1 /wb/1.patch | while read filename ; do echo $filename ; cat $filename | json_verify ; done tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json JSON is valid tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json JSON is valid tools/perf/pmu-events/arch/arm64/arm/cortex-a53/branch.json JSON is valid tools/perf/pmu-events/arch/arm64/arm/cortex-a53/bus.json JSON is valid tools/perf/pmu-events/arch/arm64/arm/cortex-a53/other.json JSON is valid tools/perf/pmu-events/arch/arm64/arm/cortex-a57-a72/core-imp-def.json JSON is valid tools/perf/pmu-events/arch/arm64/armv8-recommended.json JSON is valid tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json JSON is valid tools/perf/pmu-events/arch/arm64/hisilicon/hip08/core-imp-def.json JSON is valid tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json JSON is valid tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json JSON is valid tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json JSON is valid $
--- .../arch/arm64/ampere/emag/branch.json | 8 +- .../arch/arm64/ampere/emag/bus.json | 14 +- .../arch/arm64/ampere/emag/cache.json | 28 ++-- .../arch/arm64/ampere/emag/clock.json | 2 +- .../arch/arm64/ampere/emag/exception.json | 26 +-- .../arch/arm64/ampere/emag/instruction.json | 28 ++-- .../arch/arm64/ampere/emag/intrinsic.json | 10 +- .../arch/arm64/ampere/emag/memory.json | 12 +- .../arch/arm64/ampere/emag/pipeline.json | 2 +- .../arch/arm64/arm/cortex-a53/branch.json | 2 +- .../arch/arm64/arm/cortex-a53/bus.json | 4 +- .../arch/arm64/arm/cortex-a53/other.json | 4 +- .../arm/cortex-a57-a72/core-imp-def.json | 120 ++++++------- .../arch/arm64/armv8-recommended.json | 158 +++++++++--------- .../arm64/cavium/thunderx2/core-imp-def.json | 74 ++++---- .../arm64/hisilicon/hip08/core-imp-def.json | 60 +++---- .../arm64/hisilicon/hip08/uncore-ddrc.json | 18 +- .../arm64/hisilicon/hip08/uncore-hha.json | 22 +-- .../arm64/hisilicon/hip08/uncore-l3c.json | 28 ++-- 19 files changed, 310 insertions(+), 310 deletions(-)
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json +4 -4
@@ -1,12 +1,12 @@ [ { - "ArchStdEvent": "BR_IMMED_SPEC", + "ArchStdEvent": "BR_IMMED_SPEC" }, { - "ArchStdEvent": "BR_RETURN_SPEC", + "ArchStdEvent": "BR_RETURN_SPEC" }, { - "ArchStdEvent": "BR_INDIRECT_SPEC", + "ArchStdEvent": "BR_INDIRECT_SPEC" }, { "PublicDescription": "Mispredicted or not predicted branch speculatively executed",
@@ -19,5 +19,5 @@ "EventCode": "0x12", "EventName": "BR_PRED", "BriefDescription": "Predictable branch" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json +7 -7
@@ -1,26 +1,26 @@ [ { - "ArchStdEvent": "BUS_ACCESS_RD", + "ArchStdEvent": "BUS_ACCESS_RD" }, { - "ArchStdEvent": "BUS_ACCESS_WR", + "ArchStdEvent": "BUS_ACCESS_WR" }, { - "ArchStdEvent": "BUS_ACCESS_SHARED", + "ArchStdEvent": "BUS_ACCESS_SHARED" }, { - "ArchStdEvent": "BUS_ACCESS_NOT_SHARED", + "ArchStdEvent": "BUS_ACCESS_NOT_SHARED" }, { - "ArchStdEvent": "BUS_ACCESS_NORMAL", + "ArchStdEvent": "BUS_ACCESS_NORMAL" }, { - "ArchStdEvent": "BUS_ACCESS_PERIPH", + "ArchStdEvent": "BUS_ACCESS_PERIPH" }, { "PublicDescription": "Bus access", "EventCode": "0x19", "EventName": "BUS_ACCESS", "BriefDescription": "Bus access" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json +14 -14
@@ -1,42 +1,42 @@ [ { - "ArchStdEvent": "L1D_CACHE_RD", + "ArchStdEvent": "L1D_CACHE_RD" }, { - "ArchStdEvent": "L1D_CACHE_WR", + "ArchStdEvent": "L1D_CACHE_WR" }, { - "ArchStdEvent": "L1D_CACHE_REFILL_RD", + "ArchStdEvent": "L1D_CACHE_REFILL_RD" }, { - "ArchStdEvent": "L1D_CACHE_INVAL", + "ArchStdEvent": "L1D_CACHE_INVAL" }, { - "ArchStdEvent": "L1D_TLB_REFILL_RD", + "ArchStdEvent": "L1D_TLB_REFILL_RD" }, { - "ArchStdEvent": "L1D_TLB_REFILL_WR", + "ArchStdEvent": "L1D_TLB_REFILL_WR" }, { - "ArchStdEvent": "L2D_CACHE_RD", + "ArchStdEvent": "L2D_CACHE_RD" }, { - "ArchStdEvent": "L2D_CACHE_WR", + "ArchStdEvent": "L2D_CACHE_WR" }, { - "ArchStdEvent": "L2D_CACHE_REFILL_RD", + "ArchStdEvent": "L2D_CACHE_REFILL_RD" }, { - "ArchStdEvent": "L2D_CACHE_REFILL_WR", + "ArchStdEvent": "L2D_CACHE_REFILL_WR" }, { - "ArchStdEvent": "L2D_CACHE_WB_VICTIM", + "ArchStdEvent": "L2D_CACHE_WB_VICTIM" }, { - "ArchStdEvent": "L2D_CACHE_WB_CLEAN", + "ArchStdEvent": "L2D_CACHE_WB_CLEAN" }, { - "ArchStdEvent": "L2D_CACHE_INVAL", + "ArchStdEvent": "L2D_CACHE_INVAL" }, { "PublicDescription": "Level 1 instruction cache refill",
@@ -187,5 +187,5 @@ "EventCode": "0x116", "EventName": "PAGE_WALK_L2_STAGE2_HIT", "BriefDescription": "Page walk, L2 stage-2 hit" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json +1 -1
@@ -16,5 +16,5 @@ "EventCode": "0x110", "EventName": "Wait_CYCLES", "BriefDescription": "Wait state cycle" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json +13 -13
@@ -1,39 +1,39 @@ [ { - "ArchStdEvent": "EXC_UNDEF", + "ArchStdEvent": "EXC_UNDEF" }, { - "ArchStdEvent": "EXC_SVC", + "ArchStdEvent": "EXC_SVC" }, { - "ArchStdEvent": "EXC_PABORT", + "ArchStdEvent": "EXC_PABORT" }, { - "ArchStdEvent": "EXC_DABORT", + "ArchStdEvent": "EXC_DABORT" }, { - "ArchStdEvent": "EXC_IRQ", + "ArchStdEvent": "EXC_IRQ" }, { - "ArchStdEvent": "EXC_FIQ", + "ArchStdEvent": "EXC_FIQ" }, { - "ArchStdEvent": "EXC_HVC", + "ArchStdEvent": "EXC_HVC" }, { - "ArchStdEvent": "EXC_TRAP_PABORT", + "ArchStdEvent": "EXC_TRAP_PABORT" }, { - "ArchStdEvent": "EXC_TRAP_DABORT", + "ArchStdEvent": "EXC_TRAP_DABORT" }, { - "ArchStdEvent": "EXC_TRAP_OTHER", + "ArchStdEvent": "EXC_TRAP_OTHER" }, { - "ArchStdEvent": "EXC_TRAP_IRQ", + "ArchStdEvent": "EXC_TRAP_IRQ" }, { - "ArchStdEvent": "EXC_TRAP_FIQ", + "ArchStdEvent": "EXC_TRAP_FIQ" }, { "PublicDescription": "Exception taken",
@@ -46,5 +46,5 @@ "EventCode": "0x0a", "EventName": "EXC_RETURN", "BriefDescription": "Exception return" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json +14 -14
@@ -1,42 +1,42 @@ [ { - "ArchStdEvent": "LD_SPEC", + "ArchStdEvent": "LD_SPEC" }, { - "ArchStdEvent": "ST_SPEC", + "ArchStdEvent": "ST_SPEC" }, { - "ArchStdEvent": "LDST_SPEC", + "ArchStdEvent": "LDST_SPEC" }, { - "ArchStdEvent": "DP_SPEC", + "ArchStdEvent": "DP_SPEC" }, { - "ArchStdEvent": "ASE_SPEC", + "ArchStdEvent": "ASE_SPEC" }, { - "ArchStdEvent": "VFP_SPEC", + "ArchStdEvent": "VFP_SPEC" }, { - "ArchStdEvent": "PC_WRITE_SPEC", + "ArchStdEvent": "PC_WRITE_SPEC" }, { - "ArchStdEvent": "CRYPTO_SPEC", + "ArchStdEvent": "CRYPTO_SPEC" }, { - "ArchStdEvent": "ISB_SPEC", + "ArchStdEvent": "ISB_SPEC" }, { - "ArchStdEvent": "DSB_SPEC", + "ArchStdEvent": "DSB_SPEC" }, { - "ArchStdEvent": "DMB_SPEC", + "ArchStdEvent": "DMB_SPEC" }, { - "ArchStdEvent": "RC_LD_SPEC", + "ArchStdEvent": "RC_LD_SPEC" }, { - "ArchStdEvent": "RC_ST_SPEC", + "ArchStdEvent": "RC_ST_SPEC" }, { "PublicDescription": "Instruction architecturally executed, software increment",
@@ -85,5 +85,5 @@ "EventCode": "0x100", "EventName": "NOP_SPEC", "BriefDescription": "Speculatively executed, NOP" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json +5 -5
@@ -1,14 +1,14 @@ [ { - "ArchStdEvent": "LDREX_SPEC", + "ArchStdEvent": "LDREX_SPEC" }, { - "ArchStdEvent": "STREX_PASS_SPEC", + "ArchStdEvent": "STREX_PASS_SPEC" }, { - "ArchStdEvent": "STREX_FAIL_SPEC", + "ArchStdEvent": "STREX_FAIL_SPEC" }, { - "ArchStdEvent": "STREX_SPEC", - }, + "ArchStdEvent": "STREX_SPEC" + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json +6 -6
@@ -1,18 +1,18 @@ [ { - "ArchStdEvent": "MEM_ACCESS_RD", + "ArchStdEvent": "MEM_ACCESS_RD" }, { - "ArchStdEvent": "MEM_ACCESS_WR", + "ArchStdEvent": "MEM_ACCESS_WR" }, { - "ArchStdEvent": "UNALIGNED_LD_SPEC", + "ArchStdEvent": "UNALIGNED_LD_SPEC" }, { - "ArchStdEvent": "UNALIGNED_ST_SPEC", + "ArchStdEvent": "UNALIGNED_ST_SPEC" }, { - "ArchStdEvent": "UNALIGNED_LDST_SPEC", + "ArchStdEvent": "UNALIGNED_LDST_SPEC" }, { "PublicDescription": "Data memory access",
@@ -25,5 +25,5 @@ "EventCode": "0x1a", "EventName": "MEM_ERROR", "BriefDescription": "Memory error" - }, + } ]
tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json +1 -1
@@ -46,5 +46,5 @@ "EventCode": "0x10f", "EventName": "FX_STALL", "BriefDescription": "FX stalled" - }, + } ]
tools/perf/pmu-events/arch/arm64/arm/cortex-a53/branch.json +1 -1
@@ -1,6 +1,6 @@ [ { - "ArchStdEvent": "BR_INDIRECT_SPEC", + "ArchStdEvent": "BR_INDIRECT_SPEC" }, { "EventCode": "0xC9",
tools/perf/pmu-events/arch/arm64/arm/cortex-a53/bus.json +2 -2
@@ -1,8 +1,8 @@ [ { - "ArchStdEvent": "BUS_ACCESS_RD", + "ArchStdEvent": "BUS_ACCESS_RD" }, { - "ArchStdEvent": "BUS_ACCESS_WR", + "ArchStdEvent": "BUS_ACCESS_WR" } ]
tools/perf/pmu-events/arch/arm64/arm/cortex-a53/other.json +2 -2
@@ -1,9 +1,9 @@ [ { - "ArchStdEvent": "EXC_IRQ", + "ArchStdEvent": "EXC_IRQ" }, { - "ArchStdEvent": "EXC_FIQ", + "ArchStdEvent": "EXC_FIQ" }, { "EventCode": "0xC6",
tools/perf/pmu-events/arch/arm64/arm/cortex-a57-a72/core-imp-def.json +60 -60
239 lines not on this page · raw message
tools/perf/pmu-events/arch/arm64/armv8-recommended.json +79 -79
376 lines not on this page · raw message
tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json +37 -37
150 lines not on this page · raw message
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/core-imp-def.json +30 -30
152 lines not on this page · raw message
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json +9 -9
@@ -4,55 +4,55 @@ "EventName": "uncore_hisi_ddrc.flux_wr", "BriefDescription": "DDRC total write operations", "PublicDescription": "DDRC total write operations", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x01", "EventName": "uncore_hisi_ddrc.flux_rd", "BriefDescription": "DDRC total read operations", "PublicDescription": "DDRC total read operations", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x02", "EventName": "uncore_hisi_ddrc.flux_wcmd", "BriefDescription": "DDRC write commands", "PublicDescription": "DDRC write commands", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x03", "EventName": "uncore_hisi_ddrc.flux_rcmd", "BriefDescription": "DDRC read commands", "PublicDescription": "DDRC read commands", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x04", "EventName": "uncore_hisi_ddrc.pre_cmd", "BriefDescription": "DDRC precharge commands", "PublicDescription": "DDRC precharge commands", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x05", "EventName": "uncore_hisi_ddrc.act_cmd", "BriefDescription": "DDRC active commands", "PublicDescription": "DDRC active commands", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x06", "EventName": "uncore_hisi_ddrc.rnk_chg", "BriefDescription": "DDRC rank commands", "PublicDescription": "DDRC rank commands", - "Unit": "hisi_sccl,ddrc", + "Unit": "hisi_sccl,ddrc" }, { "EventCode": "0x07", "EventName": "uncore_hisi_ddrc.rw_chg", "BriefDescription": "DDRC read and write changes", "PublicDescription": "DDRC read and write changes", - "Unit": "hisi_sccl,ddrc", - }, + "Unit": "hisi_sccl,ddrc" + } ]
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json +11 -11
@@ -4,69 +4,69 @@ "EventName": "uncore_hisi_hha.rx_ops_num", "BriefDescription": "The number of all operations received by the HHA", "PublicDescription": "The number of all operations received by the HHA", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x01", "EventName": "uncore_hisi_hha.rx_outer", "BriefDescription": "The number of all operations received by the HHA from another socket", "PublicDescription": "The number of all operations received by the HHA from another socket", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x02", "EventName": "uncore_hisi_hha.rx_sccl", "BriefDescription": "The number of all operations received by the HHA from another SCCL in this socket", "PublicDescription": "The number of all operations received by the HHA from another SCCL in this socket", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x03", "EventName": "uncore_hisi_hha.rx_ccix", "BriefDescription": "Count of the number of operations that HHA has received from CCIX", "PublicDescription": "Count of the number of operations that HHA has received from CCIX", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x1c", "EventName": "uncore_hisi_hha.rd_ddr_64b", "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 64 bytes", "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 64bytes", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x1d", "EventName": "uncore_hisi_hha.wr_ddr_64b", "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes", "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x1e", "EventName": "uncore_hisi_hha.rd_ddr_128b", "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes", "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x1f", "EventName": "uncore_hisi_hha.wr_ddr_128b", "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes", "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x20", "EventName": "uncore_hisi_hha.spill_num", "BriefDescription": "Count of the number of spill operations that the HHA has sent", "PublicDescription": "Count of the number of spill operations that the HHA has sent", - "Unit": "hisi_sccl,hha", + "Unit": "hisi_sccl,hha" }, { "EventCode": "0x21", "EventName": "uncore_hisi_hha.spill_success", "BriefDescription": "Count of the number of successful spill operations that the HHA has sent", "PublicDescription": "Count of the number of successful spill operations that the HHA has sent", - "Unit": "hisi_sccl,hha", - }, + "Unit": "hisi_sccl,hha" + } ]
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json +14 -14
@@ -4,90 +4,90 @@ "EventName": "uncore_hisi_l3c.rd_cpipe", "BriefDescription": "Total read accesses", "PublicDescription": "Total read accesses", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x01", "EventName": "uncore_hisi_l3c.wr_cpipe", "BriefDescription": "Total write accesses", "PublicDescription": "Total write accesses", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x02", "EventName": "uncore_hisi_l3c.rd_hit_cpipe", "BriefDescription": "Total read hits", "PublicDescription": "Total read hits", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x03", "EventName": "uncore_hisi_l3c.wr_hit_cpipe", "BriefDescription": "Total write hits", "PublicDescription": "Total write hits", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x04", "EventName": "uncore_hisi_l3c.victim_num", "BriefDescription": "l3c precharge commands", "PublicDescription": "l3c precharge commands", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x20", "EventName": "uncore_hisi_l3c.rd_spipe", "BriefDescription": "Count of the number of read lines that come from this cluster of CPU core in spipe", "PublicDescription": "Count of the number of read lines that come from this cluster of CPU core in spipe", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x21", "EventName": "uncore_hisi_l3c.wr_spipe", "BriefDescription": "Count of the number of write lines that come from this cluster of CPU core in spipe", "PublicDescription": "Count of the number of write lines that come from this cluster of CPU core in spipe", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x22", "EventName": "uncore_hisi_l3c.rd_hit_spipe", "BriefDescription": "Count of the number of read lines that hits in spipe of this L3C", "PublicDescription": "Count of the number of read lines that hits in spipe of this L3C", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x23", "EventName": "uncore_hisi_l3c.wr_hit_spipe", "BriefDescription": "Count of the number of write lines that hits in spipe of this L3C", "PublicDescription": "Count of the number of write lines that hits in spipe of this L3C", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x29", "EventName": "uncore_hisi_l3c.back_invalid", "BriefDescription": "Count of the number of L3C back invalid operations", "PublicDescription": "Count of the number of L3C back invalid operations", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x40", "EventName": "uncore_hisi_l3c.retry_cpu", "BriefDescription": "Count of the number of retry that L3C suppresses the CPU operations", "PublicDescription": "Count of the number of retry that L3C suppresses the CPU operations", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x41", "EventName": "uncore_hisi_l3c.retry_ring", "BriefDescription": "Count of the number of retry that L3C suppresses the ring operations", "PublicDescription": "Count of the number of retry that L3C suppresses the ring operations", - "Unit": "hisi_sccl,l3c", + "Unit": "hisi_sccl,l3c" }, { "EventCode": "0x42", "EventName": "uncore_hisi_l3c.prefetch_drop", "BriefDescription": "Count of the number of prefetch drops from this L3C", "PublicDescription": "Count of the number of prefetch drops from this L3C", - "Unit": "hisi_sccl,l3c", - }, + "Unit": "hisi_sccl,l3c" + } ]
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 2/25 perf vendor events power8: Fix commas so PMU event files are valid JSON
In reply to Arnaldo Carvalho de MeloFrom: James Clark <[email protected]>
No functional change.
Remove extra commas in the power8 JSON files so that the files can be parsed and validated by other utilities such as Python that fail to parse invalid JSON.
Committer testing:
Before:
$ diffstat -l -p1 /wb/1.patch | while read filename ; do echo $filename ; cat $filename | json_verify ; done
tools/perf/pmu-events/arch/powerpc/power8/cache.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x4c0
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/floating-point.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x200
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/frontend.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x250
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/marked.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x351
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/memory.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x100
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/other.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x1f0
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/pipeline.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x100
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/pmc.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x200
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power8/translation.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x4c0
(right here) ------^
JSON is invalid
$After:
$ diffstat -l -p1 /wb/1.patch | while read filename ; do echo $filename ; cat $filename | json_verify ; done tools/perf/pmu-events/arch/powerpc/power8/cache.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/floating-point.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/frontend.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/marked.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/memory.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/other.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/pipeline.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/pmc.json JSON is valid tools/perf/pmu-events/arch/powerpc/power8/translation.json JSON is valid $
--- .../pmu-events/arch/powerpc/power8/cache.json | 60 +- .../arch/powerpc/power8/floating-point.json | 6 +- .../arch/powerpc/power8/frontend.json | 158 +-- .../arch/powerpc/power8/marked.json | 266 ++-- .../arch/powerpc/power8/memory.json | 72 +- .../pmu-events/arch/powerpc/power8/other.json | 1150 ++++++++--------- .../arch/powerpc/power8/pipeline.json | 118 +- .../pmu-events/arch/powerpc/power8/pmc.json | 48 +- .../arch/powerpc/power8/translation.json | 60 +- 9 files changed, 969 insertions(+), 969 deletions(-)
tools/perf/pmu-events/arch/powerpc/power8/cache.json +30 -30
@@ -1,176 +1,176 @@ [ - {, + { "EventCode": "0x4c048", "EventName": "PM_DATA_FROM_DL2L3_MOD", "BriefDescription": "The processor's data cache was reloaded with Modified (M) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded with Modified (M) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c048", "EventName": "PM_DATA_FROM_DL2L3_SHR", "BriefDescription": "The processor's data cache was reloaded with Shared (S) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded with Shared (S) data from another chip's L2 or L3 on a different Node or Group (Distant), as this chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c04c", "EventName": "PM_DATA_FROM_DL4", "BriefDescription": "The processor's data cache was reloaded from another chip's L4 on a different Node or Group (Distant) due to a demand load", "PublicDescription": "The processor's data cache was reloaded from another chip's L4 on a different Node or Group (Distant) due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c042", "EventName": "PM_DATA_FROM_L2", "BriefDescription": "The processor's data cache was reloaded from local core's L2 due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x200fe", "EventName": "PM_DATA_FROM_L2MISS", "BriefDescription": "Demand LD - L2 Miss (not L2 hit)", "PublicDescription": "" }, - {, + { "EventCode": "0x1c04e", "EventName": "PM_DATA_FROM_L2MISS_MOD", "BriefDescription": "The processor's data cache was reloaded from a localtion other than the local core's L2 due to a demand load", "PublicDescription": "The processor's data cache was reloaded from a localtion other than the local core's L2 due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c040", "EventName": "PM_DATA_FROM_L2_DISP_CONFLICT_LDHITST", "BriefDescription": "The processor's data cache was reloaded from local core's L2 with load hit store conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 with load hit store conflict due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x4c040", "EventName": "PM_DATA_FROM_L2_DISP_CONFLICT_OTHER", "BriefDescription": "The processor's data cache was reloaded from local core's L2 with dispatch conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 with dispatch conflict due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x2c040", "EventName": "PM_DATA_FROM_L2_MEPF", "BriefDescription": "The processor's data cache was reloaded from local core's L2 hit without dispatch conflicts on Mepf state due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 hit without dispatch conflicts on Mepf state due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c040", "EventName": "PM_DATA_FROM_L2_NO_CONFLICT", "BriefDescription": "The processor's data cache was reloaded from local core's L2 without conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L2 without conflict due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x4c042", "EventName": "PM_DATA_FROM_L3", "BriefDescription": "The processor's data cache was reloaded from local core's L3 due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L3 due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x300fe", "EventName": "PM_DATA_FROM_L3MISS", "BriefDescription": "Demand LD - L3 Miss (not L2 hit and not L3 hit)", "PublicDescription": "" }, - {, + { "EventCode": "0x4c04e", "EventName": "PM_DATA_FROM_L3MISS_MOD", "BriefDescription": "The processor's data cache was reloaded from a localtion other than the local core's L3 due to a demand load", "PublicDescription": "The processor's data cache was reloaded from a localtion other than the local core's L3 due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3c042", "EventName": "PM_DATA_FROM_L3_DISP_CONFLICT", "BriefDescription": "The processor's data cache was reloaded from local core's L3 with dispatch conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L3 with dispatch conflict due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x2c042", "EventName": "PM_DATA_FROM_L3_MEPF", "BriefDescription": "The processor's data cache was reloaded from local core's L3 without dispatch conflicts hit on Mepf state due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L3 without dispatch conflicts hit on Mepf state due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c044", "EventName": "PM_DATA_FROM_L3_NO_CONFLICT", "BriefDescription": "The processor's data cache was reloaded from local core's L3 without conflict due to a demand load", "PublicDescription": "The processor's data cache was reloaded from local core's L3 without conflict due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c04c", "EventName": "PM_DATA_FROM_LL4", "BriefDescription": "The processor's data cache was reloaded from the local chip's L4 cache due to a demand load", "PublicDescription": "The processor's data cache was reloaded from the local chip's L4 cache due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x4c04a", "EventName": "PM_DATA_FROM_OFF_CHIP_CACHE", "BriefDescription": "The processor's data cache was reloaded either shared or modified data from another core's L2/L3 on a different chip (remote or distant) due to a demand load", "PublicDescription": "The processor's data cache was reloaded either shared or modified data from another core's L2/L3 on a different chip (remote or distant) due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c048", "EventName": "PM_DATA_FROM_ON_CHIP_CACHE", "BriefDescription": "The processor's data cache was reloaded either shared or modified data from another core's L2/L3 on the same chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded either shared or modified data from another core's L2/L3 on the same chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x2c046", "EventName": "PM_DATA_FROM_RL2L3_MOD", "BriefDescription": "The processor's data cache was reloaded with Modified (M) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded with Modified (M) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x1c04a", "EventName": "PM_DATA_FROM_RL2L3_SHR", "BriefDescription": "The processor's data cache was reloaded with Shared (S) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to a demand load", "PublicDescription": "The processor's data cache was reloaded with Shared (S) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to either only demand loads or demand loads plus prefetches if MMCR1[16] is 1" }, - {, + { "EventCode": "0x3001a", "EventName": "PM_DATA_TABLEWALK_CYC", "BriefDescription": "Tablwalk Cycles (could be 1 or 2 active)", "PublicDescription": "Data Tablewalk Active" }, - {, + { "EventCode": "0x4e04e", "EventName": "PM_DPTEG_FROM_L3MISS", "BriefDescription": "A Page Table Entry was loaded into the TLB from a localtion other than the local core's L3 due to a data side request", "PublicDescription": "" }, - {, + { "EventCode": "0xd094", "EventName": "PM_DSLB_MISS", "BriefDescription": "Data SLB Miss - Total of all segment sizes", "PublicDescription": "Data SLB Miss - Total of all segment sizesData SLB misses" }, - {, + { "EventCode": "0x1002c", "EventName": "PM_L1_DCACHE_RELOADED_ALL", "BriefDescription": "L1 data cache reloaded for demand or prefetch", "PublicDescription": "" }, - {, + { "EventCode": "0x300f6", "EventName": "PM_L1_DCACHE_RELOAD_VALID", "BriefDescription": "DL1 reloaded due to Demand Load", "PublicDescription": "" }, - {, + { "EventCode": "0x3e054", "EventName": "PM_LD_MISS_L1", "BriefDescription": "Load Missed L1", "PublicDescription": "" }, - {, + { "EventCode": "0x100ee", "EventName": "PM_LD_REF_L1", "BriefDescription": "All L1 D cache load references counted at finish, gated by reject", "PublicDescription": "Load Ref count combined for all units" }, - {, + { "EventCode": "0x300f0", "EventName": "PM_ST_MISS_L1", "BriefDescription": "Store Missed L1", "PublicDescription": "" - }, + } ]
tools/perf/pmu-events/arch/powerpc/power8/floating-point.json +3 -3
@@ -1,14 +1,14 @@ [ - {, + { "EventCode": "0x2000e", "EventName": "PM_FXU_BUSY", "BriefDescription": "fxu0 busy and fxu1 busy", "PublicDescription": "" }, - {, + { "EventCode": "0x1000e", "EventName": "PM_FXU_IDLE", "BriefDescription": "fxu0 idle and fxu1 idle", "PublicDescription": "" - }, + } ]
tools/perf/pmu-events/arch/powerpc/power8/frontend.json +79 -79
549 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power8/marked.json +133 -133
927 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power8/memory.json +36 -36
248 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power8/other.json +575 -575
1,053 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power8/pipeline.json +59 -59
118 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power8/pmc.json +24 -24
48 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power8/translation.json +30 -30
60 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0
Part of the diff is not shown here. View the raw message.
Arnaldo Carvalho de Melo
maintainerPATCH 3/25 perf vendor events power9: Fix commas so PMU event files are valid JSON
In reply to Arnaldo Carvalho de MeloFrom: James Clark <[email protected]>
No functional change.
Remove extra commas in the power9 JSON files so that the files can be parsed and validated by other utilities such as Python that fail to parse invalid JSON.
Before:
$ diffstat -l -p1 /wb/1.patch | while read filename ; do echo $filename ; cat $filename | json_verify ; done
tools/perf/pmu-events/arch/powerpc/power9/cache.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x300
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/floating-point.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x141
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/frontend.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x250
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/marked.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x301
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/memory.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x300
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/other.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x308
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/pipeline.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x4D0
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/pmc.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x200
(right here) ------^
JSON is invalid
tools/perf/pmu-events/arch/powerpc/power9/translation.json
parse error: invalid object key (must be a string)
[ {, "EventCode": "0x1E"
(right here) ------^
JSON is invalid
$After:
$ diffstat -l -p1 /wb/1.patch | while read filename ; do echo $filename ; cat $filename | json_verify ; done tools/perf/pmu-events/arch/powerpc/power9/cache.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/floating-point.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/frontend.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/marked.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/memory.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/other.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/pipeline.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/pmc.json JSON is valid tools/perf/pmu-events/arch/powerpc/power9/translation.json JSON is valid $
--- .../pmu-events/arch/powerpc/power9/cache.json | 44 +- .../arch/powerpc/power9/floating-point.json | 14 +- .../arch/powerpc/power9/frontend.json | 142 +-- .../arch/powerpc/power9/marked.json | 250 ++--- .../arch/powerpc/power9/memory.json | 52 +- .../pmu-events/arch/powerpc/power9/other.json | 934 +++++++++--------- .../arch/powerpc/power9/pipeline.json | 212 ++-- .../pmu-events/arch/powerpc/power9/pmc.json | 48 +- .../arch/powerpc/power9/translation.json | 92 +- 9 files changed, 894 insertions(+), 894 deletions(-)
tools/perf/pmu-events/arch/powerpc/power9/cache.json +22 -22
@@ -1,107 +1,107 @@ [ - {, + { "EventCode": "0x300F4", "EventName": "PM_THRD_CONC_RUN_INST", "BriefDescription": "PPC Instructions Finished by this thread when all threads in the core had the run-latch set" }, - {, + { "EventCode": "0x1E056", "EventName": "PM_CMPLU_STALL_FLUSH_ANY_THREAD", "BriefDescription": "Cycles in which the NTC instruction is not allowed to complete because any of the 4 threads in the same core suffered a flush, which blocks completion" }, - {, + { "EventCode": "0x4D016", "EventName": "PM_CMPLU_STALL_FXLONG", "BriefDescription": "Completion stall due to a long latency scalar fixed point instruction (division, square root)" }, - {, + { "EventCode": "0x2D016", "EventName": "PM_CMPLU_STALL_FXU", "BriefDescription": "Finish stall due to a scalar fixed point or CR instruction in the execution pipeline. These instructions get routed to the ALU, ALU2, and DIV pipes" }, - {, + { "EventCode": "0x4D12A", "EventName": "PM_MRK_DATA_FROM_RL4_CYC", "BriefDescription": "Duration in cycles to reload from another chip's L4 on the same Node or Group ( Remote) due to a marked load" }, - {, + { "EventCode": "0x1003C", "EventName": "PM_CMPLU_STALL_DMISS_L2L3", "BriefDescription": "Completion stall by Dcache miss which resolved in L2/L3" }, - {, + { "EventCode": "0x4C014", "EventName": "PM_CMPLU_STALL_LMQ_FULL", "BriefDescription": "Finish stall because the NTF instruction was a load that missed in the L1 and the LMQ was unable to accept this load miss request because it was full" }, - {, + { "EventCode": "0x14048", "EventName": "PM_INST_FROM_ON_CHIP_CACHE", "BriefDescription": "The processor's Instruction cache was reloaded either shared or modified data from another core's L2/L3 on the same chip due to an instruction fetch (not prefetch)" }, - {, + { "EventCode": "0x4D014", "EventName": "PM_CMPLU_STALL_LOAD_FINISH", "BriefDescription": "Finish stall because the NTF instruction was a load instruction with all its dependencies satisfied just going through the LSU pipe to finish" }, - {, + { "EventCode": "0x2404A", "EventName": "PM_INST_FROM_RL4", "BriefDescription": "The processor's Instruction cache was reloaded from another chip's L4 on the same Node or Group ( Remote) due to an instruction fetch (not prefetch)" }, - {, + { "EventCode": "0x1404A", "EventName": "PM_INST_FROM_RL2L3_SHR", "BriefDescription": "The processor's Instruction cache was reloaded with Shared (S) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to an instruction fetch (not prefetch)" }, - {, + { "EventCode": "0x401EA", "EventName": "PM_THRESH_EXC_128", "BriefDescription": "Threshold counter exceeded a value of 128" }, - {, + { "EventCode": "0x400F6", "EventName": "PM_BR_MPRED_CMPL", "BriefDescription": "Number of Branch Mispredicts" }, - {, + { "EventCode": "0x2F140", "EventName": "PM_MRK_DPTEG_FROM_L2_MEPF", "BriefDescription": "A Page Table Entry was loaded into the TLB from local core's L2 hit without dispatch conflicts on Mepf state. due to a marked data side request. When using Radix Page Translation, this count excludes PDE reloads. Only PTE reloads are included" }, - {, + { "EventCode": "0x101E6", "EventName": "PM_THRESH_EXC_4096", "BriefDescription": "Threshold counter exceed a count of 4096" }, - {, + { "EventCode": "0x3F14A", "EventName": "PM_MRK_DPTEG_FROM_RMEM", "BriefDescription": "A Page Table Entry was loaded into the TLB from another chip's memory on the same Node or Group ( Remote) due to a marked data side request. When using Radix Page Translation, this count excludes PDE reloads. Only PTE reloads are included" }, - {, + { "EventCode": "0x4C016", "EventName": "PM_CMPLU_STALL_DMISS_L2L3_CONFLICT", "BriefDescription": "Completion stall due to cache miss that resolves in the L2 or L3 with a conflict" }, - {, + { "EventCode": "0x2C01A", "EventName": "PM_CMPLU_STALL_LHS", "BriefDescription": "Finish stall because the NTF instruction was a load that hit on an older store and it was waiting for store data" }, - {, + { "EventCode": "0x401E4", "EventName": "PM_MRK_DTLB_MISS", "BriefDescription": "Marked dtlb miss" }, - {, + { "EventCode": "0x24046", "EventName": "PM_INST_FROM_RL2L3_MOD", "BriefDescription": "The processor's Instruction cache was reloaded with Modified (M) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to an instruction fetch (not prefetch)" }, - {, + { "EventCode": "0x1002A", "EventName": "PM_CMPLU_STALL_LARX", "BriefDescription": "Finish stall because the NTF instruction was a larx waiting to be satisfied" } -] +]
tools/perf/pmu-events/arch/powerpc/power9/floating-point.json +7 -7
@@ -1,32 +1,32 @@ [ - {, + { "EventCode": "0x1415A", "EventName": "PM_MRK_DATA_FROM_L2_DISP_CONFLICT_LDHITST_CYC", "BriefDescription": "Duration in cycles to reload from local core's L2 with load hit store conflict due to a marked load" }, - {, + { "EventCode": "0x10058", "EventName": "PM_MEM_LOC_THRESH_IFU", "BriefDescription": "Local Memory above threshold for IFU speculation control" }, - {, + { "EventCode": "0x2D028", "EventName": "PM_RADIX_PWC_L2_PDE_FROM_L2", "BriefDescription": "A Page Directory Entry was reloaded to a level 2 page walk cache from the core's L2 data cache" }, - {, + { "EventCode": "0x30012", "EventName": "PM_FLUSH_COMPLETION", "BriefDescription": "The instruction that was next to complete did not complete because it suffered a flush" }, - {, + { "EventCode": "0x2D154", "EventName": "PM_MRK_DERAT_MISS_64K", "BriefDescription": "Marked Data ERAT Miss (Data TLB Access) page size 64K" }, - {, + { "EventCode": "0x4016E", "EventName": "PM_THRESH_NOT_MET", "BriefDescription": "Threshold counter did not meet threshold" } -] +]
tools/perf/pmu-events/arch/powerpc/power9/frontend.json +71 -71
426 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power9/marked.json +125 -125
750 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power9/memory.json +26 -26
154 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power9/other.json +467 -467
1,500 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power9/pipeline.json +106 -106
212 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power9/pmc.json +24 -24
48 lines not on this page · raw message
tools/perf/pmu-events/arch/powerpc/power9/translation.json +46 -46
92 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0
Part of the diff is not shown here. View the raw message.
Arnaldo Carvalho de Melo
maintainerPATCH 4/25 perf scripts python: exported-sql-viewer.py: Fix use of TRUE with SQLite
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Prior to version 3.23 SQLite does not support TRUE or FALSE, so always use 1 and 0 for SQLite.
--- tools/perf/scripts/python/exported-sql-viewer.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
tools/perf/scripts/python/exported-sql-viewer.py +9 -3
@@ -637,7 +637,7 @@ class CallGraphRootItem(CallGraphLevelItemBase): self.query_done = True if_has_calls = "" if IsSelectable(glb.db, "comms", columns = "has_calls"): - if_has_calls = " WHERE has_calls = TRUE" + if_has_calls = " WHERE has_calls = " + glb.dbref.TRUE query = QSqlQuery(glb.db) QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls) while query.next():
@@ -918,7 +918,7 @@ class CallTreeRootItem(CallGraphLevelItemBase): self.query_done = True if_has_calls = "" if IsSelectable(glb.db, "comms", columns = "has_calls"): - if_has_calls = " WHERE has_calls = TRUE" + if_has_calls = " WHERE has_calls = " + glb.dbref.TRUE query = QSqlQuery(glb.db) QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls) while query.next():
@@ -1290,7 +1290,7 @@ class SwitchGraphData(GraphData): QueryExec(query, "SELECT id, c_time" " FROM comms" " WHERE c_thread_id = " + str(thread_id) + - " AND exec_flag = TRUE" + " AND exec_flag = " + self.collection.glb.dbref.TRUE + " AND c_time >= " + str(start_time) + " AND c_time <= " + str(end_time) + " ORDER BY c_time, id")
@@ -5016,6 +5016,12 @@ class DBRef(): def __init__(self, is_sqlite3, dbname): self.is_sqlite3 = is_sqlite3 self.dbname = dbname + self.TRUE = "TRUE" + self.FALSE = "FALSE" + # SQLite prior to version 3.23 does not support TRUE and FALSE + if self.is_sqlite3: + self.TRUE = "1" + self.FALSE = "0" def Open(self, connection_name): dbname = self.dbname
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 5/25 perf maps: Purge the entries from maps->names in __maps__purge()
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
No need to iterate via the ->names rbtree, as all the entries there as in maps->entries as well, reuse __maps__purge() for that.
Doing it this way we can kill maps__for_each_entry_by_name(), maps__for_each_entry_by_name_safe(), maps__{first,next}_by_name().
--- tools/perf/util/map.c | 34 +--------------------------------- tools/perf/util/map_groups.h | 8 -------- 2 files changed, 1 insertion(+), 41 deletions(-)
tools/perf/util/map.c +1 -33
@@ -589,15 +589,7 @@ static void __maps__purge(struct maps *maps)maps__for_each_entry_safe (maps, pos, next) {rb_erase_init (&pos->rb_node, &maps->entries);map__put (pos); - } -} - -static void __maps__purge_names (struct maps *maps) -{ -struct map *pos, *next; - -maps__for_each_entry_by_name_safe (maps, pos, next) { -rb_erase_init (&pos->rb_node_name, &maps->names); +rb_erase_init (&pos->rb_node_name, &maps->names);map__put (pos); } }
@@ -606,7 +598,6 @@ static void maps__exit(struct maps *maps) {down_write (&maps->lock);__maps__purge (maps); -__maps__purge_names (maps);up_write (&maps->lock); }
@@ -994,29 +985,6 @@ struct map *map__next(struct map *map)return map ?__map__next (map) :NULL ; } -struct map *maps__first_by_name (struct maps *maps) -{ -struct rb_node *first =rb_first (&maps->names); - -if (first) - return rb_entry(first, struct map, rb_node_name); -return NULL ; -} - -static struct map *__map__next_by_name (struct map *map) -{ -struct rb_node *next =rb_next (&map->rb_node_name); - -if (next) - return rb_entry(next, struct map, rb_node_name); -return NULL ; -} - -struct map *map__next_by_name (struct map *map) -{ -return map ?__map__next_by_name (map) :NULL ; -} -struct kmap *__map__kmap (struct map *map) {if (!map->dso || !map->dso->kernel)
tools/perf/util/map_groups.h +0 -8
@@ -33,14 +33,6 @@ struct map *map__next(struct map *map);for (map =maps__first (maps), next =map__next (map); map; map = next, next =map__next (map)) struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, struct map **mapp); -struct map *maps__first_by_name (struct maps *maps); -struct map *map__next_by_name (struct map *map); - -#define maps__for_each_entry_by_name (maps, map) \ - for (map = maps__first_by_name(maps); map; map = map__next_by_name(map)) - -#define maps__for_each_entry_by_name_safe (maps, map, next) \ - for (map = maps__first_by_name(maps), next = map__next_by_name(map); map; map = next, next = map__next_by_name(map))struct map_groups {struct maps maps;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 6/25 perf maps: Do not use an rbtree to sort by map name
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
This is only used for the kernel maps, shave 24 bytes out 'struct map' and just traverse the existing per ip rbtree to look for maps by name, use a front end cache to reuse the last search if its the same name.
After this 'struct map' is down to just two cachelines:
$ pahole -C map ~/bin/perf
struct map {
union {
struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */
struct list_head node; /* 0 16 */
} __attribute__((__aligned__(8))); /* 0 24 */
u64 start; /* 24 8 */
u64 end; /* 32 8 */
_Bool erange_warned; /* 40 1 *//* XXX 3 bytes hole, try to pack */
u32 priv; /* 44 4 */ u32 prot; /* 48 4 */ u32 flags; /* 52 4 */ u64 pgoff; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u64 reloc; /* 64 8 */ u32 maj; /* 72 4 */ u32 min; /* 76 4 */ u64 ino; /* 80 8 */ u64 ino_generation; /* 88 8 */ u64 (*map_ip)(struct map *, u64); /* 96 8 */ u64 (*unmap_ip)(struct map *, u64); /* 104 8 */ struct dso * dso; /* 112 8 */ refcount_t refcnt; /* 120 4 */
/* size: 128, cachelines: 2, members: 17 */ /* sum members: 121, holes: 1, sum holes: 3 */ /* padding: 4 */ /* forced alignments: 1 */ } __attribute__((__aligned__(8))); $
--- tools/perf/tests/map_groups.c | 2 +- tools/perf/util/map.c | 30 ------------------------------ tools/perf/util/map.h | 1 - tools/perf/util/map_groups.h | 1 - tools/perf/util/symbol.c | 16 ++-------------- 5 files changed, 3 insertions(+), 47 deletions(-)
tools/perf/tests/map_groups.c +1 -1
@@ -25,7 +25,7 @@ static int check_maps(struct map_def *merged, unsigned int size, struct map_grouTEST_ASSERT_VAL ("wrong map start" , map->start == merged[i].start);TEST_ASSERT_VAL ("wrong map end" , map->end == merged[i].end);TEST_ASSERT_VAL ("wrong map name" , !strcmp (map->dso->name, merged[i].name)); -TEST_ASSERT_VAL ("wrong map refcnt" ,refcount_read (&map->refcnt) ==2 ); +TEST_ASSERT_VAL ("wrong map refcnt" ,refcount_read (&map->refcnt) ==1 ); i++; }
tools/perf/util/map.c +0 -30
@@ -26,7 +26,6 @@#include "ui/ui.h" static void __maps__insert (struct maps *maps,struct map *map); -static void __maps__insert_name (struct maps *maps,struct map *map);static inline int is_anon_memory (const char *filename,u32 flags) {
@@ -566,7 +565,6 @@ u64 map__objdump_2mem(struct map *map, u64 ip)static void maps__init (struct maps *maps) { maps->entries =RB_ROOT ; - maps->names =RB_ROOT ;init_rwsem (&maps->lock); }
@@ -589,8 +587,6 @@ static void __maps__purge(struct maps *maps)maps__for_each_entry_safe (maps, pos, next) {rb_erase_init (&pos->rb_node, &maps->entries);map__put (pos); -rb_erase_init (&pos->rb_node_name, &maps->names); -map__put (pos); } }
@@ -736,7 +732,6 @@ size_t map_groups__fprintf(struct map_groups *mg, FILE *fp)static void __map_groups__insert (struct map_groups *mg,struct map *map) {__maps__insert (&mg->maps, map); -__maps__insert_name (&mg->maps, map); }int map_groups__fixup_overlappings (struct map_groups *mg,struct map *map,FILE *fp)
@@ -893,32 +888,10 @@ static void __maps__insert(struct maps *maps, struct map *map)map__get (map); } -static void __maps__insert_name (struct maps *maps,struct map *map) -{ -struct rb_node **p = &maps->names.rb_node; -struct rb_node *parent =NULL ; -struct map *m; -int rc; - -while (*p !=NULL ) { - parent = *p; - m = rb_entry(parent, struct map, rb_node_name); - rc =strcmp (m->dso->short_name, map->dso->short_name); -if (rc <0 ) - p = &(*p)->rb_left; -else - p = &(*p)->rb_right; - } -rb_link_node (&map->rb_node_name, parent, p); -rb_insert_color (&map->rb_node_name, &maps->names); -map__get (map); -} -void maps__insert (struct maps *maps,struct map *map) {down_write (&maps->lock);__maps__insert (maps, map); -__maps__insert_name (maps, map);up_write (&maps->lock); }
@@ -926,9 +899,6 @@ static void __maps__remove(struct maps *maps, struct map *map) {rb_erase_init (&map->rb_node, &maps->entries);map__put (map); - -rb_erase_init (&map->rb_node_name, &maps->names); -map__put (map); }void maps__remove (struct maps *maps,struct map *map)
tools/perf/util/map.h +0 -1
@@ -23,7 +23,6 @@ struct map {struct rb_node rb_node;struct list_head node; }; -struct rb_node rb_node_name;u64 start;u64 end;bool erange_warned;
tools/perf/util/map_groups.h +0 -1
@@ -16,7 +16,6 @@ struct thread;struct maps {struct rb_root entries; -struct rb_root names;struct rw_semaphore lock; };
tools/perf/util/symbol.c +2 -14
@@ -1764,24 +1764,12 @@ struct map *map_groups__find_by_name(struct map_groups *mg, const char *name) {struct maps *maps = &mg->maps;struct map *map; -struct rb_node *node;down_read (&maps->lock); -for (node = maps->names.rb_node; node; ) { -int rc; - - map = rb_entry(node, struct map, rb_node_name); - - rc =strcmp (map->dso->short_name, name); -if (rc <0 ) - node = node->rb_left; -else if (rc >0 ) - node = node->rb_right; -else - +maps__for_each_entry (maps, map) +if (strcmp (map->dso->short_name, name) ==0 ) goto out_unlock; - } map =NULL ;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 7/25 perf map_groups: Add a front end cache for map lookups by name
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Lets see if it helps:
First look at the probeable lines for the function that does lookups by name in a map_groups struct:
# perf probe -x ~/bin/perf -L map_groups__find_by_name
<map_groups__find_by_name@/home/acme/git/perf/tools/perf/util/symbol.c:0>
0 struct map *map_groups__find_by_name(struct map_groups *mg, const char *name)
1 {
2 struct maps *maps = &mg->maps;
struct map *map; 5 down_read(&maps->lock);
7 if (mg->last_search_by_name && strcmp(mg->last_search_by_name->dso->short_name, name) == 0) {
8 map = mg->last_search_by_name;
9 goto out_unlock;
}
12 maps__for_each_entry(maps, map)
13 if (strcmp(map->dso->short_name, name) == 0) {
14 mg->last_search_by_name = map;
15 goto out_unlock;
}
18 map = NULL;
out_unlock:
21 up_read(&maps->lock);
22 return map;
23 }
int dso__load_vmlinux(struct dso *dso, struct map *map,
const char *vmlinux, bool vmlinux_allocated)#
Now add a probe to the place where we reuse the last search:
# perf probe -x ~/bin/perf map_groups__find_by_name:8
Added new event:
probe_perf:map_groups__find_by_name (on map_groups__find_by_name:8 in /home/acme/bin/perf)You can now use it in all perf tools, such as:
perf record -e probe_perf:map_groups__find_by_name -aR sleep 1
#
Now lets do a system wide 'perf stat' counting those events:
# perf stat -e probe_perf:*
Leave it running and lets do a 'perf top', then, after a while, stop the 'perf stat':
# perf stat -e probe_perf:* ^C Performance counter stats for 'system wide':
3,603 probe_perf:map_groups__find_by_name
44.565253139 seconds time elapsed#
yeah, good to have.
--- tools/perf/util/map.c | 9 +++++++++ tools/perf/util/map_groups.h | 6 ++---- tools/perf/util/symbol.c | 9 ++++++++- 3 files changed, 19 insertions(+), 5 deletions(-)
tools/perf/util/map.c +9 -0
@@ -572,6 +572,7 @@ void map_groups__init(struct map_groups *mg, struct machine *machine) {maps__init (&mg->maps); mg->machine = machine; + mg->last_search_by_name =NULL ;refcount_set (&mg->refcnt,1 ); }
@@ -580,6 +581,14 @@ void map_groups__insert(struct map_groups *mg, struct map *map)maps__insert (&mg->maps, map); } +void map_groups__remove (struct map_groups *mg,struct map *map) +{ +if (mg->last_search_by_name == map) + mg->last_search_by_name =NULL ; + +maps__remove (&mg->maps, map); +} +static void __maps__purge (struct maps *maps) {struct map *pos, *next;
tools/perf/util/map_groups.h +2 -4
@@ -36,6 +36,7 @@ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, ststruct map_groups {struct maps maps;struct machine *machine; +struct map *last_search_by_name;refcount_t refcnt;#ifdef HAVE_LIBUNWIND_SUPPORT void *addr_space;
@@ -70,10 +71,7 @@ size_t map_groups__fprintf(struct map_groups *mg, FILE *fp);void map_groups__insert (struct map_groups *mg,struct map *map); -static inline void map_groups__remove (struct map_groups *mg,struct map *map) -{ -maps__remove (&mg->maps, map); -} +void map_groups__remove (struct map_groups *mg,struct map *map);static inline struct map *map_groups__find (struct map_groups *mg,u64 addr) {
tools/perf/util/symbol.c +8 -1
@@ -1767,9 +1767,16 @@ struct map *map_groups__find_by_name(struct map_groups *mg, const char *name)down_read (&maps->lock); +if (mg->last_search_by_name &&strcmp (mg->last_search_by_name->dso->short_name, name) ==0 ) { + map = mg->last_search_by_name; + goto out_unlock; + } +maps__for_each_entry (maps, map) -if (strcmp (map->dso->short_name, name) ==0 ) +if (strcmp (map->dso->short_name, name) ==0 ) { + mg->last_search_by_name = map; goto out_unlock; + } map =NULL ;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 8/25 perf map: No need to adjust the long name of modules
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
At some point in the past we needed to make sure we would get the long name of modules and not just what we get from /proc/modules, but that need, as described in the cset that introduced the adjustment function:
Without using the buildid-cache:
# lsmod | grep trusted
# insmod trusted.ko
# lsmod | grep trusted
trusted 24576 0
# strace -e open,openat perf probe -m ./trusted.ko key_seal |& grep trusted
openat(AT_FDCWD, "/sys/module/trusted/notes/.note.gnu.build-id", O_RDONLY) = 4
openat(AT_FDCWD, "/sys/module/trusted/notes/.note.gnu.build-id", O_RDONLY) = 7
openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3
openat(AT_FDCWD, "/root/.debug/root/trusted.ko/dd3d355d567394d540f527e093e0f64b95879584/probes", O_RDWR|O_CREAT, 0644) = 3
openat(AT_FDCWD, "/usr/lib/debug/root/trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/debug/root/trusted.ko", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/.debug/trusted.ko", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3
openat(AT_FDCWD, "trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, ".debug/trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3
openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3
openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 4
openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3
probe:key_seal (on key_seal in trusted)
# perf probe -l
probe:key_seal (on key_seal in trusted)
#No attempt at opening '[trusted]'.
Now using the build-id cache:
# rmmod trusted # perf buildid-cache --add ./trusted.ko # insmod trusted.ko # strace -e open,openat perf probe -m ./trusted.ko key_seal |& grep trusted openat(AT_FDCWD, "/sys/module/trusted/notes/.note.gnu.build-id", O_RDONLY) = 4 openat(AT_FDCWD, "/sys/module/trusted/notes/.note.gnu.build-id", O_RDONLY) = 7 openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3 openat(AT_FDCWD, "/root/.debug/root/trusted.ko/dd3d355d567394d540f527e093e0f64b95879584/probes", O_RDWR|O_CREAT, 0644) = 3 openat(AT_FDCWD, "/usr/lib/debug/root/trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/debug/root/trusted.ko", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/root/.debug/trusted.ko", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3 openat(AT_FDCWD, "trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, ".debug/trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "trusted.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3 openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3 openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 4 openat(AT_FDCWD, "/root/trusted.ko", O_RDONLY) = 3 #
Again, no attempt at reading '[trusted]'.
Finally, adding a probe to that function and then using:
[root@quaco ~]# perf trace -e probe_perf:*/max-stack=16/ --max-events=2
0.000 perf/13456 probe_perf:dso__adjust_kmod_long_name(__probe_ip: 5492263)
dso__adjust_kmod_long_name (/home/acme/bin/perf)
machine__process_kernel_mmap_event (/home/acme/bin/perf)
machine__process_mmap_event (/home/acme/bin/perf)
perf_event__process_mmap (/home/acme/bin/perf)
machines__deliver_event (/home/acme/bin/perf)
perf_session__deliver_event (/home/acme/bin/perf)
perf_session__process_event (/home/acme/bin/perf)
process_simple (/home/acme/bin/perf)
reader__process_events (/home/acme/bin/perf)
__perf_session__process_events (/home/acme/bin/perf)
perf_session__process_events (/home/acme/bin/perf)
process_buildids (/home/acme/bin/perf)
record__finish_output (/home/acme/bin/perf)
__cmd_record (/home/acme/bin/perf)
cmd_record (/home/acme/bin/perf)
run_builtin (/home/acme/bin/perf)
0.055 perf/13456 probe_perf:dso__adjust_kmod_long_name(__probe_ip: 5492263)
dso__adjust_kmod_long_name (/home/acme/bin/perf)
machine__process_kernel_mmap_event (/home/acme/bin/perf)
machine__process_mmap_event (/home/acme/bin/perf)
perf_event__process_mmap (/home/acme/bin/perf)
machines__deliver_event (/home/acme/bin/perf)
perf_session__deliver_event (/home/acme/bin/perf)
perf_session__process_event (/home/acme/bin/perf)
process_simple (/home/acme/bin/perf)
reader__process_events (/home/acme/bin/perf)
__perf_session__process_events (/home/acme/bin/perf)
perf_session__process_events (/home/acme/bin/perf)
process_buildids (/home/acme/bin/perf)
record__finish_output (/home/acme/bin/perf)
__cmd_record (/home/acme/bin/perf)
cmd_record (/home/acme/bin/perf)
run_builtin (/home/acme/bin/perf)#
This was the only path I could find using the perf tools that reach at this function, then as of november/2019, if we put a probe in the line where the actuall setting of the dso->long_name is done:
# perf trace -e probe_perf:*
^C[root@quaco ~]
# perf stat -e probe_perf:* -I 2000
2.000404265 0 probe_perf:dso__adjust_kmod_long_name
4.001142200 0 probe_perf:dso__adjust_kmod_long_name
6.001704120 0 probe_perf:dso__adjust_kmod_long_name
8.002398316 0 probe_perf:dso__adjust_kmod_long_name
10.002984010 0 probe_perf:dso__adjust_kmod_long_name
12.003597851 0 probe_perf:dso__adjust_kmod_long_name
14.004113303 0 probe_perf:dso__adjust_kmod_long_name
16.004582773 0 probe_perf:dso__adjust_kmod_long_name
18.005176373 0 probe_perf:dso__adjust_kmod_long_name
20.005801605 0 probe_perf:dso__adjust_kmod_long_name
22.006467540 0 probe_perf:dso__adjust_kmod_long_name
^C 23.683261941 0 probe_perf:dso__adjust_kmod_long_name#
Its not being used at all.
To further test this I used kvm.ko as the offline module, i.e. removed if from the buildid-cache by nuking it completely (rm -rf ~/.debug) and moved it from the normal kernel distro path, removed the modules, stoped the kvm guest, and then installed it manually, etc.
# rmmod kvm-intel
# rmmod kvm
# lsmod | grep kvm
# modprobe kvm-intel
modprobe: ERROR: ctx=0x55d3b1722260 path=/lib/modules/5.3.8-200.fc30.x86_64/kernel/arch/x86/kvm/kvm.ko.xz error=No such file or directory
modprobe: ERROR: ctx=0x55d3b1722260 path=/lib/modules/5.3.8-200.fc30.x86_64/kernel/arch/x86/kvm/kvm.ko.xz error=No such file or directory
modprobe: ERROR: could not insert 'kvm_intel': Unknown symbol in module, or unknown parameter (see dmesg)
# insmod ./kvm.ko
# modprobe kvm-intel
modprobe: ERROR: ctx=0x562f34026260 path=/lib/modules/5.3.8-200.fc30.x86_64/kernel/arch/x86/kvm/kvm.ko.xz error=No such file or directory
modprobe: ERROR: ctx=0x562f34026260 path=/lib/modules/5.3.8-200.fc30.x86_64/kernel/arch/x86/kvm/kvm.ko.xz error=No such file or directory
# lsmod | grep kvm
kvm_intel 299008 0
kvm 765952 1 kvm_intel
irqbypass 16384 1 kvm
#
# perf probe -x ~/bin/perf machine__findnew_module_map:12 mname=m.name:string filename=filename:string 'dso_long_name=map->dso->long_name:string' 'dso_name=map->dso->name:string'
# perf probe -l
probe_perf:machine__findnew_module_map (on machine__findnew_module_map:12@util/machine.c in /home/acme/bin/perf with mname filename dso_long_name dso_name)
# perf record
^C[ perf record: Woken up 2 times to write data ]
[ perf record: Captured and wrote 3.416 MB perf.data (33956 samples) ]
# perf trace -e probe_perf:machine*
<SNIP>
6.322 perf/23099 probe_perf:machine__findnew_module_map(__probe_ip: 5492493, mname: "[salsa20_generic]", filename: "/lib/modules/5.3.8-200.fc30.x86_64/kernel/crypto/salsa20_generic.ko.xz", dso_long_name: "/lib/modules/5.3.8-200.fc30.x86_64/kernel/crypto/salsa20_generic.ko.xz", dso_name: "[salsa20_generic]")
6.375 perf/23099 probe_perf:machine__findnew_module_map(__probe_ip: 5492493, mname: "[kvm]", filename: "[kvm]", dso_long_name: "[kvm]", dso_name: "[kvm]")
<SNIP>The filename doesn't come with the path, no point in trying to set the dso->long_name.
[root@quaco ~]# strace -e open,openat perf probe -m ./kvm.ko kvm_apic_local_deliver |& egrep 'open.*kvm' openat(AT_FDCWD, "/sys/module/kvm_intel/notes/.note.gnu.build-id", O_RDONLY) = 4
openat(AT_FDCWD, "/sys/module/kvm/notes/.note.gnu.build-id", O_RDONLY) = 4
openat(AT_FDCWD, "/lib/modules/5.3.8-200.fc30.x86_64/kernel/arch/x86/kvm", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 7 openat(AT_FDCWD, "/sys/module/kvm_intel/notes/.note.gnu.build-id", O_RDONLY) = 8
openat(AT_FDCWD, "/root/kvm.ko", O_RDONLY) = 3
openat(AT_FDCWD, "/root/.debug/root/kvm.ko/5955f426cb93f03f30f3e876814be2db80ab0b55/probes", O_RDWR|O_CREAT, 0644) = 3 openat(AT_FDCWD, "/usr/lib/debug/root/kvm.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/debug/root/kvm.ko", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/root/.debug/kvm.ko", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/root/kvm.ko", O_RDONLY) = 3
openat(AT_FDCWD, "kvm.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, ".debug/kvm.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "kvm.ko.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/kvm.ko", O_RDONLY) = 3
openat(AT_FDCWD, "/root/kvm.ko", O_RDONLY) = 3
openat(AT_FDCWD, "/root/kvm.ko", O_RDONLY) = 4
openat(AT_FDCWD, "/root/kvm.ko", O_RDONLY) = 3
[root@quaco ~]#
--- tools/perf/util/machine.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-)
tools/perf/util/machine.c +1 -26
@@ -772,24 +772,6 @@ int machine__process_ksymbol(struct machine *machine __maybe_unused,return machine__process_ksymbol_register (machine, event, sample); } -static void dso__adjust_kmod_long_name (struct dso *dso,const char *filename) -{ -const char *dup_filename; - -if (!filename || !dso || !dso->long_name) -return ; -if (dso->long_name[0 ] !='[' ) -return ; -if (!strchr (filename,'/' )) -return ; - - dup_filename =strdup (filename); -if (!dup_filename) -return ; - -dso__set_long_name (dso, dup_filename, true); -} -struct map *machine__findnew_module_map (struct machine *machine,u64 start,const char *filename) {
@@ -801,15 +783,8 @@ struct map *machine__findnew_module_map(struct machine *machine, u64 start,return NULL ; map =map_groups__find_by_name (&machine->kmaps, m.name); -if (map) { -/* -* If the map's dso is an offline module, give dso__load() -* a chance to find the file path of that module by fixing -* long_name. -*/ -dso__adjust_kmod_long_name (map->dso, filename); +if (map) goto out; - } dso =machine__findnew_module_dso (machine, &m, filename);if (dso ==NULL )
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 9/25 perf record: No need to process the synthesized MMAP events twice
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
At the end of a 'perf record' session, by default, we'll process all samples and populate the threads, maps, etc so as to find out which of the DSOs got samples, to reduce the size of the build-id table we'll add to the perf.data headers.
But we don't need to process the PERF_RECORD_MMAP events synthesized for the kernel modules, as we have those already via perf_session__create_kernel_maps(), so add mmap/mmap2 handlers that first look at event->header.misc to see if the event is for a user map, bailing out if not.
--- tools/perf/builtin-record.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +27 -2
@@ -2148,6 +2148,31 @@ static const char * const __record_usage[] = { };const char *const *record_usage = __record_usage; +static int build_id__process_mmap (struct perf_tool *tool,union perf_event *event, +struct perf_sample *sample,struct machine *machine) +{ +/* +* We already have the kernel maps, put in place via perf_session__create_kernel_maps() +* no need to add them twice. +*/ +if (!(event->header.misc &PERF_RECORD_MISC_USER )) +return 0 ; +return perf_event__process_mmap (tool, event, sample, machine); +} + +static int build_id__process_mmap2 (struct perf_tool *tool,union perf_event *event, +struct perf_sample *sample,struct machine *machine) +{ +/* +* We already have the kernel maps, put in place via perf_session__create_kernel_maps() +* no need to add them twice. +*/ +if (!(event->header.misc &PERF_RECORD_MISC_USER )) +return 0 ; + +return perf_event__process_mmap2 (tool, event, sample, machine); +} +/* * XXX Ideally would be local to cmd_record() and passed to a record__new * because we need to have access to it in record__exit, that is called
@@ -2177,8 +2202,8 @@ static struct record record = { .exit = perf_event__process_exit, .comm = perf_event__process_comm, .namespaces = perf_event__process_namespaces, - .mmap = perf_event__process_mmap, - .mmap2 = perf_event__process_mmap2, + .mmap = build_id__process_mmap, + .mmap2 = build_id__process_mmap2, .ordered_events = true, }, };
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 10/25 perf machine: No need to check if kernel module maps pre-exist
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We'only populating maps for kernel modules either from perf.data file PERF_RECORD_MMAP records or when parsing /proc/modules, so there is no need to first look if we already have those module maps in the list, that would mean the kernel has duplicate entries.
So ditch one use of looking up maps by name.
--- tools/perf/util/machine.c | 16 ++++++---------- tools/perf/util/machine.h | 2 -- tools/perf/util/symbol.c | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-)
tools/perf/util/machine.c +6 -10
@@ -772,20 +772,16 @@ int machine__process_ksymbol(struct machine *machine __maybe_unused,return machine__process_ksymbol_register (machine, event, sample); } -struct map *machine__findnew_module_map (struct machine *machine,u64 start, -const char *filename) +static struct map *machine__addnew_module_map (struct machine *machine,u64 start, +const char *filename) {struct map *map =NULL ; -struct dso *dso =NULL ;struct kmod_path m; +struct dso *dso;if (kmod_path__parse_name (&m, filename))return NULL ; - map =map_groups__find_by_name (&machine->kmaps, m.name); -if (map) - goto out; - dso =machine__findnew_module_dso (machine, &m, filename);if (dso ==NULL ) goto out;
@@ -1384,7 +1380,7 @@ static int machine__create_module(void *arg, const char *name, u64 start,if (arch__fix_module_text_start (&start, &size, name) <0 )return -1 ; - map =machine__findnew_module_map (machine, start, name); + map =machine__addnew_module_map (machine, start, name);if (map ==NULL )return -1 ; map->end = start + size;
@@ -1559,8 +1555,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine, strlen(machine->mmap_name) - 1) == 0;if (event->mmap.filename[0 ] =='/' || (!is_kernel_mmap && event->mmap.filename[0 ] =='[' )) { - map =machine__findnew_module_map (machine, event->mmap.start, - event->mmap.filename); + map =machine__addnew_module_map (machine, event->mmap.start, + event->mmap.filename);if (map ==NULL ) goto out_problem;
tools/perf/util/machine.h +0 -2
@@ -221,8 +221,6 @@ struct symbol *machine__find_kernel_symbol_by_name(struct machine *machine,return map_groups__find_symbol_by_name (&machine->kmaps, name, mapp); } -struct map *machine__findnew_module_map (struct machine *machine,u64 start, -const char *filename);int arch__fix_module_text_start (u64 *start,u64 *size,const char *name);int machine__load_kallsyms (struct machine *machine,const char *filename);
tools/perf/util/symbol.c +1 -1
@@ -1530,7 +1530,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP :/* * kernel modules know their symtab type - it's set when -* creating a module dso in machine__findnew_module_map(). +* creating a module dso in machine__addnew_module_map(). */ return kmod && dso->symtab_type == type;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 11/25 perf map_groups: Auto sort maps by name, if needed
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
There are still lots of lookups by name, even if just when loading vmlinux, till that code is studied to figure out if its possible to do away with those map lookup by names, provide a way to sort it using libc's qsort/bsearch.
Doing it at the first lookup defers the sorting a bit, and as the code stands now, is never done for user maps, just for the kernel ones.
# perf probe -l
# perf probe -x ~/bin/perf -L __map_groups__find_by_name
<__map_groups__find_by_name@/home/acme/git/perf/tools/perf/util/symbol.c:0>
0 static struct map *__map_groups__find_by_name(struct map_groups *mg, const char *name)
1 {
struct map **mapp; 4 if (mg->maps_by_name == NULL &&
5 map__groups__sort_by_name_from_rbtree(mg))
6 return NULL;
8 mapp = bsearch(name, mg->maps_by_name, mg->nr_maps, sizeof(*mapp), map__strcmp_name);
9 if (mapp)
10 return *mapp;
11 return NULL;
12 }
struct map *map_groups__find_by_name(struct map_groups *mg, const char *name)
{ # perf probe -x ~/bin/perf 'found=__map_groups__find_by_name:10 name:string'
Added new event:
probe_perf:found (on __map_groups__find_by_name:10 in /home/acme/bin/perf with name:string)You can now use it in all perf tools, such as:
perf record -e probe_perf:found -aR sleep 1
#
# perf probe -x ~/bin/perf -L map_groups__find_by_name
<map_groups__find_by_name@/home/acme/git/perf/tools/perf/util/symbol.c:0>
0 struct map *map_groups__find_by_name(struct map_groups *mg, const char *name)
1 {
2 struct maps *maps = &mg->maps;
struct map *map; 5 down_read(&maps->lock);
7 if (mg->last_search_by_name && strcmp(mg->last_search_by_name->dso->short_name, name) == 0) {
8 map = mg->last_search_by_name;
9 goto out_unlock;
}
/*
* If we have mg->maps_by_name, then the name isn't in the rbtree,
* as mg->maps_by_name mirrors the rbtree when lookups by name are
* made.
*/
16 map = __map_groups__find_by_name(mg, name);
17 if (map || mg->maps_by_name != NULL)
18 goto out_unlock;
/* Fallback to traversing the rbtree... */
21 maps__for_each_entry(maps, map)
22 if (strcmp(map->dso->short_name, name) == 0) {
23 mg->last_search_by_name = map;
24 goto out_unlock;
}
27 map = NULL;
out_unlock:
30 up_read(&maps->lock);
31 return map;
32 }
int dso__load_vmlinux(struct dso *dso, struct map *map,
const char *vmlinux, bool vmlinux_allocated) # perf probe -x ~/bin/perf 'fallback=map_groups__find_by_name:21 name:string'
Added new events:
probe_perf:fallback (on map_groups__find_by_name:21 in /home/acme/bin/perf with name:string)
probe_perf:fallback_1 (on map_groups__find_by_name:21 in /home/acme/bin/perf with name:string)You can now use it in all perf tools, such as:
perf record -e probe_perf:fallback_1 -aR sleep 1
#
# perf probe -l
probe_perf:fallback (on map_groups__find_by_name:21@util/symbol.c in /home/acme/bin/perf with name_string)
probe_perf:fallback_1 (on map_groups__find_by_name:21@util/symbol.c in /home/acme/bin/perf with name_string)
probe_perf:found (on __map_groups__find_by_name:10@util/symbol.c in /home/acme/bin/perf with name_string)
#
# perf stat -e probe_perf:*Now run 'perf top' in another term and then, after a while, stop 'perf stat':
Furthermore, if we ask for interval printing, we can see that that is done just at the start of the workload:
# perf stat -I1000 -e probe_perf:*
# time counts unit events
1.000319513 0 probe_perf:found
1.000319513 0 probe_perf:fallback_1
1.000319513 0 probe_perf:fallback
2.001868092 23,251 probe_perf:found
2.001868092 0 probe_perf:fallback_1
2.001868092 0 probe_perf:fallback
3.002901597 0 probe_perf:found
3.002901597 0 probe_perf:fallback_1
3.002901597 0 probe_perf:fallback
4.003358591 0 probe_perf:found
4.003358591 0 probe_perf:fallback_1
4.003358591 0 probe_perf:fallback
^C
#--- tools/perf/util/map.c | 49 ++++++++++++++++++++++++++++-- tools/perf/util/map_groups.h | 6 ++++ tools/perf/util/symbol.c | 59 ++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 3 deletions(-)
tools/perf/util/map.c +46 -3
@@ -573,20 +573,63 @@ void map_groups__init(struct map_groups *mg, struct machine *machine)maps__init (&mg->maps); mg->machine = machine; mg->last_search_by_name =NULL ; + mg->nr_maps =0 ; + mg->maps_by_name =NULL ;refcount_set (&mg->refcnt,1 ); } +static void __map_groups__free_maps_by_name (struct map_groups *mg) +{ +/* +* Free everything to try to do it from the rbtree in the next search +*/ +zfree (&mg->maps_by_name); + mg->nr_maps_allocated =0 ; +} +void map_groups__insert (struct map_groups *mg,struct map *map) { -maps__insert (&mg->maps, map); +struct maps *maps = &mg->maps; + +down_write (&maps->lock); +__maps__insert (maps, map); + ++mg->nr_maps; + +/* +* If we already performed some search by name, then we need to add the just +* inserted map and resort. +*/ +if (mg->maps_by_name) { +if (mg->nr_maps > mg->nr_maps_allocated) { +int nr_allocate = mg->nr_maps *2 ; +struct map **maps_by_name =realloc (mg->maps_by_name, nr_allocate *sizeof (map)); + +if (maps_by_name ==NULL ) { +__map_groups__free_maps_by_name (mg); +return ; + } + + mg->maps_by_name = maps_by_name; + mg->nr_maps_allocated = nr_allocate; + } + mg->maps_by_name[mg->nr_maps -1 ] = map; +__map_groups__sort_by_name (mg); + } +up_write (&maps->lock); }void map_groups__remove (struct map_groups *mg,struct map *map) { +struct maps *maps = &mg->maps; +down_write (&maps->lock);if (mg->last_search_by_name == map) mg->last_search_by_name =NULL ; -maps__remove (&mg->maps, map); +__maps__remove (maps, map); + --mg->nr_maps; +if (mg->maps_by_name) +__map_groups__free_maps_by_name (mg); +up_write (&maps->lock); }static void __maps__purge (struct maps *maps)
@@ -904,7 +947,7 @@ void maps__insert(struct maps *maps, struct map *map)up_write (&maps->lock); } -static void __maps__remove (struct maps *maps,struct map *map) +void __maps__remove (struct maps *maps,struct map *map) {rb_erase_init (&map->rb_node, &maps->entries);map__put (map);
tools/perf/util/map_groups.h +6 -0
@@ -21,6 +21,7 @@ struct maps {void maps__insert (struct maps *maps,struct map *map);void maps__remove (struct maps *maps,struct map *map); +void __maps__remove (struct maps *maps,struct map *map);struct map *maps__find (struct maps *maps,u64 addr);struct map *maps__first (struct maps *maps);struct map *map__next (struct map *map);
@@ -37,7 +38,10 @@ struct map_groups {struct maps maps;struct machine *machine;struct map *last_search_by_name; +struct map **maps_by_name;refcount_t refcnt; +unsigned int nr_maps; +unsigned int nr_maps_allocated;#ifdef HAVE_LIBUNWIND_SUPPORT void *addr_space;struct unwind_libunwind_ops *unwind_libunwind_ops;
@@ -97,4 +101,6 @@ struct map *map_groups__find_by_name(struct map_groups *mg, const char *name);int map_groups__merge_in (struct map_groups *kmaps,struct map *new_map); +void __map_groups__sort_by_name (struct map_groups *mg); +#endif // __PERF_MAP_GROUPS_H
tools/perf/util/symbol.c +59 -0
72 lines not on this page · raw message
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 12/25 perf callchain: Fix segfault in thread__resolve_callchain_sample()
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Do not dereference 'chain' when it is NULL.
$ perf record -e intel_pt//u -e branch-misses:u uname $ perf report --itrace=l --branch-history perf: Segmentation fault
--- tools/perf/util/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/machine.c +1 -1
@@ -2385,7 +2385,7 @@ static int thread__resolve_callchain_sample(struct thread *thread, } check_calls: -if (callchain_param.order !=ORDER_CALLEE ) { +if (chain && callchain_param.order !=ORDER_CALLEE ) { err =find_prev_cpumode (chain, thread, cursor, parent, root_al, &cpumode, chain->nr - first_call);if (err)
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 13/25 libtraceevent: Fix parsing of event %o and %X argument types
In reply to Arnaldo Carvalho de MeloFrom: Konstantin Khlebnikov <[email protected]>
Add missing "%o" and "%X". Ext4 events use "%o" for printing i_mode.
--- tools/lib/traceevent/event-parse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +5 -2
@@ -4395,8 +4395,10 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s/* fall through */ case 'd' :case 'u' : -case 'x' :case 'i' : +case 'x' : +case 'X' : +case 'o' :switch (ls) {case 0 : vsize =4 ;
@@ -5078,10 +5080,11 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_e/* fall through */ case 'd' : +case 'u' :case 'i' :case 'x' :case 'X' : -case 'u' : +case 'o' :if (!arg) {do_warning_event (event,"no argument match" ); event->flags |=TEP_EVENT_FL_FAILED ;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 14/25 perf map: Use bitmap for booleans
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The map->priv and map->erange_warned are seldom used, the first only in tests/vmlinux-kallsyms.c, the later only when hist_entry__inc_addr_samples() returns -ERANGE in 'perf top', which are really rare occasions, so make them a bool bitfield.
This will open up space for other members on the first cacheline.
$ pahole -C map ~/bin/perf
struct map {
union {
struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */
struct list_head node; /* 0 16 */
} __attribute__((__aligned__(8))); /* 0 24 */
u64 start; /* 24 8 */
u64 end; /* 32 8 */
_Bool erange_warned:1; /* 40: 0 1 */
_Bool priv:1; /* 40: 1 1 */ /* XXX 6 bits hole, try to pack */
/* XXX 3 bytes hole, try to pack */
u32 prot; /* 44 4 */ u32 flags; /* 48 4 */
/* XXX 4 bytes hole, try to pack */
u64 pgoff; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
u64 reloc; /* 64 8 */ u32 maj; /* 72 4 */ u32 min; /* 76 4 */ u64 ino; /* 80 8 */ u64 ino_generation; /* 88 8 */ u64 (*map_ip)(struct map *, u64); /* 96 8 */ u64 (*unmap_ip)(struct map *, u64); /* 104 8 */ struct dso * dso; /* 112 8 */ refcount_t refcnt; /* 120 4 */
/* size: 128, cachelines: 2, members: 17 */
/* sum members: 116, holes: 2, sum holes: 7 */
/* sum bitfield members: 2 bits, bit holes: 1, sum bit holes: 6 bits */ /* padding: 4 */
/* forced alignments: 1 */
} __attribute__((__aligned__(8)));
$
--- tools/perf/util/map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/map.h +2 -2
@@ -25,8 +25,8 @@ struct map { };u64 start;u64 end; -bool erange_warned; -u32 priv; + bool erange_warned:1; + bool priv:1;u32 prot;u32 flags;u64 pgoff;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 15/25 perf map: Move seldom used ->flags field to second cacheline
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
So we start with:
$ pahole -C map ~/bin/perf
struct map {
union {
struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */
struct list_head node; /* 0 16 */
} __attribute__((__aligned__(8))); /* 0 24 */
u64 start; /* 24 8 */
u64 end; /* 32 8 */
_Bool erange_warned:1; /* 40: 0 1 */
_Bool priv:1; /* 40: 1 1 */ /* XXX 6 bits hole, try to pack */
/* XXX 3 bytes hole, try to pack */
u32 prot; /* 44 4 */ u32 flags; /* 48 4 */
/* XXX 4 bytes hole, try to pack */
u64 pgoff; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
u64 reloc; /* 64 8 */ u32 maj; /* 72 4 */ u32 min; /* 76 4 */ u64 ino; /* 80 8 */ u64 ino_generation; /* 88 8 */ u64 (*map_ip)(struct map *, u64); /* 96 8 */ u64 (*unmap_ip)(struct map *, u64); /* 104 8 */ struct dso * dso; /* 112 8 */ refcount_t refcnt; /* 120 4 */
/* size: 128, cachelines: 2, members: 17 */
/* sum members: 116, holes: 2, sum holes: 7 */
/* sum bitfield members: 2 bits, bit holes: 1, sum bit holes: 6 bits */ /* padding: 4 */
/* forced alignments: 1 */
} __attribute__((__aligned__(8)));
$
and 'flags' is seldom used when printing details about the map or with the "cacheline" sort order, we can move them it to the second cacheline, that will allow combining it with 'refcnt', that is only four bytes:
$ pahole -C map ~/bin/perf
struct map {
union {
struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */
struct list_head node; /* 0 16 */
} __attribute__((__aligned__(8))); /* 0 24 */
u64 start; /* 24 8 */
u64 end; /* 32 8 */
_Bool erange_warned:1; /* 40: 0 1 */
_Bool priv:1; /* 40: 1 1 */ /* XXX 6 bits hole, try to pack */
/* XXX 3 bytes hole, try to pack */
u32 prot; /* 44 4 */ u64 pgoff; /* 48 8 */ u64 reloc; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 maj; /* 64 4 */ u32 min; /* 68 4 */ u64 ino; /* 72 8 */ u64 ino_generation; /* 80 8 */ u64 (*map_ip)(struct map *, u64); /* 88 8 */ u64 (*unmap_ip)(struct map *, u64); /* 96 8 */ struct dso * dso; /* 104 8 */ refcount_t refcnt; /* 112 4 */ u32 flags; /* 116 4 */
/* size: 120, cachelines: 2, members: 17 */
/* sum members: 116, holes: 1, sum holes: 3 */
/* sum bitfield members: 2 bits, bit holes: 1, sum bit holes: 6 bits */ /* forced alignments: 1 */
/* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));
$
--- tools/perf/util/map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/map.h +1 -1
@@ -28,7 +28,6 @@ struct map { bool erange_warned:1; bool priv:1;u32 prot; -u32 flags;u64 pgoff;u64 reloc;u32 maj, min;/* only valid for MMAP2 record */
@@ -42,6 +41,7 @@ struct map {struct dso *dso;refcount_t refcnt; +u32 flags; };struct kmap ;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 16/25 x86/insn: perf tools: Add some instructions to the new instructions test
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add to the "x86 instruction decoder - new instructions" test the following instructions:
cldemote
tpause
umonitor
umwait
movdiri
movdir64b
enqcmd
enqcmds
encls
enclu
enclv
pconfig
wbnoinvd
For information about the instructions, refer Intel SDM May 2019 (325462-070US) and Intel Architecture Instruction Set Extensions May 2019 (319433-037).
--- tools/perf/arch/x86/tests/insn-x86-dat-32.c | 52 +++++++++ tools/perf/arch/x86/tests/insn-x86-dat-64.c | 62 +++++++++++ tools/perf/arch/x86/tests/insn-x86-dat-src.c | 109 +++++++++++++++++++ 3 files changed, 223 insertions(+)
tools/perf/arch/x86/tests/insn-x86-dat-32.c +52 -0
@@ -1647,6 +1647,12 @@ "0f ae 30 \txsaveopt (%eax)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0x1c, 0x00, }, 3, 0, "", "", +"0f 1c 00 \tcldemote (%eax)",}, +{{0x0f, 0x1c, 0x05, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f 1c 05 78 56 34 12 \tcldemote 0x12345678",}, +{{0x0f, 0x1c, 0x84, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f 1c 84 c8 78 56 34 12 \tcldemote 0x12345678(%eax,%ecx,8)",}, {{0x0f, 0xc7, 0x20, }, 3, 0, "", "", "0f c7 20 \txsavec (%eax)",}, {{0x0f, 0xc7, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "",
@@ -1677,3 +1683,49 @@ "f3 0f ae 25 78 56 34 12 \tptwritel 0x12345678",}, {{0xf3, 0x0f, 0xae, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", "f3 0f ae a4 c8 78 56 34 12 \tptwritel 0x12345678(%eax,%ecx,8)",}, +{{0x66, 0x0f, 0xae, 0xf3, }, 4, 0, "", "", +"66 0f ae f3 \ttpause %ebx",}, +{{0x67, 0xf3, 0x0f, 0xae, 0xf0, }, 5, 0, "", "", +"67 f3 0f ae f0 \tumonitor %ax",}, +{{0xf3, 0x0f, 0xae, 0xf0, }, 4, 0, "", "", +"f3 0f ae f0 \tumonitor %eax",}, +{{0xf2, 0x0f, 0xae, 0xf0, }, 4, 0, "", "", +"f2 0f ae f0 \tumwait %eax",}, +{{0x0f, 0x38, 0xf9, 0x03, }, 4, 0, "", "", +"0f 38 f9 03 \tmovdiri %eax,(%ebx)",}, +{{0x0f, 0x38, 0xf9, 0x88, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f 38 f9 88 78 56 34 12 \tmovdiri %ecx,0x12345678(%eax)",}, +{{0x66, 0x0f, 0x38, 0xf8, 0x18, }, 5, 0, "", "", +"66 0f 38 f8 18 \tmovdir64b (%eax),%ebx",}, +{{0x66, 0x0f, 0x38, 0xf8, 0x88, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f 38 f8 88 78 56 34 12 \tmovdir64b 0x12345678(%eax),%ecx",}, +{{0x67, 0x66, 0x0f, 0x38, 0xf8, 0x1c, }, 6, 0, "", "", +"67 66 0f 38 f8 1c \tmovdir64b (%si),%bx",}, +{{0x67, 0x66, 0x0f, 0x38, 0xf8, 0x8c, 0x34, 0x12, }, 8, 0, "", "", +"67 66 0f 38 f8 8c 34 12 \tmovdir64b 0x1234(%si),%cx",}, +{{0xf2, 0x0f, 0x38, 0xf8, 0x18, }, 5, 0, "", "", +"f2 0f 38 f8 18 \tenqcmd (%eax),%ebx",}, +{{0xf2, 0x0f, 0x38, 0xf8, 0x88, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"f2 0f 38 f8 88 78 56 34 12 \tenqcmd 0x12345678(%eax),%ecx",}, +{{0x67, 0xf2, 0x0f, 0x38, 0xf8, 0x1c, }, 6, 0, "", "", +"67 f2 0f 38 f8 1c \tenqcmd (%si),%bx",}, +{{0x67, 0xf2, 0x0f, 0x38, 0xf8, 0x8c, 0x34, 0x12, }, 8, 0, "", "", +"67 f2 0f 38 f8 8c 34 12 \tenqcmd 0x1234(%si),%cx",}, +{{0xf3, 0x0f, 0x38, 0xf8, 0x18, }, 5, 0, "", "", +"f3 0f 38 f8 18 \tenqcmds (%eax),%ebx",}, +{{0xf3, 0x0f, 0x38, 0xf8, 0x88, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"f3 0f 38 f8 88 78 56 34 12 \tenqcmds 0x12345678(%eax),%ecx",}, +{{0x67, 0xf3, 0x0f, 0x38, 0xf8, 0x1c, }, 6, 0, "", "", +"67 f3 0f 38 f8 1c \tenqcmds (%si),%bx",}, +{{0x67, 0xf3, 0x0f, 0x38, 0xf8, 0x8c, 0x34, 0x12, }, 8, 0, "", "", +"67 f3 0f 38 f8 8c 34 12 \tenqcmds 0x1234(%si),%cx",}, +{{0x0f, 0x01, 0xcf, }, 3, 0, "", "", +"0f 01 cf \tencls ",}, +{{0x0f, 0x01, 0xd7, }, 3, 0, "", "", +"0f 01 d7 \tenclu ",}, +{{0x0f, 0x01, 0xc0, }, 3, 0, "", "", +"0f 01 c0 \tenclv ",}, +{{0x0f, 0x01, 0xc5, }, 3, 0, "", "", +"0f 01 c5 \tpconfig ",}, +{{0xf3, 0x0f, 0x09, }, 3, 0, "", "", +"f3 0f 09 \twbnoinvd ",},
tools/perf/arch/x86/tests/insn-x86-dat-64.c +62 -0
71 lines not on this page · raw message
tools/perf/arch/x86/tests/insn-x86-dat-src.c +109 -0
135 lines not on this page · raw message
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 17/25 x86/insn: Add some Intel instructions to the opcode map
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add to the opcode map the following instructions:
cldemote
tpause
umonitor
umwait
movdiri
movdir64b
enqcmd
enqcmds
encls
enclu
enclv
pconfig
wbnoinvd
For information about the instructions, refer Intel SDM May 2019 (325462-070US) and Intel Architecture Instruction Set Extensions May 2019 (319433-037).
The instruction decoding can be tested using the perf tools' "x86 instruction decoder - new instructions" test as folllows:
$ perf test -v "new " 2>&1 | grep -i cldemote Decoded ok: 0f 1c 00 cldemote (%eax) Decoded ok: 0f 1c 05 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%eax,%ecx,8) Decoded ok: 0f 1c 00 cldemote (%rax) Decoded ok: 41 0f 1c 00 cldemote (%r8) Decoded ok: 0f 1c 04 25 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%rax,%rcx,8) Decoded ok: 41 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%r8,%rcx,8) $ perf test -v "new " 2>&1 | grep -i tpause Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 41 0f ae f0 tpause %r8d $ perf test -v "new " 2>&1 | grep -i umonitor Decoded ok: 67 f3 0f ae f0 umonitor %ax Decoded ok: f3 0f ae f0 umonitor %eax Decoded ok: 67 f3 0f ae f0 umonitor %eax Decoded ok: f3 0f ae f0 umonitor %rax Decoded ok: 67 f3 41 0f ae f0 umonitor %r8d $ perf test -v "new " 2>&1 | grep -i umwait Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 41 0f ae f0 umwait %r8d $ perf test -v "new " 2>&1 | grep -i movdiri Decoded ok: 0f 38 f9 03 movdiri %eax,(%ebx) Decoded ok: 0f 38 f9 88 78 56 34 12 movdiri %ecx,0x12345678(%eax) Decoded ok: 48 0f 38 f9 03 movdiri %rax,(%rbx) Decoded ok: 48 0f 38 f9 88 78 56 34 12 movdiri %rcx,0x12345678(%rax) $ perf test -v "new " 2>&1 | grep -i movdir64b Decoded ok: 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx Decoded ok: 67 66 0f 38 f8 1c movdir64b (%si),%bx Decoded ok: 67 66 0f 38 f8 8c 34 12 movdir64b 0x1234(%si),%cx Decoded ok: 66 0f 38 f8 18 movdir64b (%rax),%rbx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%rax),%rcx Decoded ok: 67 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 67 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmd Decoded ok: f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: 67 f2 0f 38 f8 1c enqcmd (%si),%bx Decoded ok: 67 f2 0f 38 f8 8c 34 12 enqcmd 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f2 0f 38 f8 18 enqcmd (%rax),%rbx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%rax),%rcx Decoded ok: 67 f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmds Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i encls Decoded ok: 0f 01 cf encls Decoded ok: 0f 01 cf encls $ perf test -v "new " 2>&1 | grep -i enclu Decoded ok: 0f 01 d7 enclu Decoded ok: 0f 01 d7 enclu $ perf test -v "new " 2>&1 | grep -i enclv Decoded ok: 0f 01 c0 enclv Decoded ok: 0f 01 c0 enclv $ perf test -v "new " 2>&1 | grep -i pconfig Decoded ok: 0f 01 c5 pconfig Decoded ok: 0f 01 c5 pconfig $ perf test -v "new " 2>&1 | grep -i wbnoinvd Decoded ok: f3 0f 09 wbnoinvd Decoded ok: f3 0f 09 wbnoinvd
--- arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ tools/arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-)
arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
tools/arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 18/25 perf probe: Show correct statement line number by perf probe -l
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
The dwarf_getsrc_die() can return the line which is not a statement nor the least line number among the lines which shares same address.
This can lead perf probe --list shows incorrect line number for probed address.
To fix this, this introduces cu_getsrc_die() which returns only a statement line and which is the least line number (we call it the representive line for an address), and use it in cu_find_lineinfo().
Also, if the given address is the entry address of a real function, cu_find_lineinfo() returns the function declared line number instead of the start line number of the function body.
For example, without this change perf probe -l shows incorrect line as below.
# perf probe -a kernel_read:2
Added new event:
probe:kernel_read (on kernel_read:2)You can now use it in all perf tools, such as:
perf record -e probe:kernel_read -aR sleep 1
# perf probe -l
probe:kernel_read (on kernel_read:[email protected]/fs/read_write.c)With this fix, it shows correct line number as below;
# perf probe -l
probe:kernel_read (on kernel_read:[email protected]/fs/read_write.c)--- tools/perf/util/dwarf-aux.c | 62 ++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-)
tools/perf/util/dwarf-aux.c +58 -4
@@ -59,6 +59,51 @@ const char *cu_get_comp_dir(Dwarf_Die *cu_die)return dwarf_formstring (&attr); } +/* Unlike dwarf_getsrc_die(), cu_getsrc_die() only returns statement line */ +static Dwarf_Line *cu_getsrc_die (Dwarf_Die *cu_die,Dwarf_Addr addr) +{ +Dwarf_Addr laddr; +Dwarf_Lines *lines; +Dwarf_Line *line; +size_t nlines, l, u, n; +bool flag; + +if (dwarf_getsrclines (cu_die, &lines, &nlines) !=0 || + nlines ==0 ) +return NULL ; + +/* Lines are sorted by address, use binary search */ + l =0 ; u = nlines -1 ; +while (l < u) { + n = u - (u - l) /2 ; + line =dwarf_onesrcline (lines, n); +if (!line ||dwarf_lineaddr (line, &laddr) !=0 ) +return NULL ; +if (addr < laddr) + u = n -1 ; +else + l = n; + } +/* Going backward to find the lowest line */ +do { + line =dwarf_onesrcline (lines, --l); +if (!line ||dwarf_lineaddr (line, &laddr) !=0 ) +return NULL ; + }while (laddr == addr); + l++; +/* Going foward to find the statement line */ +do { + line =dwarf_onesrcline (lines, l++); +if (!line ||dwarf_lineaddr (line, &laddr) !=0 || +dwarf_linebeginstatement (line, &flag) !=0 ) +return NULL ; +if (laddr > addr) +return NULL ; + }while (!flag); + +return line; +} +/** * cu_find_lineinfo - Get a line number and file name for given address * @cu_die: a CU DIE
@@ -72,17 +117,26 @@ int cu_find_lineinfo(Dwarf_Die *cu_die, unsigned long addr, const char **fname, int *lineno) { Dwarf_Line *line; -Dwarf_Addr laddr; +Dwarf_Die die_mem; +Dwarf_Addr faddr; - line =dwarf_getsrc_die (cu_die, (Dwarf_Addr )addr); -if (line &&dwarf_lineaddr (line, &laddr) ==0 && - addr == (unsigned long )laddr &&dwarf_lineno (line, lineno) ==0 ) { +if (die_find_realfunc (cu_die, (Dwarf_Addr )addr, &die_mem) + &&die_entrypc (&die_mem, &faddr) ==0 && + faddr == addr) { + *fname =dwarf_decl_file (&die_mem); +dwarf_decl_line (&die_mem, lineno); + goto out; + } + + line =cu_getsrc_die (cu_die, (Dwarf_Addr )addr); +if (line &&dwarf_lineno (line, lineno) ==0 ) { *fname =dwarf_linesrc (line,NULL ,NULL );if (!*fname)/* line number is useless without filename */ *lineno =0 ; } +out:return *lineno ?: -ENOENT ; }
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 19/25 perf probe: Verify given line is a representive line
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Verify user given probe line is a representive line (which doesn't share the address with other lines or the line is the least line among the lines which shares same address), and if not, it shows what is the representive line.
Without this fix, user can put a probe on the lines which is not a a representive line. But since this is not a representive line, perf probe -l shows a representive line number instead of user given line number. e.g. (put kernel_read:3, but listed as kernel_read:2)
# perf probe -a kernel_read:3
Added new event:
probe:kernel_read (on kernel_read:3)You can now use it in all perf tools, such as:
perf record -e probe:kernel_read -aR sleep 1
# perf probe -l
probe:kernel_read (on kernel_read:[email protected]/fs/read_write.c)With this fix, perf probe doesn't allow user to put a probe on a representive line, and tell what is the representive line.
# perf probe -a kernel_read:3
This line is sharing the addrees with other lines.
Please try to probe at kernel_read:2 instead.
Error: Failed to add events.--- tools/perf/util/probe-finder.c | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
tools/perf/util/probe-finder.c +36 -0
@@ -776,6 +776,39 @@ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem)return fsp.found ? die_mem :NULL ; } +static int verify_representive_line (struct probe_finder *pf,const char *fname, +int lineno,Dwarf_Addr addr) +{ +const char *__fname, *__func =NULL ; +Dwarf_Die die_mem; +int __lineno; + +/* Verify line number and address by reverse search */ +if (cu_find_lineinfo (&pf->cu_die, addr, &__fname, &__lineno) <0 ) +return 0 ; + +pr_debug2 ("Reversed line: %s:%d\n" , __fname, __lineno); +if (strcmp (fname, __fname) || lineno == __lineno) +return 0 ; + +pr_warning ("This line is sharing the addrees with other lines.\n" ); + +if (pf->pev->point.function) { +/* Find best match function name and lines */ + pf->addr = addr; +if (find_best_scope (pf, &die_mem) + &&die_match_name (&die_mem, pf->pev->point.function) + &&dwarf_decl_line (&die_mem, &lineno) ==0 ) { + __func =dwarf_diename (&die_mem); + __lineno -= lineno; + } + } +pr_warning ("Please try to probe at %s:%d instead.\n" , + __func ? : __fname, __lineno); + +return -ENOENT ; +} +static int probe_point_line_walker (const char *fname,int lineno,Dwarf_Addr addr,void *data) {
@@ -786,6 +819,9 @@ static int probe_point_line_walker(const char *fname, int lineno,if (lineno != pf->lno ||strtailcmp (fname, pf->fname) !=0 )return 0 ; +if (verify_representive_line (pf, fname, lineno, addr)) +return -ENOENT ; + pf->addr = addr; sc_die =find_best_scope (pf, &die_mem);if (!sc_die) {
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 20/25 perf probe: Do not show non representive lines by perf-probe -L
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Since perf probe -L shows non representive lines, it can be mislead users where user can put probes. This prevents to show such non representive lines so that user can understand which lines user can probe.
# perf probe -L kernel_read
<kernel_read@/build/linux-pvZVvI/linux-5.0.0/fs/read_write.c:0>
0 ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
{
2 mm_segment_t old_fs;
ssize_t result; old_fs = get_fs();
6 set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */
8 result = vfs_read(file, (void __user *)buf, count, pos);
9 set_fs(old_fs);
10 return result;
}
EXPORT_SYMBOL(kernel_read);Committer testing:
Before:
# perf probe -L kernel_read
<kernel_read@/usr/src/debug/kernel-5.3.fc30/linux-5.3.8-200.fc30.x86_64/fs/read_write.c:0>
0 ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
1 {
2 mm_segment_t old_fs;
3 ssize_t result; 5 old_fs = get_fs();
6 set_fs(KERNEL_DS);
/* The cast to a user pointer is valid due to the set_fs() */
8 result = vfs_read(file, (void __user *)buf, count, pos);
9 set_fs(old_fs);
10 return result;
}
EXPORT_SYMBOL(kernel_read);#
See the 1, 3, 5 lines? They shouldn't be there, after this patch:
# perf probe -L kernel_read
<kernel_read@/usr/src/debug/kernel-5.3.fc30/linux-5.3.8-200.fc30.x86_64/fs/read_write.c:0>
0 ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
{
2 mm_segment_t old_fs;
ssize_t result; old_fs = get_fs();
6 set_fs(KERNEL_DS);
/* The cast to a user pointer is valid due to the set_fs() */
8 result = vfs_read(file, (void __user *)buf, count, pos);
9 set_fs(old_fs);
10 return result;
}
EXPORT_SYMBOL(kernel_read);#
--- tools/perf/util/probe-finder.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/util/probe-finder.c +7 -0
@@ -1734,12 +1734,19 @@ static int line_range_walk_cb(const char *fname, int lineno, void *data) {struct line_finder *lf = data; +const char *__fname; +int __lineno;int err;if ((strtailcmp (fname, lf->fname) !=0 ) || (lf->lno_s > lineno || lf->lno_e < lineno))return 0 ; +/* Make sure this line can be reversable */ +if (cu_find_lineinfo (&lf->cu_die, addr, &__fname, &__lineno) >0 + && (lineno != __lineno ||strcmp (fname, __fname))) +return 0 ; + err =line_range_add_line (fname, lineno, lf->lr);if (err <0 && err != -EEXIST )return err;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 21/25 perf probe: Generate event name with line number
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Generate event name from function name with line number as <function>_L<line_number>. Note that this is only for the new event which is defined by the line number of function (except for line 0).
If there is another event on same line, you have to use "-f" option. In that case, the new event has "_1" suffix.
e.g.
# perf probe -a kernel_read:2
Added new event:
probe:kernel_read_L2 (on kernel_read:2)You can now use it in all perf tools, such as:
perf record -e probe:kernel_read_L2 -aR sleep 1
But if we omit the line number or 0th line, it will have no suffix.
# perf probe -a kernel_read:0
Added new event:
probe:kernel_read (on kernel_read)You can now use it in all perf tools, such as:
perf record -e probe:kernel_read -aR sleep 1
probe:kernel_read (on [email protected]/fs/read_write.c)
probe:kernel_read_L2 (on kernel_read:[email protected]/fs/read_write.c)
--- tools/perf/util/probe-event.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/util/probe-event.c +8 -0
@@ -1679,6 +1679,14 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev)if (ret <0 ) goto out; +/* Generate event name if needed */ +if (!pev->event && pev->point.function && pev->point.line + && !pev->point.lazy_line && !pev->point.offset) { +if (asprintf (&pev->event,"%s_L%d" , pev->point.function, + pev->point.line) <0 ) +return -ENOMEM ; + } +/* Copy arguments and ensure return probe has no C argument */ pev->nargs = argc -1 ; pev->args =zalloc (sizeof (struct perf_probe_arg ) * pev->nargs);
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 22/25 perf probe: Support multiprobe event
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Support multiprobe event if the event is based on function and lines and kernel supports it. In this case, perf probe creates the first probe with an event, and tries to append following probes on that event, since those probes must be on the same source code line.
Before this patch;
# perf probe -a vfs_read:18
Added new events:
probe:vfs_read_L18 (on vfs_read:18)
probe:vfs_read_L18_1 (on vfs_read:18)You can now use it in all perf tools, such as:
perf record -e probe:vfs_read_L18_1 -aR sleep 1
#
After this patch (on multiprobe supported kernel)
# perf probe -a vfs_read:18
Added new events:
probe:vfs_read_L18 (on vfs_read:18)
probe:vfs_read_L18 (on vfs_read:18)You can now use it in all perf tools, such as:
perf record -e probe:vfs_read_L18 -aR sleep 1
#
Committer testing:
On a kernel that doesn't support multiprobe events, after this patch:
# uname -a
Linux quaco 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# grep append /sys/kernel/debug/tracing/README
be modified by appending '.descending' or '.ascending' to a
can be modified by appending any of the following modifiers
#
# perf probe -a vfs_read:18
Added new events:
probe:vfs_read_L18 (on vfs_read:18)
probe:vfs_read_L18_1 (on vfs_read:18)You can now use it in all perf tools, such as:
perf record -e probe:vfs_read_L18_1 -aR sleep 1
# perf probe -l
probe:vfs_read_L18 (on vfs_read:18@fs/read_write.c)
probe:vfs_read_L18_1 (on vfs_read:18@fs/read_write.c)
#--- tools/perf/util/probe-event.c | 9 +++++++-- tools/perf/util/probe-file.c | 7 +++++++ tools/perf/util/probe-file.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-)
tools/perf/util/probe-event.c +7 -2
@@ -2738,8 +2738,13 @@ static int probe_trace_event__set_name(struct probe_trace_event *tev,if (tev->event ==NULL || tev->group ==NULL )return -ENOMEM ; -/* Add added event name to namelist */ -strlist__add (namelist, event); +/* +* Add new event name to namelist if multiprobe event is NOT +* supported, since we have to use new event name for following +* probes in that case. +*/ +if (!multiprobe_event_is_supported ()) +strlist__add (namelist, event);return 0 ; }
tools/perf/util/probe-file.c +7 -0
@@ -1007,6 +1007,7 @@ enum ftrace_readme {FTRACE_README_KRETPROBE_OFFSET ,FTRACE_README_UPROBE_REF_CTR ,FTRACE_README_USER_ACCESS , +FTRACE_README_MULTIPROBE_EVENT , FTRACE_README_END, };
@@ -1020,6 +1021,7 @@ static struct {DEFINE_TYPE (FTRACE_README_KRETPROBE_OFFSET ,"*place (kretprobe): *" ),DEFINE_TYPE (FTRACE_README_UPROBE_REF_CTR ,"*ref_ctr_offset*" ),DEFINE_TYPE (FTRACE_README_USER_ACCESS ,"*[u]<offset>*" ), + DEFINE_TYPE(FTRACE_README_MULTIPROBE_EVENT, "*Create/append/*"), };static bool scan_ftrace_readme (enum ftrace_readme type)
@@ -1085,3 +1087,8 @@ bool user_access_is_supported(void) {return scan_ftrace_readme (FTRACE_README_USER_ACCESS ); } + +bool multiprobe_event_is_supported (void ) +{ +return scan_ftrace_readme (FTRACE_README_MULTIPROBE_EVENT ); +}
tools/perf/util/probe-file.h +1 -0
@@ -71,6 +71,7 @@ bool probe_type_is_available(enum probe_type type);bool kretprobe_offset_is_supported (void );bool uprobe_ref_ctr_is_supported (void );bool user_access_is_supported (void ); +bool multiprobe_event_is_supported (void );#else /* ! HAVE_LIBELF_SUPPORT */ static inline struct probe_cache *probe_cache__new (const char *tgt__maybe_unused ,struct nsinfo *nsi__maybe_unused ) {
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 23/25 perf probe: Support DW_AT_const_value constant value
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Support DW_AT_const_value for variable assignment instead of location. Note that this requires ftrace supporting immediate value.
--- tools/perf/util/probe-file.c | 7 +++++++ tools/perf/util/probe-file.h | 1 + tools/perf/util/probe-finder.c | 11 +++++++++++ 3 files changed, 19 insertions(+)
tools/perf/util/probe-file.c +7 -0
@@ -1008,6 +1008,7 @@ enum ftrace_readme {FTRACE_README_UPROBE_REF_CTR ,FTRACE_README_USER_ACCESS ,FTRACE_README_MULTIPROBE_EVENT , +FTRACE_README_IMMEDIATE_VALUE , FTRACE_README_END, };
@@ -1022,6 +1023,7 @@ static struct {DEFINE_TYPE (FTRACE_README_UPROBE_REF_CTR ,"*ref_ctr_offset*" ),DEFINE_TYPE (FTRACE_README_USER_ACCESS ,"*[u]<offset>*" ),DEFINE_TYPE (FTRACE_README_MULTIPROBE_EVENT ,"*Create/append/*" ), + DEFINE_TYPE(FTRACE_README_IMMEDIATE_VALUE, "*\\imm-value,*"), };static bool scan_ftrace_readme (enum ftrace_readme type)
@@ -1092,3 +1094,8 @@ bool multiprobe_event_is_supported(void) {return scan_ftrace_readme (FTRACE_README_MULTIPROBE_EVENT ); } + +bool immediate_value_is_supported (void ) +{ +return scan_ftrace_readme (FTRACE_README_IMMEDIATE_VALUE ); +}
tools/perf/util/probe-file.h +1 -0
@@ -72,6 +72,7 @@ bool kretprobe_offset_is_supported(void);bool uprobe_ref_ctr_is_supported (void );bool user_access_is_supported (void );bool multiprobe_event_is_supported (void ); +bool immediate_value_is_supported (void );#else /* ! HAVE_LIBELF_SUPPORT */ static inline struct probe_cache *probe_cache__new (const char *tgt__maybe_unused ,struct nsinfo *nsi__maybe_unused ) {
tools/perf/util/probe-finder.c +11 -0
@@ -177,6 +177,17 @@ static int convert_variable_location(Dwarf_Die *vr_die, Dwarf_Addr addr,if (dwarf_attr (vr_die, DW_AT_external, &attr) !=NULL ) goto static_var; +/* Constant value */ +if (dwarf_attr (vr_die, DW_AT_const_value, &attr) && +immediate_value_is_supported ()) { +Dwarf_Sword snum; + +dwarf_formsdata (&attr, &snum); + ret =asprintf (&tvar->value,"\\%ld" , (long )snum); + +return ret <0 ? -ENOMEM :0 ; + } +/* TODO: handle more than 1 exprs */ if (dwarf_attr (vr_die, DW_AT_location, &attr) ==NULL )return -EINVAL ;/* Broken DIE ? */
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 24/25 perf probe: Trace a magic number if variable is not found
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Trace a magic number as immediate value if the target variable is not found at some probe points which is based on one probe event.
This feature is good for the case if you trace a source code line with some local variables, which is compiled into several instructions and some of the variables are optimized out on some instructions.
Even if so, with this feature, perf probe trace a magic number instead of such disappeared variables and fold those probes on one event.
E.g. without this patch:
# perf probe -D "pud_page_vaddr pud" Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. Failed to find 'pud' in this function. p:probe/pud_page_vaddr _text+23480787 pud=%ax:x64 p:probe/pud_page_vaddr _text+23808453 pud=%bp:x64 p:probe/pud_page_vaddr _text+23558082 pud=%ax:x64 p:probe/pud_page_vaddr _text+328373 pud=%r8:x64 p:probe/pud_page_vaddr _text+348448 pud=%bx:x64 p:probe/pud_page_vaddr _text+23816818 pud=%bx:x64
With this patch:
# perf probe -D "pud_page_vaddr pud" | head spurious_kernel_fault is blacklisted function, skip it. vmalloc_fault is blacklisted function, skip it. p:probe/pud_page_vaddr _text+23480787 pud=%ax:x64 p:probe/pud_page_vaddr _text+149051 pud=\deade12d:x64 p:probe/pud_page_vaddr _text+23808453 pud=%bp:x64 p:probe/pud_page_vaddr _text+315926 pud=\deade12d:x64 p:probe/pud_page_vaddr _text+23807209 pud=\deade12d:x64 p:probe/pud_page_vaddr _text+23557365 pud=%ax:x64 p:probe/pud_page_vaddr _text+314097 pud=%di:x64 p:probe/pud_page_vaddr _text+314015 pud=\deade12d:x64 p:probe/pud_page_vaddr _text+313893 pud=\deade12d:x64 p:probe/pud_page_vaddr _text+324083 pud=\deade12d:x64
--- tools/perf/util/probe-event.c | 2 +- tools/perf/util/probe-event.h | 3 ++ tools/perf/util/probe-finder.c | 62 +++++++++++++++++++++++++++++++--- tools/perf/util/probe-finder.h | 1 + 4 files changed, 63 insertions(+), 5 deletions(-)
tools/perf/util/probe-event.c +1 -1
@@ -46,7 +46,7 @@#define PERFPROBE_GROUP "probe"bool probe_event_dry_run;/* Dry run flag */ -struct probe_conf probe_conf; +struct probe_conf probe_conf = { .magic_num =DEFAULT_PROBE_MAGIC_NUM }; #define semantic_error(msg ...) pr_err("Semantic error :" msg)
tools/perf/util/probe-event.h +3 -0
@@ -16,10 +16,13 @@ struct probe_conf {bool no_inlines;bool cache;int max_probes; +unsigned long magic_num; };extern struct probe_conf probe_conf;extern bool probe_event_dry_run; +#define DEFAULT_PROBE_MAGIC_NUM 0xdeade12d/* u32: 3735937325 */ +struct symbol ;/* kprobe-tracer and uprobe-tracer tracing point */
tools/perf/util/probe-finder.c +58 -4
94 lines not on this page · raw message
tools/perf/util/probe-finder.h +1 -0
@@ -87,6 +87,7 @@ struct probe_finder {unsigned int machine;/* Target machine arch */ struct perf_probe_arg *pvar;/* Current target variable */ struct probe_trace_arg *tvar;/* Current result variable */ +bool skip_empty_arg;/* Skip non-exist args */ };struct trace_event_finder {
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 25/25 perf parse: Report initial event parsing error
In reply to Arnaldo Carvalho de MeloFrom: Ian Rogers <[email protected]>
Record the first event parsing error and report. Implementing feedback from Jiri Olsa:
https://lkml.org/lkml/2019/10/28/680
An example error is:
$ tools/perf/perf stat -e c/c/
WARNING: multiple event parsing errors
event syntax error: 'c/c/'
\___ unknown termvalid terms: event,filter_rem,filter_opc0,edge,filter_isoc,filter_tid,filter_loc,filter_nc,inv,umask,filter_opc1,tid_en,thresh,filter_all_op,filter_not_nm,filter_state,filter_nm,config,config1,config2,name,period,percore
Initial error:
event syntax error: 'c/c/'
\___ Cannot find PMU `c'. Missing kernel support?
Run 'perf list' for a list of valid events
Usage: perf stat [<options>] [<command>]
-e, --event <event> event selector. use 'perf list' to list available events
--- tools/perf/arch/powerpc/util/kvm-stat.c | 4 +- tools/perf/builtin-stat.c | 2 + tools/perf/builtin-trace.c | 16 +++-- tools/perf/tests/parse-events.c | 3 +- tools/perf/util/metricgroup.c | 2 +- tools/perf/util/parse-events.c | 78 ++++++++++++++++++------- tools/perf/util/parse-events.h | 4 ++ 7 files changed, 80 insertions(+), 29 deletions(-)
tools/perf/arch/powerpc/util/kvm-stat.c +2 -2
@@ -113,10 +113,10 @@ static int is_tracepoint_available(const char *str, struct evlist *evlist)struct parse_events_error err;int ret; - err.str =NULL ; +bzero (&err,sizeof (err)); ret =parse_events (evlist, str, &err);if (err.str) -pr_err ("%s : %s\n" , str, err.str); +parse_events_print_error (&err,"tracepoint" );return ret; }
tools/perf/builtin-stat.c +2 -0
@@ -1307,6 +1307,7 @@ static int add_default_attributes(void)if (stat_config.null_run)return 0 ; +bzero (&errinfo,sizeof (errinfo));if (transaction_run) {/* Handle -T as -M transaction. Once platform specific metrics * support has been added to the json files, all archictures
@@ -1364,6 +1365,7 @@ static int add_default_attributes(void)return -1 ; }if (err) { +parse_events_print_error (&errinfo, smi_cost_attrs);fprintf (stderr,"Cannot set up SMI cost events\n" );return -1 ; }
tools/perf/builtin-trace.c +12 -4
@@ -3016,11 +3016,18 @@ static bool evlist__add_vfs_getname(struct evlist *evlist) {bool found = false;struct evsel *evsel, *tmp; -struct parse_events_error err = { .idx =0 , }; -int ret =parse_events (evlist,"probe:vfs_getname*" , &err); +struct parse_events_error err; +int ret; -if (ret) +bzero (&err,sizeof (err)); + ret =parse_events (evlist,"probe:vfs_getname*" , &err); +if (ret) { +free (err.str); +free (err.help); +free (err.first_str); +free (err.first_help);return false; + }evlist__for_each_entry_safe (evlist, evsel, tmp) {if (!strstarts (perf_evsel__name (evsel),"probe:vfs_getname" ))
@@ -4832,8 +4839,9 @@ int cmd_trace(int argc, const char **argv)* wrong in more detail. */ if (trace.perfconfig_events !=NULL ) { -struct parse_events_error parse_err = { .idx =0 , }; +struct parse_events_error parse_err; +bzero (&parse_err,sizeof (parse_err)); err =parse_events (trace.evlist, trace.perfconfig_events, &parse_err);if (err) {parse_events_print_error (&parse_err, trace.perfconfig_events);
tools/perf/tests/parse-events.c +2 -1
@@ -1768,10 +1768,11 @@ static struct terms_test test__terms[] = {static int test_event (struct evlist_test *e) { -struct parse_events_error err = { .idx =0 , }; +struct parse_events_error err;struct evlist *evlist;int ret; +bzero (&err,sizeof (err));if (e->valid && !e->valid ()) {pr_debug ("... SKIP" );return 0 ;
tools/perf/util/metricgroup.c +1 -1
@@ -523,7 +523,7 @@ int metricgroup__parse_groups(const struct option *opt,if (ret)return ret;pr_debug ("adding %s\n" , extra_events.buf); -memset (&parse_error,0 ,sizeof (struct parse_events_error )); +bzero (&parse_error,sizeof (parse_error)); ret =parse_events (perf_evlist, extra_events.buf, &parse_error);if (ret) {parse_events_print_error (&parse_error, extra_events.buf);
tools/perf/util/parse-events.c +57 -21
123 lines not on this page · raw message
tools/perf/util/parse-events.h +4 -0
@@ -110,9 +110,13 @@ struct parse_events_term { };struct parse_events_error { +int num_errors;/* number of errors encountered */ int idx;/* index in the parsed string */ char *str;/* string to display at the index */ char *help;/* optional help string */ +int first_idx;/* as above, but for the first encountered error */ +char *first_str; +char *first_help; };struct parse_events_state {
Signature · 1 line
2.21.0
Quoted 95 lines · Arnaldo Carvalho de Melo
Hi Ingo/Thomas,
Please consider pulling,
Best regards,
- Arnaldo
The following changes since commit
e1e9b78d3957a267346a86c8f2c433f6a332af65:perf parse: Use YYABORT to clear stack after failure, plugging leaks (2019-11-12 08:34:16 -0300)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-5.5-20191119for you to fetch changes up to
a910e4666d61712840c78de33cc7f89de8affa78:perf parse: Report initial event parsing error (2019-11-18 19:14:29 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:x86/insn:
Adrian Hunter:
- Add some more Intel instructions to the opcode map:
cldemote, encls, enclu, enclv, enqcmd, enqcmds, movdir64b, movdiri, pconfig, tpause, umonitor, umwait, wbnoinvd.
- The instruction decoding can be tested using the perf tools' "x86 instruction decoder - new instructions" test as folllows:
$ perf test -v "new " 2>&1 | grep -i cldemote
Decoded ok: 0f 1c 00 cldemote (%eax)
Decoded ok: 0f 1c 05 78 56 34 12 cldemote0x12345678
Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%eax,%ecx,8)
Decoded ok: 0f 1c 00 cldemote (%rax)
Decoded ok: 41 0f 1c 00 cldemote (%r8)
Decoded ok: 0f 1c 04 25 78 56 34 12 cldemote0x12345678
Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%rax,%rcx,8)
Decoded ok: 41 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%r8,%rcx,8) $ perf test -v "new " 2>&1 | grep -i tpause
Decoded ok: 66 0f ae f3 tpause %ebx
Decoded ok: 66 0f ae f3 tpause %ebx
Decoded ok: 66 41 0f ae f0 tpause %r8dcallchains:
Adrian Hunter:
- Fix segfault in
thread__resolve_callchain_sample().perf probe:
- Line fixes to show only lines where probes can be used with 'perf probe -L', and when reporting them via 'perf probe -l'.
- Support multiprobe events.
perf scripts python:
Adrian Hunter:
- Fix use of TRUE with SQLite < 3.23 in
exported-sql-viewer.py.perf maps:
- Trim 'struct map' by removing the
rb_nodemember for sorting by map name, as that is only needed for processing kernel maps, and only when classifying symbols by section at load time. Sort them by name usingqsort()and do lookups usingbsearch()whenmap_groups__find_by_name()is used.perf parse:
Ian Rogers:
- Report initial event parsing error, providing a less cryptic message to state that a PMU wasn't found in the system.
perf vendor events:
James Clark:
- Fix commas so that PMU event files for arm64, power8 and power nine become valid JSON.
libtraceevent:
Konstantin Khlebnikov:
Quoted 7 lines
- Fix parsing of event %o and %X argument types.
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
66 files changed, 2888 insertions(+), 2366 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo