On Wed, 6 Mar 2019 at 15:57, Mathieu Poirier mathieu.poirier@linaro.org wrote:
This patchset adds support for CPU-wide trace scenarios and as such, it is now possible to issue the following commands:
# perf record -e cs_etm/@20070000.etr/ -C 2,3 $COMMAND # perf record -e cs_etm/@20070000.etr/ -a $COMMAND
The above will trace all instructions executed by a given processor for as long as $COMMAND hasn't returned. The solution is designed to work for both 1:1 and N:1 source/sink topologies, though the former hasn't been tested for lack of access to HW.
Most of the changes revolve around allowing more than one event to use a sink when operated from perf. More specifically the first event to use a sink switches it on while the last one is tasked to aggregate traces and switching off the device.
This is the kernel part of the solution, with the user space portion to be released in a separate set. All the patches have been rebased on yesterday's linux next and hosted here[1]. Everything has been tested on Juno. I have not CC'ed the kernel mailing list because of the ongoing merge window.
I forgot to mention - in order for the feature to work kernel config CONFIG_PID_IN_CONTEXTIDR needs to be set. The config is accessible under "Kernel hacking" > "Write the current PID to the CONTEXTIDR register". Without it the tracers will not generate PE_CONTEXT packets, something that links the executing process with the perf thread mechanic and access to the memory map.
For the next revision I will fold the automatic selection of the define in the Kconfig.
Mathieu
Review and comments would be most appreciated.
Regards, Mathieu
[1]. https://git.linaro.org/people/mathieu.poirier/coresight.git/log/?h=next-2019...
Mathieu Poirier (20): coresight: pmu: Adding ITRACE property to cs_etm PMU coresight: etm4x: Add kernel configuration for CONTEXTID coresight: etm4x: Configure tracers to emit timestamps coresight: Adding return code to sink::disable() operation coresight: Move reference counting inside sink drivers coresight: Refactor sink::disable() functions coresight: Refactor sink::update() functions coresight: perf: Refactor function etm_setup_aux() coresight: perf: Refactor function free_event_data() coresight: Introduce the notion of process ID to the framework coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf() coresight: tmc-etr: Introduce the notion of process ID to ETR devices coresight: tmc-etr: Allow events to use the same ETR buffer coresight: tmc-etr: Add support for CPU-wide trace scenarios coresight: tmc-etf: Add support for CPU-wide trace scenarios coresight: etb10: Add support for CPU-wide trace scenarios coresight: Refactor sink::alloc_buffer() functions coresight: Add function coresight_sink_is_shared() coresight: tmc-etr: Make ETR aware of topology coresight: Use event->cpu to determine session type
drivers/hwtracing/coresight/coresight-etb10.c | 79 +++++- .../hwtracing/coresight/coresight-etm-perf.c | 47 +++- drivers/hwtracing/coresight/coresight-etm4x.c | 114 +++++++- drivers/hwtracing/coresight/coresight-priv.h | 1 + .../hwtracing/coresight/coresight-tmc-etf.c | 84 ++++-- .../hwtracing/coresight/coresight-tmc-etr.c | 265 +++++++++++++++--- drivers/hwtracing/coresight/coresight-tmc.c | 4 + drivers/hwtracing/coresight/coresight-tmc.h | 11 + drivers/hwtracing/coresight/coresight-tpiu.c | 9 +- drivers/hwtracing/coresight/coresight.c | 53 +++- include/linux/coresight-pmu.h | 2 + include/linux/coresight.h | 8 +- tools/include/linux/coresight-pmu.h | 2 + 13 files changed, 568 insertions(+), 111 deletions(-)
-- 2.17.1