This patchset provides a proposed infrastructure to allow for the automatic selection of a sink during CoreSight tracing operations.
Currently starting tracing using perf requires a sink selection on the command line:-
sudo ./perf record -e cs_etm/@tmc_etr0/ --per-thread uname -a
After this set the infrastructure will be able to select a default sink:-
sudo ./perf record -e cs_etm// --per-thread uname -a
This matches with the default operation provided with perf and intelpt.
The CoreSight infrastructure is updated with the concept of a sink_select_priority value used when sinks are registered with the system.
Where no sink is specified at the start of a trace session, the CoreSight system will walk the connection graph from the source ETM, to find a suitable sink using the first encountered highest priority device.
Sinks set a value during component registration, ETR the highest priority, ETB and ETF a lower priority. Thus the first ETR if present will be used, otherwise fallback to the first encountered ETF/ETB.
The automatic sink selection will also operate if an ETM is enabled using sysfs commands, and no sink is currently enabled.
Applied to Linux 5.7-rc3.
Changes since v1: 1) Dropped the device-tree attribute labelling of sinks for selection and implemented the priority schema preferring first encountered ETR, after mailing list discussions. 2) Added in sysfs support for auto sink selection.
Mike Leach (5): coresight: Add default sink selection to CoreSight base coresight: tmc: Add default sink selection priorities. coresight: etm: perf: Add default sink selection to etm perf coresight: sysfs: Allow select default sink on source enable. perf: cs-etm: Allow no CoreSight sink to be specified on command line
.../hwtracing/coresight/coresight-etm-perf.c | 20 ++++- drivers/hwtracing/coresight/coresight-priv.h | 2 + drivers/hwtracing/coresight/coresight-tmc.c | 5 ++ drivers/hwtracing/coresight/coresight.c | 87 ++++++++++++++++++- include/linux/coresight.h | 10 ++- tools/perf/arch/arm/util/cs-etm.c | 6 +- 6 files changed, 121 insertions(+), 9 deletions(-)