diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2019-06-10 14:02:42 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2019-06-14 16:43:21 -0400 |
commit | cd84d63a2983ee2d386ff5a020c2c36562e4ef68 (patch) | |
tree | fbae13fd7481a6b7b070d1b9896de7340a2dfa4e /Documentation/trace | |
parent | 83e8b971f81cebe4f9a84cc76d328ac955b62a7a (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.txt | 82 |
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 | |||
188 | expected to be accessed and controlled using those entries. | 188 | expected to be accessed and controlled using those entries. |
189 | 189 | ||
190 | 190 | ||
191 | Device Naming scheme | ||
192 | ------------------------ | ||
193 | The devices that appear on the "coresight" bus were named the same as their | ||
194 | parent devices, i.e, the real devices that appears on AMBA bus or the platform bus. | ||
195 | Thus the names were based on the Linux Open Firmware layer naming convention, | ||
196 | which follows the base physical address of the device followed by the device | ||
197 | type. e.g: | ||
198 | |||
199 | root:~# 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 | |||
205 | However, with the introduction of ACPI support, the names of the real | ||
206 | devices are a bit cryptic and non-obvious. Thus, a new naming scheme was | ||
207 | introduced to use more generic names based on the type of the device. The | ||
208 | following 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 | |||
223 | Thus, with the new scheme the devices could appear as : | ||
224 | |||
225 | root:~# ls /sys/bus/coresight/devices/ | ||
226 | etm0 etm1 etm2 etm3 etm4 etm5 funnel0 | ||
227 | funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0 | ||
228 | |||
229 | Some of the examples below might refer to old naming scheme and some | ||
230 | to the newer scheme, to give a confirmation that what you see on your | ||
231 | system is not unexpected. One must use the "names" as they appear on | ||
232 | the system under specified locations. | ||
233 | |||
191 | How to use the tracer modules | 234 | How 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. | |||
326 | A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is | 369 | A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is |
327 | listed along with configuration options within forward slashes '/'. Since a | 370 | listed along with configuration options within forward slashes '/'. Since a |
328 | Coresight system will typically have more than one sink, the name of the sink to | 371 | Coresight system will typically have more than one sink, the name of the sink to |
329 | work with needs to be specified as an event option. Names for sink to choose | 372 | work with needs to be specified as an event option. |
330 | from are listed in sysFS under ($SYSFS)/bus/coresight/devices: | 373 | On 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 | |||
379 | On older kernels, this may need to be found from the list of coresight devices, | ||
380 | available 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 | 388 | As mentioned above in section "Device Naming scheme", the names of the devices could |
389 | look different from what is used in the example above. One must use the device names | ||
390 | as it appears under the sysFS. | ||
339 | 391 | ||
340 | The syntax within the forward slashes '/' is important. The '@' character | 392 | The syntax within the forward slashes '/' is important. The '@' character |
341 | tells the parser that a sink is about to be specified and that this is the sink | 393 | tells 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. | |||
352 | Execution can be recorded using 'perf record' with the cs_etm event, | 404 | Execution can be recorded using 'perf record' with the cs_etm event, |
353 | specifying the name of the sink to record to, e.g: | 405 | specifying 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 | ||
357 | The 'perf report' and 'perf script' commands can be used to analyze execution, | 409 | The 'perf report' and 'perf script' commands can be used to analyze execution, |
358 | synthesizing instruction and branch events from the instruction trace. | 410 | synthesizing 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. | |||
405 | As with any other CoreSight component, specifics about the STM tracer can be | 457 | As with any other CoreSight component, specifics about the STM tracer can be |
406 | found in sysfs with more information on each entry being found in [1]: | 458 | found in sysfs with more information on each entry being found in [1]: |
407 | 459 | ||
408 | root@genericarmv8:~# ls /sys/bus/coresight/devices/20100000.stm | 460 | root@genericarmv8:~# ls /sys/bus/coresight/devices/stm0 |
409 | enable_source hwevent_select port_enable subsystem uevent | 461 | enable_source hwevent_select port_enable subsystem uevent |
410 | hwevent_enable mgmt port_select traceid | 462 | hwevent_enable mgmt port_select traceid |
411 | root@genericarmv8:~# | 463 | root@genericarmv8:~# |
@@ -413,14 +465,14 @@ root@genericarmv8:~# | |||
413 | Like any other source a sink needs to be identified and the STM enabled before | 465 | Like any other source a sink needs to be identified and the STM enabled before |
414 | being used: | 466 | being used: |
415 | 467 | ||
416 | root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20010000.etf/enable_sink | 468 | root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink |
417 | root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20100000.stm/enable_source | 469 | root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/stm0/enable_source |
418 | 470 | ||
419 | From there user space applications can request and use channels using the devfs | 471 | From there user space applications can request and use channels using the devfs |
420 | interface provided for that purpose by the generic STM API: | 472 | interface provided for that purpose by the generic STM API: |
421 | 473 | ||
422 | root@genericarmv8:~# ls -l /dev/20100000.stm | 474 | root@genericarmv8:~# ls -l /dev/stm0 |
423 | crw------- 1 root root 10, 61 Jan 3 18:11 /dev/20100000.stm | 475 | crw------- 1 root root 10, 61 Jan 3 18:11 /dev/stm0 |
424 | root@genericarmv8:~# | 476 | root@genericarmv8:~# |
425 | 477 | ||
426 | Details on how to use the generic STM API can be found here [2]. | 478 | Details on how to use the generic STM API can be found here [2]. |