summaryrefslogtreecommitdiffstats
path: root/Documentation/trace
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2019-06-10 14:02:42 -0400
committerJonathan Corbet <corbet@lwn.net>2019-06-14 16:43:21 -0400
commitcd84d63a2983ee2d386ff5a020c2c36562e4ef68 (patch)
treefbae13fd7481a6b7b070d1b9896de7340a2dfa4e /Documentation/trace
parent83e8b971f81cebe4f9a84cc76d328ac955b62a7a (diff)
Documentation: coresight: Update the generic device names
Update the documentation to reflect the new naming scheme with latest changes. Reported-by: Leo Yan <leo.yan@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/trace')
-rw-r--r--Documentation/trace/coresight.txt82
1 files changed, 67 insertions, 15 deletions
diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
index efbc832146e7..b027d61b27a6 100644
--- a/Documentation/trace/coresight.txt
+++ b/Documentation/trace/coresight.txt
@@ -188,6 +188,49 @@ specific to that component only. "Implementation defined" customisations are
188expected to be accessed and controlled using those entries. 188expected to be accessed and controlled using those entries.
189 189
190 190
191Device Naming scheme
192------------------------
193The devices that appear on the "coresight" bus were named the same as their
194parent devices, i.e, the real devices that appears on AMBA bus or the platform bus.
195Thus the names were based on the Linux Open Firmware layer naming convention,
196which follows the base physical address of the device followed by the device
197type. e.g:
198
199root:~# ls /sys/bus/coresight/devices/
200 20010000.etf 20040000.funnel 20100000.stm 22040000.etm
201 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu
202 20070000.etr 20120000.replicator 220c0000.funnel
203 23040000.etm 23140000.etm 23340000.etm
204
205However, with the introduction of ACPI support, the names of the real
206devices are a bit cryptic and non-obvious. Thus, a new naming scheme was
207introduced to use more generic names based on the type of the device. The
208following rules apply:
209
210 1) Devices that are bound to CPUs, are named based on the CPU logical
211 number.
212
213 e.g, ETM bound to CPU0 is named "etm0"
214
215 2) All other devices follow a pattern, "<device_type_prefix>N", where :
216
217 <device_type_prefix> - A prefix specific to the type of the device
218 N - a sequential number assigned based on the order
219 of probing.
220
221 e.g, tmc_etf0, tmc_etr0, funnel0, funnel1
222
223Thus, with the new scheme the devices could appear as :
224
225root:~# ls /sys/bus/coresight/devices/
226 etm0 etm1 etm2 etm3 etm4 etm5 funnel0
227 funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0
228
229Some of the examples below might refer to old naming scheme and some
230to the newer scheme, to give a confirmation that what you see on your
231system is not unexpected. One must use the "names" as they appear on
232the system under specified locations.
233
191How to use the tracer modules 234How to use the tracer modules
192----------------------------- 235-----------------------------
193 236
@@ -326,16 +369,25 @@ amount of processor cores), the "cs_etm" PMU will be listed only once.
326A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is 369A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is
327listed along with configuration options within forward slashes '/'. Since a 370listed along with configuration options within forward slashes '/'. Since a
328Coresight system will typically have more than one sink, the name of the sink to 371Coresight system will typically have more than one sink, the name of the sink to
329work with needs to be specified as an event option. Names for sink to choose 372work with needs to be specified as an event option.
330from are listed in sysFS under ($SYSFS)/bus/coresight/devices: 373On newer kernels the available sinks are listed in sysFS under:
374($SYSFS)/bus/event_source/devices/cs_etm/sinks/
375
376 root@localhost:/sys/bus/event_source/devices/cs_etm/sinks# ls
377 tmc_etf0 tmc_etr0 tpiu0
378
379On older kernels, this may need to be found from the list of coresight devices,
380available under ($SYSFS)/bus/coresight/devices/:
381
382 root:~# ls /sys/bus/coresight/devices/
383 etm0 etm1 etm2 etm3 etm4 etm5 funnel0
384 funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0
331 385
332 root@linaro-nano:~# ls /sys/bus/coresight/devices/ 386 root@linaro-nano:~# perf record -e cs_etm/@tmc_etr0/u --per-thread program
333 20010000.etf 20040000.funnel 20100000.stm 22040000.etm
334 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu
335 20070000.etr 20120000.replicator 220c0000.funnel
336 23040000.etm 23140000.etm 23340000.etm
337 387
338 root@linaro-nano:~# perf record -e cs_etm/@20070000.etr/u --per-thread program 388As mentioned above in section "Device Naming scheme", the names of the devices could
389look different from what is used in the example above. One must use the device names
390as it appears under the sysFS.
339 391
340The syntax within the forward slashes '/' is important. The '@' character 392The syntax within the forward slashes '/' is important. The '@' character
341tells the parser that a sink is about to be specified and that this is the sink 393tells the parser that a sink is about to be specified and that this is the sink
@@ -352,7 +404,7 @@ perf can be used to record and analyze trace of programs.
352Execution can be recorded using 'perf record' with the cs_etm event, 404Execution can be recorded using 'perf record' with the cs_etm event,
353specifying the name of the sink to record to, e.g: 405specifying the name of the sink to record to, e.g:
354 406
355 perf record -e cs_etm/@20070000.etr/u --per-thread 407 perf record -e cs_etm/@tmc_etr0/u --per-thread
356 408
357The 'perf report' and 'perf script' commands can be used to analyze execution, 409The 'perf report' and 'perf script' commands can be used to analyze execution,
358synthesizing instruction and branch events from the instruction trace. 410synthesizing instruction and branch events from the instruction trace.
@@ -381,7 +433,7 @@ sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tuto
381 Bubble sorting array of 30000 elements 433 Bubble sorting array of 30000 elements
382 5910 ms 434 5910 ms
383 435
384 $ perf record -e cs_etm/@20070000.etr/u --per-thread taskset -c 2 ./sort 436 $ perf record -e cs_etm/@tmc_etr0/u --per-thread taskset -c 2 ./sort
385 Bubble sorting array of 30000 elements 437 Bubble sorting array of 30000 elements
386 12543 ms 438 12543 ms
387 [ perf record: Woken up 35 times to write data ] 439 [ perf record: Woken up 35 times to write data ]
@@ -405,7 +457,7 @@ than the program flow through the code.
405As with any other CoreSight component, specifics about the STM tracer can be 457As with any other CoreSight component, specifics about the STM tracer can be
406found in sysfs with more information on each entry being found in [1]: 458found in sysfs with more information on each entry being found in [1]:
407 459
408root@genericarmv8:~# ls /sys/bus/coresight/devices/20100000.stm 460root@genericarmv8:~# ls /sys/bus/coresight/devices/stm0
409enable_source hwevent_select port_enable subsystem uevent 461enable_source hwevent_select port_enable subsystem uevent
410hwevent_enable mgmt port_select traceid 462hwevent_enable mgmt port_select traceid
411root@genericarmv8:~# 463root@genericarmv8:~#
@@ -413,14 +465,14 @@ root@genericarmv8:~#
413Like any other source a sink needs to be identified and the STM enabled before 465Like any other source a sink needs to be identified and the STM enabled before
414being used: 466being used:
415 467
416root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20010000.etf/enable_sink 468root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
417root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20100000.stm/enable_source 469root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/stm0/enable_source
418 470
419From there user space applications can request and use channels using the devfs 471From there user space applications can request and use channels using the devfs
420interface provided for that purpose by the generic STM API: 472interface provided for that purpose by the generic STM API:
421 473
422root@genericarmv8:~# ls -l /dev/20100000.stm 474root@genericarmv8:~# ls -l /dev/stm0
423crw------- 1 root root 10, 61 Jan 3 18:11 /dev/20100000.stm 475crw------- 1 root root 10, 61 Jan 3 18:11 /dev/stm0
424root@genericarmv8:~# 476root@genericarmv8:~#
425 477
426Details on how to use the generic STM API can be found here [2]. 478Details on how to use the generic STM API can be found here [2].