Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Athira Rajeev" <atrajeev@linux.ibm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH V2 2/6] tools/perf: Add AUXTRACE recording support for powerpc HTM
Date: Mon, 20 Jul 2026 11:20:59 +0000	[thread overview]
Message-ID: <20260720112059.DB20E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720105218.14277-3-atrajeev@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Uninitialized auxtrace_info->type causes perf.data corruption and breaks bisectability.
- [High] aux_watermark is set to the full size of the ring buffer, risking trace data loss.
--

--- Patch [2]: [PATCH V2 2/6] tools/perf: Add AUXTRACE recording support for powerpc HTM ---
commit 90e77eef6274098986791263120e8c79ee34c0b9
Author: Athira Rajeev <atrajeev@linux.ibm.com>

tools/perf: Add AUXTRACE recording support for powerpc HTM

Adds powerpc perf tool support for HTM PMU AUXTRACE recording. Introduces
htm_recording_init() and related auxtrace callbacks to create
PERF_RECORD_AUXTRACE records for HTM data. Updates auxtrace_record__init()
to detect HTM events.

> diff --git a/tools/perf/arch/powerpc/util/htm.c b/tools/perf/arch/powerpc/util/htm.c
> new file mode 100644
> index 0000000000000..07b496e4be2fb
> --- /dev/null
> +++ b/tools/perf/arch/powerpc/util/htm.c

[ ... ]

> +static int
> +htm_recording_options(struct auxtrace_record *itr __maybe_unused,
> +		      struct evlist *evlist,
> +		      struct record_opts *opts)
> +{
> +	struct evsel *pos;
> +
> +	opts->full_auxtrace = true;
> +
> +	if (!opts->auxtrace_mmap_pages) {
> +		opts->auxtrace_mmap_pages = KiB(128) / page_size;
> +		if (opts->mmap_pages == UINT_MAX)
> +			opts->mmap_pages = KiB(256) / page_size;
> +	}
> +
> +	evlist__for_each_entry(evlist, pos) {
> +		if (!pos->name || !strstarts(pos->name, "htm"))
> +			continue;
> +		pos->core.attr.aux_watermark =
> +			opts->auxtrace_mmap_pages * (size_t)page_size;

[Severity: High]
Does setting the watermark to the full size of the ring buffer risk hardware
trace data loss?

By setting the watermark equal to the entire buffer size, the wakeup only
fires when the buffer is 100% full. Because scheduling the user-space perf
tool and reading the buffer introduces latency, any hardware trace data
generated during this window might be dropped due to a lack of buffer
headroom.

> +		pos->core.attr.freq = 0;
> +		pos->core.attr.sample_type |= PERF_SAMPLE_RAW;
> +		pos->needs_auxtrace_mmap = true;
> +	}
> +
> +	return 0;
> +}

[ ... ]

> +static int
> +htm_info_fill(struct auxtrace_record *itr,
> +	      struct perf_session *session,
> +	      struct perf_record_auxtrace_info *auxtrace_info,
> +	      size_t priv_size)
> +{
> +	struct htm_recording *htm_r = container_of(itr, struct htm_recording, itr);
> +	struct evlist *evlist = session->evlist;
> +	struct evsel *pos;
> +	int n = 0;
> +	int expected_n = htm_nr_events(evlist);
> +
> +	if (priv_size != HTM_AUXTRACE_PRIV_SIZE(expected_n))
> +		return -EINVAL;
> +
> +	// To set: auxtrace_info->type
> +	auxtrace_info->priv[POWERPC_HTM_PMU_TYPE] = htm_r->evsel->core.attr.type;

[Severity: High]
Does leaving auxtrace_info->type uninitialized break bisectability by
generating corrupted perf.data files?

Because the type is left uninitialized (defaulting to PERF_AUXTRACE_UNKNOWN)
before the auxtrace info data is written to the stream, this might create
trace files that cannot be read by `perf report` at this commit.

> +	auxtrace_info->priv[POWERPC_HTM_NUM_EVENTS] = expected_n;
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720105218.14277-1-atrajeev@linux.ibm.com?part=2

  reply	other threads:[~2026-07-20 11:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 10:52 [PATCH V2 0/6] tools/perf: Add powerpc HTM auxtrace support Athira Rajeev
2026-07-20 10:52 ` [PATCH V2 1/6] tools/perf: Move powerpc VPA-DTL auxtrace init into a separate file Athira Rajeev
2026-07-20 11:15   ` sashiko-bot
2026-07-20 10:52 ` [PATCH V2 2/6] tools/perf: Add AUXTRACE recording support for powerpc HTM Athira Rajeev
2026-07-20 11:20   ` sashiko-bot [this message]
2026-07-20 10:52 ` [PATCH V2 3/6] tools/perf: Add arch hook to drain remaining data before event close Athira Rajeev
2026-07-20 11:16   ` sashiko-bot
2026-07-20 10:52 ` [PATCH V2 4/6] tools/perf: Add powerpc callback support for arch_perf_record__need_read Athira Rajeev
2026-07-20 11:18   ` sashiko-bot
2026-07-20 10:52 ` [PATCH V2 5/6] tools/perf: Add powerpc HTM auxtrace event processing support Athira Rajeev
2026-07-20 11:18   ` sashiko-bot
2026-07-20 10:52 ` [PATCH V2 6/6] tools/perf: Add perf tool support for processing powerpc HTM AUXTRACE records Athira Rajeev
2026-07-20 11:25   ` sashiko-bot

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=20260720112059.DB20E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=atrajeev@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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