Linux Perf Users
 help / color / mirror / Atom feed
From: Athira Rajeev <atrajeev@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH V2 5/6] tools/perf: Add powerpc HTM auxtrace event processing support
Date: Fri, 24 Jul 2026 14:21:04 +0530	[thread overview]
Message-ID: <E70D814F-7C31-4693-8802-1B0AC8754ABD@linux.ibm.com> (raw)
In-Reply-To: <20260720111851.C7DEF1F00A3A@smtp.kernel.org>



> On 20 Jul 2026, at 4:48 PM, sashiko-bot@kernel.org wrote:
> 
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] Implicit truncation of `__u64` to `size_t` on 32-bit architectures.
> - [Low] The `auxtrace_type` field in `struct powerpc_htm` is declared but never initialized.
> --
> 
> --- Patch [5]: [PATCH V2 5/6] tools/perf: Add powerpc HTM auxtrace event processing support ---
> commit 87b8929025f59e2555a76806a3d33736b3cb7f18
> Author: Athira Rajeev <atrajeev@linux.ibm.com>
> 
> tools/perf: Add powerpc HTM auxtrace event processing support
> 
> This commit adds the PERF_AUXTRACE_POWERPC_HTM enum value to auxtrace.h and
> wires the dispatch in perf_event__process_auxtrace_info() to call
> powerpc_htm_process_auxtrace_info(). It also sets the auxtrace_info->type
> in htm_info_fill().
> 
>> diff --git a/tools/perf/util/powerpc-htm.c b/tools/perf/util/powerpc-htm.c
>> new file mode 100644
>> index 0000000000000..8d28d02031d6e
>> --- /dev/null
>> +++ b/tools/perf/util/powerpc-htm.c
>> @@ -0,0 +1,115 @@
> [ ... ]
>> +static void powerpc_htm_dump_event(size_t len)
>> +{
>> + const char *color = PERF_COLOR_BLUE;
>> +
>> + if (dump_trace) {
>> + color_fprintf(stdout, color,
>> + ". ... HTM PMU data: size %zu bytes\n", len);
>> + }
>> +}
> [ ... ]
>> +static int powerpc_htm_process_auxtrace_event(struct perf_session *session __maybe_unused,
>> +      union perf_event *event,
>> +      const struct perf_tool *tool __maybe_unused)
>> +{
>> + if (dump_trace)
>> + powerpc_htm_dump_event(event->auxtrace.size);
> 
> [Severity: Low]
> Does this implicitly truncate event->auxtrace.size on 32-bit architectures?
> 
> event->auxtrace.size is a __u64, but powerpc_htm_dump_event() accepts a
> size_t. This isn't a critical bug since it's only used for debug output,
> but could it result in printing a truncated size if the trace exceeds 4GB?
Ok, will fix this in V3

Thanks
Athira
> 
>> +
>> + return 0;
>> +}
> [ ... ]
>> +int powerpc_htm_process_auxtrace_info(union perf_event *event,
>> +      struct perf_session *session)
>> +{
>> + struct perf_record_auxtrace_info *auxtrace_info = &event->auxtrace_info;
>> + struct powerpc_htm *htm;
>> + int err;
>> +
>> + if (auxtrace_info->header.size < sizeof(struct perf_record_auxtrace_info) +
>> + HTM_AUXTRACE_PRIV_FIXED)
>> + return -EINVAL;
>> +
>> + htm = zalloc(sizeof(struct powerpc_htm));
>> + if (!htm)
>> + return -ENOMEM;
>> +
>> + err = auxtrace_queues__init(&htm->queues);
>> + if (err) {
>> + free(htm);
>> + return err;
>> + }
>> +
>> + htm->session = session;
>> + htm->machine = &session->machines.host;
> 
> [Severity: Low]
> Is htm->auxtrace_type intentionally left uninitialized here?
> 
> It is declared in struct powerpc_htm, but unlike other fields, it is not
> assigned auxtrace_info->type after the allocation.
> 

The type will be set in patch 6

>> + htm->auxtrace.process_event = powerpc_htm_process_event;
>> + htm->auxtrace.process_auxtrace_event = powerpc_htm_process_auxtrace_event;
>> + htm->auxtrace.flush_events = powerpc_htm_flush;
>> + htm->auxtrace.free_events = powerpc_htm_free_events;
>> + htm->auxtrace.free = powerpc_htm_free;
>> + session->auxtrace = &htm->auxtrace;
>> +
>> + return 0;
>> +}
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260720105218.14277-1-atrajeev@linux.ibm.com?part=5


  reply	other threads:[~2026-07-24  8:51 UTC|newest]

Thread overview: 19+ 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-24  8:42     ` Athira Rajeev
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
2026-07-24  8:43     ` Athira Rajeev
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-24  8:45     ` Athira Rajeev
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-24  8:48     ` Athira Rajeev
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-24  8:51     ` Athira Rajeev [this message]
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
2026-07-24  8:53     ` Athira Rajeev

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=E70D814F-7C31-4693-8802-1B0AC8754ABD@linux.ibm.com \
    --to=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