LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Athira Rajeev <atrajeev@linux.ibm.com>
To: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com,
	irogers@google.com, namhyung@kernel.org
Cc: linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	hbathini@linux.vnet.ibm.com, tejas05@linux.ibm.com,
	tshah@linux.ibm.com, venkat88@linux.ibm.com, usha.r2@ibm.com,
	maddy@linux.ibm.com
Subject: Re: [PATCH V5 0/6] tools/perf: Add powerpc HTM auxtrace support
Date: Sat, 8 Aug 2026 10:41:35 +0530	[thread overview]
Message-ID: <083A4990-6158-4C25-B29C-78A8AF9ADCF3@linux.ibm.com> (raw)
In-Reply-To: <20260807144135.2607-1-atrajeev@linux.ibm.com>



> On 7 Aug 2026, at 8:11 PM, Athira Rajeev <atrajeev@linux.ibm.com> wrote:
> 
> Overview:
> This series adds perf tool support for capturing and processing Hardware
> Trace Macro (HTM) trace data on POWER systems.  HTM exposes raw bus-trace
> data via the H_HTM hypervisor call.  The kernel-side HTM PMU driver
> (submitted separately) streams this data into perf AUX buffers and emits
> memory configuration as PERF_SAMPLE_RAW records.
> 
> This series wires up the record and report sides in the perf tool so that
> 'perf record' collects HTM data and 'perf report' writes the trace and
> memory configuration to files ready for post-processing with htmdecode.
> 

Hi All,

I am currently working on addressing Sashiko's review comments for V5 of the patch series.
Before I proceed with posting V6, requesting for any feedback or suggestions that I should incorporate in V6, apart from Sashiko's comments.

Thanks
Athira

> Patch overview:
> Patch 1 refactors the existing powerpc auxtrace dispatch.  All VPA-DTL
> recording logic is moved from arch/powerpc/util/auxtrace.c into its own
> file, arch/powerpc/util/vpa-dtl.c, leaving auxtrace_record__init() as a
> thin per-PMU dispatcher.  This is a prerequisite for adding the HTM
> recording path cleanly.
> 
> Patch 2 adds the HTM recording path (arch/powerpc/util/htm.c and
> util/powerpc-htm.h).  htm_recording_init() sets up the auxtrace_record
> callbacks.  htm_info_fill() stores the PMU type and a (cpu, attr.config)
> pair for each htm evsel into the PERF_RECORD_AUXTRACE_INFO priv[] area.
> The decode side reads these back to map each AUX buffer to its
> (node, chip, core) target using event->auxtrace.cpu.  PERF_SAMPLE_RAW is
> also enabled here so that memory configuration records are captured
> alongside the AUX stream.
> 
> Patch 3 adds a generic weak arch_perf_record__need_read() hook in
> builtin-record.c.  When the hook returns non-zero, perf record performs
> an extra mmap-read pass before disabling events.  The drain loop runs
> until the hook returns 0 or no forward progress is made, then the events
> are disabled and closed normally.
> 
> Patch 4 implements arch_perf_record__need_read() for powerpc.  It reads
> event->count for all open htm evsels via perf_evsel__read() and
> accumulates the values.  The kernel driver sets this count to the number
> of 128-byte HTM trace records written on a successful dump, 1 when the
> AUX buffer is temporarily full but the hypervisor stream is intact, and
> 0 once the stream is exhausted or a hard error occurs.  A non-zero total
> causes the recording loop to perform another read pass.
> 
> Patch 5 adds PERF_AUXTRACE_POWERPC_HTM to the auxtrace_type enum and
> wires the dispatch in perf_event__process_auxtrace_info().  It also
> amends htm_info_fill() to set auxtrace_info->type now that the constant
> is available.
> 
> Patch 6 adds the full HTM decode path in util/powerpc-htm.c.
> powerpc_htm_process_auxtrace_info() reads the (cpu, config) pairs from
> priv[] and builds a cpu_configs[] lookup table.  As each
> PERF_RECORD_AUXTRACE event arrives, process_auxtrace_event() maps it to
> the correct target and writes the data to htm.bin.nX.pX.cX.tX immediately.
> PERF_RECORD_SAMPLE RAW records are written to translation.nX.pX.cX.tX by
> process_event().  Per-run first-write tracking (htm_target_seen) ensures
> O_TRUNC on the first write and O_APPEND on subsequent writes.
> 
> Patches not included in V2:
> Three patches present in V1 are intentionally dropped from this series
> and will be submitted as a follow-on once the core infrastructure gets
> integrated:
> 
>  - htmdecode integration: V1 patch 6 invoked the external htmdecode
>    tool via fork/exec after writing htm.bin.* to decode the raw
>    bus-trace data in-process.  This is deferred because the interface
>    between perf and an external decode tool needs more discussion.
> 
>  - Physical-to-logical address mapping: V1 patch 7 read the current
>    partition ID from /proc/powerpc/lparcfg, parsed the translation.*
>    memory map entries, and mapped physical addresses in the decoded
>    trace to logical addresses within the LPAR.
> 
>  - Synthetic sample generation: V1 patches 8 and 9 created a
>    PERF_TYPE_SYNTH event named "htm", injected synthetic perf samples
>    with the translated logical addresses as sample IP, and wrote a
>    separate .out.l file with logical addresses alongside the decoded
>    trace.  The appropriate abstraction for synthetic HTM samples in the
>    perf tool requires further discussion.
> 
> Usage example:
> Collect HTM trace data from a single chip target:
> 
>  # perf record -C 9 -m,256 \
>      -e htm/nodalchipindex=2,nodeindex=0,htm_type=1/ sleep 3
>  [ perf record: Woken up 1 times to write data ]
>  [ perf record: Captured and wrote 256.277 MB perf.data ]
> 
>  # perf report
> 
> Output files written by perf report:
> 
>  htm.bin.n0.p2.c0.t1       raw HTM bus-trace data
>  translation.n0.p2.c0.t1   memory configuration records
> 
> Multiple targets can be collected simultaneously:
> 
>  # perf record -m,256 \
>      -e htm/nodalchipindex=2,nodeindex=0,htm_type=1,cpu=8/ \
>      -e htm/nodalchipindex=1,nodeindex=0,htm_type=1,cpu=9/ \
>      -a sleep 10
> 
> Testing:
> Tested on POWER11.  Both htm.bin.* and translation.* files are produced
> correctly for single and dual target collection.
> 
> Note: Link to kernel patches:
> https://lore.kernel.org/linuxppc-dev/20260807143734.1224-1-atrajeev@linux.ibm.com/T/#t
> 
> Athira Rajeev (6):
>  tools/perf: Move powerpc VPA-DTL auxtrace init into a separate file
>  tools/perf: Add AUXTRACE recording support for powerpc HTM
>  tools/perf: Add arch hook to drain remaining data before event close
>  tools/perf: Add powerpc callback support for
>    arch_perf_record__need_read
>  tools/perf: Add powerpc HTM auxtrace event processing support
>  tools/perf: Add perf tool support for processing powerpc HTM AUXTRACE
>    records
> 
> tools/perf/arch/powerpc/util/Build      |   2 +
> tools/perf/arch/powerpc/util/auxtrace.c |  98 ++----
> tools/perf/arch/powerpc/util/evsel.c    |  77 ++++
> tools/perf/arch/powerpc/util/htm.c      | 185 ++++++++++
> tools/perf/arch/powerpc/util/vpa-dtl.c  |  96 +++++
> tools/perf/builtin-record.c             |  65 ++++
> tools/perf/util/Build                   |   1 +
> tools/perf/util/auxtrace.c              |   4 +
> tools/perf/util/auxtrace.h              |   1 +
> tools/perf/util/powerpc-htm.c           | 447 ++++++++++++++++++++++++
> tools/perf/util/powerpc-htm.h           |  43 +++
> tools/perf/util/powerpc-vpadtl.h        |   3 +
> tools/perf/util/record.h                |   4 +
> 13 files changed, 954 insertions(+), 72 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.53.0
> 



      parent reply	other threads:[~2026-08-08  5:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 14:41 [PATCH V5 0/6] tools/perf: Add powerpc HTM auxtrace support Athira Rajeev
2026-08-07 14:41 ` [PATCH V5 1/6] tools/perf: Move powerpc VPA-DTL auxtrace init into a separate file Athira Rajeev
2026-08-12  9:30   ` Adrian Hunter
2026-08-12 15:41     ` Athira Rajeev
2026-08-07 14:41 ` [PATCH V5 2/6] tools/perf: Add AUXTRACE recording support for powerpc HTM Athira Rajeev
2026-08-12 10:27   ` Adrian Hunter
2026-08-12 15:05     ` Athira Rajeev
2026-08-07 14:41 ` [PATCH V5 3/6] tools/perf: Add arch hook to drain remaining data before event close Athira Rajeev
2026-08-07 14:41 ` [PATCH V5 4/6] tools/perf: Add powerpc callback support for arch_perf_record__need_read Athira Rajeev
2026-08-13  6:22   ` Adrian Hunter
2026-08-13  7:36     ` Athira Rajeev
2026-08-13  7:47       ` Adrian Hunter
2026-08-13 18:40         ` Athira Rajeev
2026-08-14 14:21           ` Adrian Hunter
2026-08-17 18:02             ` Athira Rajeev
2026-08-07 14:41 ` [PATCH V5 5/6] tools/perf: Add powerpc HTM auxtrace event processing support Athira Rajeev
2026-08-07 14:41 ` [PATCH V5 6/6] tools/perf: Add perf tool support for processing powerpc HTM AUXTRACE records Athira Rajeev
2026-08-08  5:11 ` Athira Rajeev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=083A4990-6158-4C25-B29C-78A8AF9ADCF3@linux.ibm.com \
    --to=atrajeev@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=hbathini@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=namhyung@kernel.org \
    --cc=tejas05@linux.ibm.com \
    --cc=tshah@linux.ibm.com \
    --cc=usha.r2@ibm.com \
    --cc=venkat88@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox