LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 0/3] coresight: Refresh documenation 
@ 2018-04-17 16:08 Mathieu Poirier
  2018-04-17 16:08 ` [PATCH v2 1/3] coresight: Remove obsolete reference to "owner" in CoreSight descriptor Mathieu Poirier
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mathieu Poirier @ 2018-04-17 16:08 UTC (permalink / raw)
  To: linux-arm-kernel, corbet; +Cc: linux-doc, linux-kernel, rdunlap, Ben.Gainey

Now that the perf tools CoreSight support is upstream this set adds
documentation to go with it and move things around so that topics 
are located together.

--------
Changes for V2:
* Addressed grammatical problems highlighted by Randy

Mathieu Poirier (3):
  coresight: Remove obsolete reference to "owner" in CoreSight
    descriptor
  coresight: Add section for integration with the perf tools
  coresight: Grouping all perf tools oriented section together

 Documentation/trace/coresight.txt | 103 +++++++++++++++++++++++++++-----------
 1 file changed, 75 insertions(+), 28 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] coresight: Remove obsolete reference to "owner" in CoreSight descriptor
  2018-04-17 16:08 [PATCH v2 0/3] coresight: Refresh documenation Mathieu Poirier
@ 2018-04-17 16:08 ` Mathieu Poirier
  2018-04-17 16:08 ` [PATCH v2 2/3] coresight: Add section for integration with the perf tools Mathieu Poirier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2018-04-17 16:08 UTC (permalink / raw)
  To: linux-arm-kernel, corbet; +Cc: linux-doc, linux-kernel, rdunlap, Ben.Gainey

Field "owner" of struct coresight_desc has been removed a while back but
the documentation was not updated to reflect the changes.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 Documentation/trace/coresight.txt | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
index 6f0120c3a4f1..710c75b6c73f 100644
--- a/Documentation/trace/coresight.txt
+++ b/Documentation/trace/coresight.txt
@@ -187,9 +187,6 @@ that can be performed on them (see "struct coresight_ops").  The
 specific to that component only.  "Implementation defined" customisations are
 expected to be accessed and controlled using those entries.
 
-Last but not least, "struct module *owner" is expected to be set to reflect
-the information carried in "THIS_MODULE".
-
 How to use the tracer modules
 -----------------------------
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] coresight: Add section for integration with the perf tools
  2018-04-17 16:08 [PATCH v2 0/3] coresight: Refresh documenation Mathieu Poirier
  2018-04-17 16:08 ` [PATCH v2 1/3] coresight: Remove obsolete reference to "owner" in CoreSight descriptor Mathieu Poirier
@ 2018-04-17 16:08 ` Mathieu Poirier
  2018-04-17 17:26   ` Randy Dunlap
  2018-04-17 16:08 ` [PATCH v2 3/3] coresight: Grouping all perf tools oriented section together Mathieu Poirier
  2018-04-27 23:00 ` [PATCH v2 0/3] coresight: Refresh documenation Jonathan Corbet
  3 siblings, 1 reply; 6+ messages in thread
From: Mathieu Poirier @ 2018-04-17 16:08 UTC (permalink / raw)
  To: linux-arm-kernel, corbet; +Cc: linux-doc, linux-kernel, rdunlap, Ben.Gainey

Adding a section that document how to use the Coresight framework and
drivers from the perf tools.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 Documentation/trace/coresight.txt | 52 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
index 710c75b6c73f..ab0d0f2d5cec 100644
--- a/Documentation/trace/coresight.txt
+++ b/Documentation/trace/coresight.txt
@@ -187,10 +187,19 @@ that can be performed on them (see "struct coresight_ops").  The
 specific to that component only.  "Implementation defined" customisations are
 expected to be accessed and controlled using those entries.
 
+
 How to use the tracer modules
 -----------------------------
 
-Before trace collection can start, a coresight sink needs to be identify.
+There are two ways to use the Coresight framework: 1) using the perf cmd line
+tools and 2) interacting directly with the Coresight devices using the sysFS
+interface.  Preference is given to the former as using the sysFS interface
+requires a deep understanding of the Coresight HW.  The following sections
+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:
@@ -295,6 +304,47 @@ Instruction     13570831        0x8026B584      E28DD00C        false   ADD
 Instruction     0       0x8026B588      E8BD8000        true    LDM      sp!,{pc}
 Timestamp                                       Timestamp: 17107041535
 
+2) Using perf framework:
+
+Coresight tracers are represented using the Perf framework's Performance
+Monitoring Unit (PMU) abstraction.  As such the perf framework takes charge of
+controlling when tracing gets enabled based on when the process of interest is
+scheduled.  When configured in a system, Coresight PMUs will be listed when
+queried by the perf command line tool:
+
+	linaro@linaro-nano:~$ ./perf list pmu
+
+		List of pre-defined events (to be used in -e):
+
+		cs_etm//                                    [Kernel PMU event]
+
+	linaro@linaro-nano:~$
+
+Regardless of the number of tracers available in a system (usually equal to the
+amount of processor cores), the "cs_etm" PMU will be listed only once.
+
+A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is
+listed along with configuration options within forward slashes '/'.  Since a
+Coresight system will typically have more than one sink, the name of the sink to
+work with needs to be specified as an event option.  Names for sink to choose
+from are listed in sysFS under ($SYSFS)/bus/coresight/devices:
+
+	root@linaro-nano:~# ls /sys/bus/coresight/devices/
+		20010000.etf   20040000.funnel  20100000.stm  22040000.etm
+		22140000.etm  230c0000.funnel  23240000.etm 20030000.tpiu
+		20070000.etr     20120000.replicator  220c0000.funnel
+		23040000.etm  23140000.etm     23340000.etm
+
+	root@linaro-nano:~# perf record -e cs_etm/@20070000.etr/u --per-thread program
+
+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.
+
+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 [3].
+
 How to use the STM module
 -------------------------
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] coresight: Grouping all perf tools oriented section together
  2018-04-17 16:08 [PATCH v2 0/3] coresight: Refresh documenation Mathieu Poirier
  2018-04-17 16:08 ` [PATCH v2 1/3] coresight: Remove obsolete reference to "owner" in CoreSight descriptor Mathieu Poirier
  2018-04-17 16:08 ` [PATCH v2 2/3] coresight: Add section for integration with the perf tools Mathieu Poirier
@ 2018-04-17 16:08 ` Mathieu Poirier
  2018-04-27 23:00 ` [PATCH v2 0/3] coresight: Refresh documenation Jonathan Corbet
  3 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2018-04-17 16:08 UTC (permalink / raw)
  To: linux-arm-kernel, corbet; +Cc: linux-doc, linux-kernel, rdunlap, Ben.Gainey

This patch groups together section pertaining to the perf tools.  That way
everything is at the same place rather than spread out.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 Documentation/trace/coresight.txt | 72 +++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
index ab0d0f2d5cec..1d74ad0202b6 100644
--- a/Documentation/trace/coresight.txt
+++ b/Documentation/trace/coresight.txt
@@ -345,42 +345,7 @@ 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 [3].
 
-How to use the STM module
--------------------------
-
-Using the System Trace Macrocell module is the same as the tracers - the only
-difference is that clients are driving the trace capture rather
-than the program flow through the code.
-
-As with any other CoreSight component, specifics about the STM tracer can be
-found in sysfs with more information on each entry being found in [1]:
-
-root@genericarmv8:~# ls /sys/bus/coresight/devices/20100000.stm
-enable_source   hwevent_select  port_enable     subsystem       uevent
-hwevent_enable  mgmt            port_select     traceid
-root@genericarmv8:~#
-
-Like any other source a sink needs to be identified and the STM enabled before
-being used:
-
-root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20010000.etf/enable_sink
-root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20100000.stm/enable_source
-
-From there user space applications can request and use channels using the devfs
-interface provided for that purpose by the generic STM API:
-
-root@genericarmv8:~# ls -l /dev/20100000.stm
-crw-------    1 root     root       10,  61 Jan  3 18:11 /dev/20100000.stm
-root@genericarmv8:~#
-
-Details on how to use the generic STM API can be found here [2].
-
-[1]. Documentation/ABI/testing/sysfs-bus-coresight-devices-stm
-[2]. Documentation/trace/stm.txt
-
-
-Using perf tools
-----------------
+2.1) AutoFDO analysis using the perf tools:
 
 perf can be used to record and analyze trace of programs.
 
@@ -428,3 +393,38 @@ sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tuto
 	$ taskset -c 2 ./sort_autofdo
 	Bubble sorting array of 30000 elements
 	5806 ms
+
+
+How to use the STM module
+-------------------------
+
+Using the System Trace Macrocell module is the same as the tracers - the only
+difference is that clients are driving the trace capture rather
+than the program flow through the code.
+
+As with any other CoreSight component, specifics about the STM tracer can be
+found in sysfs with more information on each entry being found in [1]:
+
+root@genericarmv8:~# ls /sys/bus/coresight/devices/20100000.stm
+enable_source   hwevent_select  port_enable     subsystem       uevent
+hwevent_enable  mgmt            port_select     traceid
+root@genericarmv8:~#
+
+Like any other source a sink needs to be identified and the STM enabled before
+being used:
+
+root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20010000.etf/enable_sink
+root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20100000.stm/enable_source
+
+From there user space applications can request and use channels using the devfs
+interface provided for that purpose by the generic STM API:
+
+root@genericarmv8:~# ls -l /dev/20100000.stm
+crw-------    1 root     root       10,  61 Jan  3 18:11 /dev/20100000.stm
+root@genericarmv8:~#
+
+Details on how to use the generic STM API can be found here [2].
+
+[1]. Documentation/ABI/testing/sysfs-bus-coresight-devices-stm
+[2]. Documentation/trace/stm.txt
+[3]. https://github.com/Linaro/perf-opencsd
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] coresight: Add section for integration with the perf tools
  2018-04-17 16:08 ` [PATCH v2 2/3] coresight: Add section for integration with the perf tools Mathieu Poirier
@ 2018-04-17 17:26   ` Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2018-04-17 17:26 UTC (permalink / raw)
  To: Mathieu Poirier, linux-arm-kernel, corbet
  Cc: linux-doc, linux-kernel, Ben.Gainey

On 04/17/18 09:08, Mathieu Poirier wrote:
> Adding a section that document how to use the Coresight framework and
> drivers from the perf tools.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  Documentation/trace/coresight.txt | 52 ++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 51 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
> index 710c75b6c73f..ab0d0f2d5cec 100644
> --- a/Documentation/trace/coresight.txt
> +++ b/Documentation/trace/coresight.txt
> @@ -187,10 +187,19 @@ that can be performed on them (see "struct coresight_ops").  The
>  specific to that component only.  "Implementation defined" customisations are
>  expected to be accessed and controlled using those entries.
>  
> +
>  How to use the tracer modules
>  -----------------------------
>  
> -Before trace collection can start, a coresight sink needs to be identify.
> +There are two ways to use the Coresight framework: 1) using the perf cmd line
> +tools and 2) interacting directly with the Coresight devices using the sysFS
> +interface.  Preference is given to the former as using the sysFS interface
> +requires a deep understanding of the Coresight HW.  The following sections
> +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:
> @@ -295,6 +304,47 @@ Instruction     13570831        0x8026B584      E28DD00C        false   ADD
>  Instruction     0       0x8026B588      E8BD8000        true    LDM      sp!,{pc}
>  Timestamp                                       Timestamp: 17107041535
>  
> +2) Using perf framework:
> +
> +Coresight tracers are represented using the Perf framework's Performance
> +Monitoring Unit (PMU) abstraction.  As such the perf framework takes charge of
> +controlling when tracing gets enabled based on when the process of interest is
> +scheduled.  When configured in a system, Coresight PMUs will be listed when
> +queried by the perf command line tool:
> +
> +	linaro@linaro-nano:~$ ./perf list pmu
> +
> +		List of pre-defined events (to be used in -e):
> +
> +		cs_etm//                                    [Kernel PMU event]
> +
> +	linaro@linaro-nano:~$
> +
> +Regardless of the number of tracers available in a system (usually equal to the
> +amount of processor cores), the "cs_etm" PMU will be listed only once.
> +
> +A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is
> +listed along with configuration options within forward slashes '/'.  Since a
> +Coresight system will typically have more than one sink, the name of the sink to
> +work with needs to be specified as an event option.  Names for sink to choose
> +from are listed in sysFS under ($SYSFS)/bus/coresight/devices:
> +
> +	root@linaro-nano:~# ls /sys/bus/coresight/devices/
> +		20010000.etf   20040000.funnel  20100000.stm  22040000.etm
> +		22140000.etm  230c0000.funnel  23240000.etm 20030000.tpiu
> +		20070000.etr     20120000.replicator  220c0000.funnel
> +		23040000.etm  23140000.etm     23340000.etm
> +
> +	root@linaro-nano:~# perf record -e cs_etm/@20070000.etr/u --per-thread program
> +
> +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.
> +
> +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 [3].
> +
>  How to use the STM module
>  -------------------------
>  
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/3] coresight: Refresh documenation
  2018-04-17 16:08 [PATCH v2 0/3] coresight: Refresh documenation Mathieu Poirier
                   ` (2 preceding siblings ...)
  2018-04-17 16:08 ` [PATCH v2 3/3] coresight: Grouping all perf tools oriented section together Mathieu Poirier
@ 2018-04-27 23:00 ` Jonathan Corbet
  3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Corbet @ 2018-04-27 23:00 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: linux-arm-kernel, linux-doc, linux-kernel, rdunlap, Ben.Gainey

On Tue, 17 Apr 2018 10:08:04 -0600
Mathieu Poirier <mathieu.poirier@linaro.org> wrote:

> Now that the perf tools CoreSight support is upstream this set adds
> documentation to go with it and move things around so that topics 
> are located together.

I've applied the set, thanks.

jon

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-27 23:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 16:08 [PATCH v2 0/3] coresight: Refresh documenation Mathieu Poirier
2018-04-17 16:08 ` [PATCH v2 1/3] coresight: Remove obsolete reference to "owner" in CoreSight descriptor Mathieu Poirier
2018-04-17 16:08 ` [PATCH v2 2/3] coresight: Add section for integration with the perf tools Mathieu Poirier
2018-04-17 17:26   ` Randy Dunlap
2018-04-17 16:08 ` [PATCH v2 3/3] coresight: Grouping all perf tools oriented section together Mathieu Poirier
2018-04-27 23:00 ` [PATCH v2 0/3] coresight: Refresh documenation Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).