Hi,
I'm Sending this sysfs addition to the etm4x driver in order to expose
the timestamp source of the trace (given by the TRFCR_ELx.TS register).
As mentioned in [1/2], having this information is useful for assigning
Kernel times to the perf samples.
Thanks,
German
German Gomez (3):
coresight: etm4x: Expose default timestamp source in sysfs
coresight: etm4x: docs: Add documentation for 'ts_source' sysfs
interface
perf cs_etm: Store ts_source in AUXTRACE_INFO fields
.../testing/sysfs-bus-coresight-devices-etm4x | 8 +++
.../coresight/coresight-etm4x-reference.rst | 14 ++++
arch/arm64/include/asm/sysreg.h | 1 +
.../coresight/coresight-etm4x-sysfs.c | 34 ++++++++++
tools/perf/arch/arm/util/cs-etm.c | 64 +++++++++++++++++--
tools/perf/util/cs-etm.c | 61 +++++++++---------
tools/perf/util/cs-etm.h | 13 +++-
7 files changed, 159 insertions(+), 36 deletions(-)
--
2.25.1
Sync sysfs documentation pages to include the new ts_source (timestamp
source) interface.
Signed-off-by: German Gomez <[email protected]>
---
.../ABI/testing/sysfs-bus-coresight-devices-etm4x | 8 ++++++++
.../trace/coresight/coresight-etm4x-reference.rst | 14 ++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
index 8e53a32f81505..19ac9d6d2f504 100644
--- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
+++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
@@ -516,3 +516,11 @@ Contact: Mathieu Poirier <[email protected]>
Description: (Read) Returns the number of special conditional P1 right-hand keys
that the trace unit can use (0x194). The value is taken
directly from the HW.
+
+What: /sys/bus/coresight/devices/etm<N>/ts_source
+Date: April 2022
+KernelVersion: 5.18
+Contact: Mathieu Poirier <[email protected]>
+Description: (Read) When FEAT_TRF is implemented, value of TRFCR_ELx.TS used for
+ trace session. Otherwise -1 indicates an unknown time source. Check
+ trcidr0.tssize to see if a global timestamp is available.
diff --git a/Documentation/trace/coresight/coresight-etm4x-reference.rst b/Documentation/trace/coresight/coresight-etm4x-reference.rst
index d25dfe86af9bf..f016c7c29429b 100644
--- a/Documentation/trace/coresight/coresight-etm4x-reference.rst
+++ b/Documentation/trace/coresight/coresight-etm4x-reference.rst
@@ -71,6 +71,20 @@ the ‘TRC’ prefix.
----
+:File: ``ts_source`` (ro)
+:Trace Registers: None.
+:Notes:
+ When FEAT_TRF is implemented, value of TRFCR_ELx.TS used for trace session. Otherwise -1
+ indicates an unknown time source. Check trcidr0.tssize to see if a global timestamp is
+ available.
+
+:Example:
+ ``$> cat ts_source``
+
+ ``$> 1``
+
+----
+
:File: ``addr_idx`` (rw)
:Trace Registers: None.
:Notes:
--
2.25.1
On Fri, Apr 29, 2022 at 01:31:00PM +0100, German Gomez wrote:
> Sync sysfs documentation pages to include the new ts_source (timestamp
> source) interface.
>
> Signed-off-by: German Gomez <[email protected]>
> ---
> .../ABI/testing/sysfs-bus-coresight-devices-etm4x | 8 ++++++++
> .../trace/coresight/coresight-etm4x-reference.rst | 14 ++++++++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
> index 8e53a32f81505..19ac9d6d2f504 100644
> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
> @@ -516,3 +516,11 @@ Contact: Mathieu Poirier <[email protected]>
> Description: (Read) Returns the number of special conditional P1 right-hand keys
> that the trace unit can use (0x194). The value is taken
> directly from the HW.
> +
> +What: /sys/bus/coresight/devices/etm<N>/ts_source
> +Date: April 2022
> +KernelVersion: 5.18
This would be 5.19 and a (likely) date of July 2022.
> +Contact: Mathieu Poirier <[email protected]>
Suzuki's name should also be added.
Thanks,
Mathieu
> +Description: (Read) When FEAT_TRF is implemented, value of TRFCR_ELx.TS used for
> + trace session. Otherwise -1 indicates an unknown time source. Check
> + trcidr0.tssize to see if a global timestamp is available.
> diff --git a/Documentation/trace/coresight/coresight-etm4x-reference.rst b/Documentation/trace/coresight/coresight-etm4x-reference.rst
> index d25dfe86af9bf..f016c7c29429b 100644
> --- a/Documentation/trace/coresight/coresight-etm4x-reference.rst
> +++ b/Documentation/trace/coresight/coresight-etm4x-reference.rst
> @@ -71,6 +71,20 @@ the ‘TRC’ prefix.
>
> ----
>
> +:File: ``ts_source`` (ro)
> +:Trace Registers: None.
> +:Notes:
> + When FEAT_TRF is implemented, value of TRFCR_ELx.TS used for trace session. Otherwise -1
> + indicates an unknown time source. Check trcidr0.tssize to see if a global timestamp is
> + available.
> +
> +:Example:
> + ``$> cat ts_source``
> +
> + ``$> 1``
> +
> +----
> +
> :File: ``addr_idx`` (rw)
> :Trace Registers: None.
> :Notes:
> --
> 2.25.1
>