Hi,
This patchset adds support for user space decoding of CoreSight traces [1] of the ARM architecture. Kernel support for configuring CoreSight tracers and collect the hardware trace data in the auxtrace section of the perf.data file is already integrated [2]. The user space implementation mirrors to a large degree that of the Intel Processor Trace (PT) [3] implementation, except that the decoder library itself is separate from the perf tool sources, and is built and maintained as a separate open source project [4]. Instead, this patch set includes the necessary code and build settings to interfaces to the decoder library, as well as a "stub" or "null" library for the case when the perf tool is built without the library.
The decoder library interface code in this patch set only supports ETMv4 trace decoding, though the library itself supports a broader range. Future patches will add support for more versions of the ARM ETM trace encoding.
Changes from v2:
Changed patch sequence to enable packet dump (-D or --dump-raw-trace option) first. Then build up to full packet decode. Also added functions to the trace decoder library interface as they are referenced by the functions in the main coresight processing file and combined them in those patches.
Changes from v3:
Introduced functions in cs-etm-decoder.c at the same time they are referenced in cs-etm.c, and not waiting until the very end to change the build script to compile the full decoder library interface.
Changes from v4:
Removed function to directly read vmlinux file text section, instead relying on perf dso access functions.
Changes from v5:
Refactored cs-etm-decoder-stub.c so that the different parts are introduced when the corresponding parts in cs-etm-decoder.c are added.
Changed error returns in cs-etm-decoder.c to use enums as opposed to literals.
Changed handling of how memory access function is added to decoder library. Now, instead of adding for each MMAP2 entry and the kernel only one entry is added for the entire address space. The functionality is equivalent to the previous, except the code is simpler.
Changes from v6:
Removed stub library, instead replaced by conditionally using a static inline function in cs-etm.h when the decoder library is not available.
Tor Jeremiassen (22): perf tools: Add initial hooks for decoding coresight traces perf tools: Add processing of coresight metadata perf tools: Add coresight trace decoder library interface perf tools: Add data block processing function perf tools: Add etmv4i packet printing capability perf tools: Add decoder new and free perf tools: Add trace packet print for dump_trace option perf tools: Add code to process the auxtrace perf event perf tools: Add function to read data from dsos perf tools: Add mapping from cpu to cs_etm_queue perf tools: Add functions to allocate and free queues perf tools: Add functions to setup and initialize queues perf tools: Add functions to allocate and free queues perf tools: Add function to get trace data from aux buffer perf tools: Add function to run the trace decoder and process samples perf tools: Add functions to process queues and run the trace decoder perf tools: Add perf event processing perf tools: Add processing of queues when events are flushed perf tools: Add synth_events and supporting functions perf tools: Add function to clear the decoder packet buffer perf tools: Add functions for full etmv4i packet decode MAINTAINERS: Adding entry for CoreSight trace decoding
MAINTAINERS | 3 +- tools/perf/Makefile.config | 26 + tools/perf/util/Build | 6 + tools/perf/util/auxtrace.c | 2 + tools/perf/util/cs-etm-decoder/Build | 2 + tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 526 ++++++++++ tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 133 +++ tools/perf/util/cs-etm.c | 1179 +++++++++++++++++++++++ tools/perf/util/cs-etm.h | 50 + 9 files changed, 1926 insertions(+), 1 deletion(-) create mode 100644 tools/perf/util/cs-etm-decoder/Build create mode 100644 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c create mode 100644 tools/perf/util/cs-etm-decoder/cs-etm-decoder.h create mode 100644 tools/perf/util/cs-etm.c