[PATCH v2 0/6] coresight: Add format attribute for setting the timestamp interval

James Clark posted 6 patches 1 month, 3 weeks ago
There is a newer version of this series
Documentation/trace/coresight/coresight.rst        |  14 +++
drivers/hwtracing/coresight/coresight-etm-perf.c   |  13 ++-
drivers/hwtracing/coresight/coresight-etm4x-core.c | 110 +++++++++++++--------
drivers/hwtracing/coresight/coresight-etm4x.h      |  86 ++++++++++------
4 files changed, 151 insertions(+), 72 deletions(-)
[PATCH v2 0/6] coresight: Add format attribute for setting the timestamp interval
Posted by James Clark 1 month, 3 weeks ago
Do some cleanups then add a new format attribute to set the timestamp
interval for ETMv4 in Perf mode. The current interval is too high for
most use cases, and particularly on the FVP the number of timestamps
generated is excessive.

Although it would be good to make only SYNC timestamps the default and
have counter timestamps opt-in, this would be a breaking change. We
can always do that later, or disable counter timestamps from Perf.

This is added as an event format attribute, rather than a Coresight
config because it's something that the driver is already configuring
automatically in Perf mode with any unused counter, so it's not possible
to modify this with a config.

Applies to coresight/next

Signed-off-by: James Clark <james.clark@linaro.org>
---
Changes in v2:
- Only show the attribute for ETMv4 to improve usability and fix the
  arm32 build error. Wrapping everything in
  IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) isn't ideal, but the -perf.c
  file is shared between ETMv3 and ETMv4, and there is already precedent
  for doing it this way.
- Link to v1: https://lore.kernel.org/r/20250811-james-cs-syncfreq-v1-0-b001cd6e3404@linaro.org

---
James Clark (6):
      coresight: Change syncfreq to be a u8
      coresight: Fix holes in struct etmv4_config
      coresight: Repack struct etmv4_drvdata
      coresight: Refactor etm4_config_timestamp_event()
      coresight: Add format attribute for setting the timestamp interval
      coresight: docs: Document etm4x ts_interval

 Documentation/trace/coresight/coresight.rst        |  14 +++
 drivers/hwtracing/coresight/coresight-etm-perf.c   |  13 ++-
 drivers/hwtracing/coresight/coresight-etm4x-core.c | 110 +++++++++++++--------
 drivers/hwtracing/coresight/coresight-etm4x.h      |  86 ++++++++++------
 4 files changed, 151 insertions(+), 72 deletions(-)
---
base-commit: a80198ba650f50d266d7fc4a6c5262df9970f9f2
change-id: 20250724-james-cs-syncfreq-7c2257a38ed3

Best regards,
-- 
James Clark <james.clark@linaro.org>
Re: [PATCH v2 0/6] coresight: Add format attribute for setting the timestamp interval
Posted by Leo Yan 3 days, 22 hours ago
On Thu, Aug 14, 2025 at 11:49:51AM +0100, James Clark wrote:

[...]

> This is added as an event format attribute, rather than a Coresight
> config because it's something that the driver is already configuring
> automatically in Perf mode with any unused counter, so it's not possible
> to modify this with a config.

Tested on Juno-r2 for this series:

  # /mnt/build/perf record -e cs_etm/timestamp=1,ts_level=15/ -- ls
  # /mnt/build/perf script -D | grep I_TIMESTAMP | wc

   1305   11745   83337

  # /mnt/build/perf record -e cs_etm/timestamp=1,ts_level=0/ -- ls
  # /mnt/build/perf script -D | grep I_TIMESTAMP | wc

   120668 1086012 7705024

We can see a small counter (2 ^ 0 = 1) that records significant
timestamp packets.

Tested-by: Leo Yan <leo.yan@arm.com>