diff mbox series

[v5,5/5] documentation: coresight: Update CoreSight document for default sink.

Message ID 20200616164006.15309-6-mike.leach@linaro.org (mailing list archive)
State New, archived
Headers show
Series Update CoreSight infrastructure to select a default sink. | expand

Commit Message

Mike Leach June 16, 2020, 4:40 p.m. UTC
Updates the CoreSight documentation to cover the use of default sinks for
both perf and sysfs operations.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
---
 Documentation/trace/coresight/coresight.rst | 48 +++++++++++++++------
 1 file changed, 34 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/trace/coresight/coresight.rst
index 0b73acb44efa..917d89f74c2e 100644
--- a/Documentation/trace/coresight/coresight.rst
+++ b/Documentation/trace/coresight/coresight.rst
@@ -341,17 +341,18 @@  provide details on using both methods.
 1) Using the sysFS interface:
 
 Before trace collection can start, a coresight sink needs to be identified.
-There is no limit on the amount of sinks (nor sources) that can be enabled at
-any given moment.  As a generic operation, all device pertaining to the sink
-class will have an "active" entry in sysfs::
+There is no limit on the amount of sources and sinks that can be enabled at
+any given moment. However, any source will only trace into a single sink.
+As a generic operation, all device pertaining to the sink class will have an
+"active" entry in sysfs::
 
     root:/sys/bus/coresight/devices# ls
-    replicator  20030000.tpiu    2201c000.ptm  2203c000.etm  2203e000.etm
-    20010000.etb         20040000.funnel  2201d000.ptm  2203d000.etm
-    root:/sys/bus/coresight/devices# ls 20010000.etb
+    replicator0  tpiu0  ptm0  etm2  etm3
+    etb0  funnel0  ptm1  etm4
+    root:/sys/bus/coresight/devices# ls etb0
     enable_sink  status  trigger_cntr
-    root:/sys/bus/coresight/devices# echo 1 > 20010000.etb/enable_sink
-    root:/sys/bus/coresight/devices# cat 20010000.etb/enable_sink
+    root:/sys/bus/coresight/devices# echo 1 > etb0/enable_sink
+    root:/sys/bus/coresight/devices# cat etb0/enable_sink
     1
     root:/sys/bus/coresight/devices#
 
@@ -360,10 +361,10 @@  comparator with "_stext" and "_etext", essentially tracing any instruction
 that falls within that range.  As such "enabling" a source will immediately
 trigger a trace capture::
 
-    root:/sys/bus/coresight/devices# echo 1 > 2201c000.ptm/enable_source
-    root:/sys/bus/coresight/devices# cat 2201c000.ptm/enable_source
+    root:/sys/bus/coresight/devices# echo 1 > ptm0/enable_source
+    root:/sys/bus/coresight/devices# cat ptm0/enable_source
     1
-    root:/sys/bus/coresight/devices# cat 20010000.etb/status
+    root:/sys/bus/coresight/devices# cat etb0/status
     Depth:          0x2000
     Status:         0x1
     RAM read ptr:   0x0
@@ -376,13 +377,22 @@  trigger a trace capture::
 
 Trace collection is stopped the same way::
 
-    root:/sys/bus/coresight/devices# echo 0 > 2201c000.ptm/enable_source
+    root:/sys/bus/coresight/devices# echo 0 > ptm0/enable_source
     root:/sys/bus/coresight/devices#
 
+If no sink is enabled before the source is enabled, then a default sink will
+be selected and enabled automatically. Once the source is disabled, then the
+sink used can be read from <source>/last_sink.::
+
+    root:/sys/bus/coresight/devices# echo 1 > ptm0/enable_source
+    root:/sys/bus/coresight/devices# echo 0 > ptm0/enable_source
+    root:/sys/bus/coresight/devices# cat ptm0/last_sink
+    etb0
+    root:/sys/bus/coresight/devices# echo 0 > etb0/enable_sink
+
 The content of the ETB buffer can be harvested directly from /dev::
 
-    root:/sys/bus/coresight/devices# dd if=/dev/20010000.etb \
-    of=~/cstrace.bin
+    root:/sys/bus/coresight/devices# dd if=/dev/etb0 of=~/cstrace.bin
     64+0 records in
     64+0 records out
     32768 bytes (33 kB) copied, 0.00125258 s, 26.2 MB/s
@@ -490,6 +500,16 @@  The syntax within the forward slashes '/' is important.  The '@' character
 tells the parser that a sink is about to be specified and that this is the sink
 to use for the trace session.
 
+Alternatively, if no sink name is given between the //, then the CoreSight
+system will select a default sink::
+
+	root@linaro-nano:~# perf record -e cs_etm//u --per-thread program
+
+The system selects a sink by searching connection path from the source ETM to
+any sink that is on the path.The system will prefer ETR devices over ETB/ETF,
+and where two of the same type are found, the closest to the ETM, in terms of
+connection links.
+
 More information on the above and other example on how to use Coresight with
 the perf tools can be found in the "HOWTO.md" file of the openCSD gitHub
 repository [#third]_.