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(-)
--
2.17.1
OpenCSD version v0.14.0 adds in a new output element. This is represented
by a new value in the generic element type enum, which must be added to
the handling code in perf cs-etm-decoder to prevent build errors due to
build options on the perf project.
This element is not currently used by the perf decoder.
Perf build feature test updated to require a minimum of 0.14.0
Tested on Linux 5.7-rc3.
Signed-off-by: Mike Leach <mike.leach(a)linaro.org>
---
tools/build/feature/test-libopencsd.c | 4 ++--
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/build/feature/test-libopencsd.c b/tools/build/feature/test-libopencsd.c
index 2b0e02c38870..1547bc2c0950 100644
--- a/tools/build/feature/test-libopencsd.c
+++ b/tools/build/feature/test-libopencsd.c
@@ -4,9 +4,9 @@
/*
* Check OpenCSD library version is sufficient to provide required features
*/
-#define OCSD_MIN_VER ((0 << 16) | (11 << 8) | (0))
+#define OCSD_MIN_VER ((0 << 16) | (14 << 8) | (0))
#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.11.0 is required"
+#error "OpenCSD >= 0.14.0 is required"
#endif
int main(void)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
index cd92a99eb89d..cd007cc9c283 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -564,6 +564,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
resp = cs_etm_decoder__set_tid(etmq, packet_queue,
elem, trace_chan_id);
break;
+ /* Unused packet types */
+ case OCSD_GEN_TRC_ELEM_I_RANGE_NOPATH:
case OCSD_GEN_TRC_ELEM_ADDR_NACC:
case OCSD_GEN_TRC_ELEM_CYCLE_COUNT:
case OCSD_GEN_TRC_ELEM_ADDR_UNKNOWN:
--
2.17.1
Adds in power management for CPU bound CTI devices:
i) CPU Hotplug - registers a new notifier for CPU start and stop events.
ii) CPU idle PM event notifier to handle PM_ENTER, PM_ENTER_FAILED and
PM_EXIT events.
Tested with DB410c on Linux 5.7-rc3.
Rebased onto coresight/next
Changes since V1: (requested by Mathieu).
1) Split into separate patches for CPU pm and CPU hotplug handling.
2) Enable on hotplug has a specific function to enable the hardware,
while leaving the enable reference counts unchanged.
Mike Leach (2):
coresight: cti: Add CPU Hotplug handling to CTI driver.
coresight: cti: Add CPU idle pm notifer to CTI devices.
drivers/hwtracing/coresight/coresight-cti.c | 173 ++++++++++++++++++++
include/linux/cpuhotplug.h | 1 +
2 files changed, 174 insertions(+)
--
2.17.1
From: Mike Leach <mike.leach(a)linaro.org>
OpenCSD version v0.14.0 adds in a new output element. This is represented
by a new value in the generic element type enum, which must be added to
the handling code in perf cs-etm-decoder to prevent build errors due to
build options on the perf project.
This element is not currently used by the perf decoder.
Perf build feature test updated to require a minimum of 0.14.0
Tested on Linux 5.7-rc3.
Signed-off-by: Mike Leach <mike.leach(a)linaro.org>
Reviewed-by: Leo Yan <leo.yan(a)linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier(a)linaro.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose(a)arm.com>
Cc: coresight(a)lists.linaro.org
Cc: linux-arm-kernel(a)lists.infradead.org
Link: http://lore.kernel.org/lkml/20200501143615.1180-1-mike.leach@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
---
tools/build/feature/test-libopencsd.c | 4 ++--
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/build/feature/test-libopencsd.c b/tools/build/feature/test-libopencsd.c
index 2b0e02c38870..1547bc2c0950 100644
--- a/tools/build/feature/test-libopencsd.c
+++ b/tools/build/feature/test-libopencsd.c
@@ -4,9 +4,9 @@
/*
* Check OpenCSD library version is sufficient to provide required features
*/
-#define OCSD_MIN_VER ((0 << 16) | (11 << 8) | (0))
+#define OCSD_MIN_VER ((0 << 16) | (14 << 8) | (0))
#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.11.0 is required"
+#error "OpenCSD >= 0.14.0 is required"
#endif
int main(void)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
index cd92a99eb89d..cd007cc9c283 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -564,6 +564,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
resp = cs_etm_decoder__set_tid(etmq, packet_queue,
elem, trace_chan_id);
break;
+ /* Unused packet types */
+ case OCSD_GEN_TRC_ELEM_I_RANGE_NOPATH:
case OCSD_GEN_TRC_ELEM_ADDR_NACC:
case OCSD_GEN_TRC_ELEM_CYCLE_COUNT:
case OCSD_GEN_TRC_ELEM_ADDR_UNKNOWN:
--
2.21.1
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 to allow the concept of a
"principal sink". For any given source there could be multiple possible sinks
available for selection. However, there are no good programmatic ways to
determine the optimal sink for a given topolgy. For any given rule
(e.g. first sink found, first ETR, last ETR), there exists a possible platform
/ topology that will not be suitable.
Therefore, we select the principal sink using a property in the device tree.
This allows the routine to select the best possible for the situation.
The only rule for selecting such sinks, is that there should only be one
principal sink marked for any given source, across all possible paths from
that source to any sinks. (if this rule is violated then the first found
will be used)
Therefore to select a sink, we start with the source, and walk the child
connections until a sink marked as a principal sink is found.
Applied to Linux 5.7-rc1 (with dts updates 1,2), tested on Juno / DB410
Note A: Moving forward to topologies which have groups of sources going to
dedicated sinks e.g. multisocket / multicluster where each socket / cluster
has a sink, then multiple sinks can be marked as principal sink, one for each
cluster. The same applies to 1:1 ETM:sink topolgy were each sink will be marked.
Note B: The current set does not auto-select when using sysfs, but I believe this could
easily be added.
[1] https://lists.linaro.org/pipermail/coresight/2020-April/003819.html
[2] https://lists.linaro.org/pipermail/coresight/2020-April/003821.html
Mike Leach (5):
coresight: Add principal sink handling to CoreSight base
coresight: tmc: Add principal sink attribute detection
coresight: etm: perf: Add default sink selection to etm perf
perf: cs-etm: Allow no CoreSight sink to be specified on command line
dt-bindings: arm: qcom: Add CoreSight principal sink select parameters
arch/arm64/boot/dts/arm/juno-base.dtsi | 1 +
arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 +
.../hwtracing/coresight/coresight-etm-perf.c | 20 +++++++++--
drivers/hwtracing/coresight/coresight-priv.h | 2 ++
drivers/hwtracing/coresight/coresight-tmc.c | 9 +++++
drivers/hwtracing/coresight/coresight.c | 34 +++++++++++++++++++
include/linux/coresight.h | 7 ++++
tools/perf/arch/arm/util/cs-etm.c | 6 ++--
8 files changed, 74 insertions(+), 6 deletions(-)
--
2.17.1