Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH 0/9] tools/perf: Add interface to expose HTM trace data via perf
@ 2026-07-01  8:41 Athira Rajeev
  2026-07-01  8:41 ` [PATCH 1/9] tool/perf: Move auxtrace_record__init for powerpc-vpadtl as separate utility Athira Rajeev
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Athira Rajeev @ 2026-07-01  8:41 UTC (permalink / raw)
  To: acme, jolsa, adrian.hunter, maddy, irogers, namhyung
  Cc: linux-perf-users, linuxppc-dev, atrajeev, hbathini, tejas05,
	tshah, venkat88

H_HTM (Hardware Trace Macro) hypervisor call is an HCALL to export data
from Hardware Trace Macro (HTM) function. Patchset adds support for setup,
configuration and control of HTM functions as well as trace data
collection via perf PMU interface.

H_HTM is used as an interface for executing Hardware Trace Macro (HTM)
functions, including setup, configuration, control and dumping of the
HTM trace data. HTM operations can be controlled using the H_HTM hcall.
The hcall can be invoked for any core/chip of the system from within a
partition itself.

HTM perf interface usage:
The HTM (Hardware Trace Macro) perf interface enables collection and
analysis of hardware trace data from PowerPC systems. This interface
allows users to capture detailed execution traces for performance
analysis and debugging. The interface uses AUX infrastructure for
capturing of trace data.

Patch 1: Move auxtrace_record__init for powerpc-vpadtl as separate
utility
 - Refactor VPA-DTL auxtrace initialization into arch/powerpc/util/vpa-dtl.c
   to allow multiple PMUs to use auxtrace

Patch 2: Add CONFIG_AUXTRACE support for HTM pmu on powerpc
 - Enable HTM PMU to use AUX buffers with recording options, info callbacks,
   and PERF_AUXTRACE_POWERPC_HTM type

Patch 3: Add arch_record__collect_final_data to collect additional data
before closing the event
 - Introduce callback mechanism to capture remaining data after
   evlist__disable but before event removal

Patch 4: Add powerpc callback support for arch_record__collect_final_data
 - Implement HTM-specific callback to read trace data until perf_evsel__read
   returns zero indicating completion

Patch 5: Process htm auxtrace events and display in perf report -D
 - Add PERF_RECORD_AUXTRACE_INFO processing and write HTM trace data
   to htm.bin.nXpXcX files

Patch 6: Add HTM trace data processing and decoding support
 - Extract system memory configuration, write translation files, and integrate
   htmdecode for trace analysis

Patch 7: Add physical to logical address mapping for HTM traces
 - Map physical addresses from HTM traces to logical addresses using LPAR
   memory configuration from /proc/powerpc/lparcfg

Patch 8: Add event name as htm of PERF_TYPE_SYNTH type to present htm samples
 - Create synthetic HTM event with PERF_SYNTH_POWERPC_HTM config to display
   logical addresses in perf report

Patch 9: Add logical address in decoded nest traces
  - Translate physical to logical addresses in decoded output and create
    .l files for source code correlation

Link to tools side changes:
https://lore.kernel.org/linux-perf-users/20260701083806.79358-1-atrajeev@linux.ibm.com/

Event Configuration:
Use "perf record" with the htm PMU event. The event is configured using
named parameters that specify the target hardware location and trace type:

   - htm_type
     - Type of HTM trace to collect (bits 0-3)
   - nodeindex
     - Node index in the system topology (bits 4-11)
   - nodalchipindex
     - Chip index within the specified node (bits 12-19)
   - coreindexonchip
     - Core index on the specified chip (bits 20-27)

event: "config:0-27"
htm_type: "config:0-3"
nodeindex: "config:4-11"
nodalchipindex: "config:12-19"
coreindexonchip: "config:20-27"

1) nodeindex, nodalchipindex, coreindexonchip: this specifies
   which partition to configure the HTM for.
2) htmtype: specifies the type of HTM.

Event Syntax:
The event configuration uses named parameters::

   htm/nodeindex=N,nodalchipindex=C,coreindexonchip=R,htm_type=T/

Where:

- N = node index
- C = chip index within the node
- R = core index on the chip
- T = HTM type

Basic Usage Example:
To collect HTM trace data for a specific chip:
 # perf record -C 1 -e htm/nodalchipindex=2,nodeindex=0,htm_type=1/ <workload>

In this example:

- nodeindex=0: Target node 0
- nodalchipindex=2: Target chip 2 within node 0
- htm_type=1: HTM trace type 1

Output Files:
After running "perf record", the following files are generated:

   # ls htm.bin.*
   htm.bin.n0.p2.c0 htm.bin.n1.p3.c0  # Binary trace files

   # ls translation.*
   translation.n0.p2.c0  translation.n1.p3.c0  # Memory configuration files

These files contain:

- **htm.bin.*** - Raw HTM trace data in binary format
- **translation.*** - Memory address translation information for decoding

Trace Data Processing:
Process the collected trace data using perf script:

   # perf script -D

This command:

1. Reads the perf.data file
2. Decodes HTM trace data using translation files
3. Displays human-readable trace output

The decoder automatically:

- Translates physical addresses to logical addresses
- Creates decoded output files for analysis
- Correlates trace data with memory mappings

Here's a complete example of collecting and analyzing HTM traces:

   # Step 1: Collect trace data
   perf record -C 1 -e htm/nodalchipindex=2,nodeindex=0,htm_type=1/ sleep 5

   # Step 2: Verify output files
   ls htm.bin.*        # Binary trace files
   ls translation.*    # Memory configuration files
   ls perf.data        # Perf data file

   # Step 3: Decode and view traces
   perf script -D > decoded_trace.txt

   # Step 4: Analyze with perf report to see the hot logical address
   perf report

Thanks
Athira

Athira Rajeev (8):
  tool/perf: Move auxtrace_record__init for powerpc-vpadtl as separate
    utility
  tools/perf: Add CONFIG_AUXTRACE support for HTM pmu on powerpc
  tools/perf: Add arch_record__collect_final_data to collect additional
    data before closing the event
  tools/perf: Add powerpc callback support for
    arch_record__collect_final_data
  tools/perf: process htm auxtrace events and display in perf report -D
  perf tools powerpc: Add HTM trace data processing and decoding support
  tools/perf/powerpc: Add event name as htm of PERF_TYPE_SYNTH type to
    present htm samples
  tools/perf/powerpc: Add logical address in decoded nest traces

Tanushree Shah (1):
  perf tools powerpc: Add physical to logical address mapping for HTM
    traces

 tools/perf/arch/powerpc/util/Build      |   2 +
 tools/perf/arch/powerpc/util/auxtrace.c |  87 +--
 tools/perf/arch/powerpc/util/htm.c      | 116 ++++
 tools/perf/arch/powerpc/util/vpa-dtl.c  |  96 +++
 tools/perf/builtin-record.c             |  29 +
 tools/perf/util/Build                   |   1 +
 tools/perf/util/auxtrace.c              |   4 +
 tools/perf/util/auxtrace.h              |   1 +
 tools/perf/util/event.h                 |   1 +
 tools/perf/util/powerpc-htm.c           | 883 ++++++++++++++++++++++++
 tools/perf/util/powerpc-htm.h           |  25 +
 tools/perf/util/powerpc-vpadtl.h        |   1 +
 tools/perf/util/record.h                |   4 +
 13 files changed, 1177 insertions(+), 73 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/util/htm.c
 create mode 100644 tools/perf/arch/powerpc/util/vpa-dtl.c
 create mode 100644 tools/perf/util/powerpc-htm.c
 create mode 100644 tools/perf/util/powerpc-htm.h

-- 
2.52.0


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

end of thread, other threads:[~2026-07-01  9:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01  8:41 [PATCH 0/9] tools/perf: Add interface to expose HTM trace data via perf Athira Rajeev
2026-07-01  8:41 ` [PATCH 1/9] tool/perf: Move auxtrace_record__init for powerpc-vpadtl as separate utility Athira Rajeev
2026-07-01  8:56   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 2/9] tools/perf: Add CONFIG_AUXTRACE support for HTM pmu on powerpc Athira Rajeev
2026-07-01  8:55   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 3/9] tools/perf: Add arch_record__collect_final_data to collect additional data before closing the event Athira Rajeev
2026-07-01  8:54   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 4/9] tools/perf: Add powerpc callback support for arch_record__collect_final_data Athira Rajeev
2026-07-01  8:55   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 5/9] tools/perf: process htm auxtrace events and display in perf report -D Athira Rajeev
2026-07-01  9:05   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 6/9] perf tools powerpc: Add HTM trace data processing and decoding support Athira Rajeev
2026-07-01  9:06   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 7/9] perf tools powerpc: Add physical to logical address mapping for HTM traces Athira Rajeev
2026-07-01  9:07   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 8/9] tools/perf/powerpc: Add event name as htm of PERF_TYPE_SYNTH type to present htm samples Athira Rajeev
2026-07-01  9:12   ` sashiko-bot
2026-07-01  8:41 ` [PATCH 9/9] tools/perf/powerpc: Add logical address in decoded traces Athira Rajeev
2026-07-01  9:13   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox