[PATCH v4 0/9] perf mem/c2c: Support AUX trace

From: Leo Yan
Date: Fri Nov 06 2020 - 04:49:16 EST


This patch series is v4 for support perf mem/c2c AUX trace.

Comparing to patch set v3, this patch set adds back the patch 06/09 for
introducing the itrace option '-M', this allows to synthenize memory
event from the AUX trace data.

Since perf mem/c2c tools are focus on memory profiling, this patch set
makes itrace memory event as default for perf mem/c2c, the tool will
tell AUX trace decoder that it is _ONLY_ interested in memory event
rather than other itrace events. So patches 07, 08 have updated
'itrace_synth_opts' for this.

This patch has dropped the memory type 'ldst' and keeps to use the old
types 'load' and 'store', if user passes the type 'load,store', the tool
can automatically use PERF_MEM_EVENTS__LOAD_STORE event if arch supports
it, otherwise, rolls back to enable both LOAD and STORE events. So we
don't need to do any change for tool's usage.

This patch set has been applied clearly on the perf/core branch with the
latest commit 7b3bcedf5ee5 ("perf scripting python: Avoid declaring
function pointers with a visibility attribute").

This patch set has been verified on both x86 and Arm64.

On x86, below commands have been tested:

# perf c2c record -- ~/false_sharing.exe 2
# perf c2c record -e ldlat-loads -- ~/false_sharing.exe 2
# perf c2c record -e ldlat-stores -- ~/false_sharing.exe 2
# perf mem record -- ~/false_sharing.exe 2
# perf mem record -t load -- ~/false_sharing.exe 2
# perf mem record -t store -- ~/false_sharing.exe 2
# perf mem record -t load,store -- ~/false_sharing.exe 2
# perf mem record -e ldlat-loads -- ~/false_sharing.exe 2
# perf mem record -e ldlat-stores -- ~/false_sharing.exe 2

On Arm64, below commands have been tested:

# perf c2c record -- ~/false_sharing.exe 2
# perf c2c record -e spe-load -- ~/false_sharing.exe 2
# perf c2c record -e spe-store -- ~/false_sharing.exe 2
# perf c2c record -e spe-ldst -- ~/false_sharing.exe 2
# perf mem record -- ~/false_sharing.exe 2
# perf mem record -t load -- ~/false_sharing.exe 2
# perf mem record -t store -- ~/false_sharing.exe 2
# perf mem record -t load,store -- ~/false_sharing.exe 2
# perf mem record -e spe-load -- ~/false_sharing.exe 2
# perf mem record -e spe-store -- ~/false_sharing.exe 2
# perf mem record -e spe-ldst -- ~/false_sharing.exe 2

Changes from v3:
* Added back the patch 06/09 for introducing the itrace option '-M'
(Jiri);
* Added 'itrace_synth_opts' for memory event (Jiri);
* Dropped type 'ldst' so don't change any usages for tools (Ian);
* Dropped the patch "perf mem: Return NULL for event 'ldst' on
PowerPC" due type 'ldst' is not added anymore (Ian);
* Added patch 04/09 "perf c2c: Support memory event
PERF_MEM_EVENTS__LOAD_STORE", so can convert the load/store requests
to event PERF_MEM_EVENTS__LOAD_STORE (James Clark).


Leo Yan (9):
perf mem: Search event name with more flexible path
perf mem: Introduce weak function perf_mem_events__ptr()
perf mem: Support new memory event PERF_MEM_EVENTS__LOAD_STORE
perf c2c: Support memory event PERF_MEM_EVENTS__LOAD_STORE
perf mem: Only initialize memory event for recording
perf auxtrace: Add itrace option '-M' for memory events
perf mem: Support AUX trace
perf c2c: Support AUX trace
perf mem: Support Arm SPE events

tools/perf/Documentation/itrace.txt | 1 +
tools/perf/arch/arm64/util/Build | 2 +-
tools/perf/arch/arm64/util/mem-events.c | 37 ++++++++++++++++
tools/perf/builtin-c2c.c | 39 ++++++++++++++---
tools/perf/builtin-mem.c | 56 +++++++++++++++++++------
tools/perf/util/auxtrace.c | 4 ++
tools/perf/util/auxtrace.h | 2 +
tools/perf/util/mem-events.c | 45 +++++++++++++++-----
tools/perf/util/mem-events.h | 3 +-
9 files changed, 158 insertions(+), 31 deletions(-)
create mode 100644 tools/perf/arch/arm64/util/mem-events.c

--
2.17.1