Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tanushree Shah" <tshah@linux.ibm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [RFC PATCH v4 1/5] perf/trace-dat: Add trace.dat export infrastructure
Date: Sat, 22 Aug 2026 06:40:12 +0000	[thread overview]
Message-ID: <20260822064013.333121F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260822062729.882005-2-tshah@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Large trace events encode their payload length incorrectly, causing alignment errors and event truncation.
- [Medium] Querying the local host system's `tracefs` for the `trace_clock` during file conversion leaks host environment state into the converted trace.
--

--- Patch [1]: [RFC PATCH v4 1/5] perf/trace-dat: Add trace.dat export infrastructure ---
commit 162f3240dcf1a2672aa00440674197558e8f2cec
Author: Tanushree Shah <tshah@linux.ibm.com>

perf/trace-dat: Add trace.dat export infrastructure

Add new utility files util/trace-dat.c and util/trace-dat.h implementing
the infrastructure for exporting perf.data tracepoints to trace.dat format
compatible with trace-cmd and KernelShark.

> diff --git a/tools/perf/util/trace-dat.c b/tools/perf/util/trace-dat.c
> index 0000000000000..55a7bd982c6f8
> --- /dev/null
> +++ b/tools/perf/util/trace-dat.c
[ ... ]
> +static int trace_dat__write_cpu_dat(FILE *fp, int cpu, unsigned long long *file_offset_out)
> +{
[ ... ]
> +		memcpy(data_rec, &hdr_word, TRACE_DAT_WORD_SIZE);
> +
> +		/* Large events: write actual byte length after header */
> +		if (type_len == 0)
> +			memcpy(data_rec + TRACE_DAT_WORD_SIZE, &data_len, TRACE_DAT_WORD_SIZE);

[Severity: Medium]
When writing large events (where type_len == 0), is `data_len` the correct
value to write here? Ftrace ring buffer parsers typically expect this field
to contain the size of the payload plus the 4-byte size field itself,
properly padded to 4-byte alignment, rather than just the raw event size.
Could this lead to event truncation or alignment errors when parsing?

[ ... ]
> +int trace_dat__write_options_section1(void)
> +{
[ ... ]
> +	/* TRACECLOCK option */
> +	opt_id = TRACE_DAT_OPTION_TRACECLOCK;
> +
> +	path = get_tracing_file("trace_clock");
> +	if (path) {
> +		clock_file = fopen(path, "r");
> +		put_tracing_file(path);
> +	} else {
> +		clock_file = NULL;
> +	}

[Severity: Medium]
Does querying the host system's tracefs mount here break cross-platform
analysis? Since this is an offline conversion of a perf.data file, the host
machine's current trace clock might not match the clock used when the trace
was originally recorded. Should this extract the clock from the perf_env
instead?

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

  reply	other threads:[~2026-08-22  6:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22  6:27 [RFC PATCH v4 0/5] Add perf.data tracepoint events to trace.dat conversion Tanushree Shah
2026-08-22  6:27 ` [RFC PATCH v4 1/5] perf/trace-dat: Add trace.dat export infrastructure Tanushree Shah
2026-08-22  6:40   ` sashiko-bot [this message]
2026-08-22  6:27 ` [RFC PATCH v4 2/5] perf/trace-event: Write trace.dat metadata sections during parsing Tanushree Shah
2026-08-22  6:44   ` sashiko-bot
2026-08-22  6:27 ` [RFC PATCH v4 3/5] perf data-convert: Add perf.data to trace.dat conversion backend Tanushree Shah
2026-08-22  6:38   ` sashiko-bot
2026-08-22  6:27 ` [RFC PATCH v4 4/5] perf data: Add --to-trace-dat option for converting perf.data tracepoint events into trace.dat format Tanushree Shah
2026-08-22  6:44   ` sashiko-bot
2026-08-22  6:27 ` [RFC PATCH v4 5/5] perf test: Add test validating trace.dat generated by 'perf data convert --to-trace-dat' Tanushree Shah
2026-08-22  6:36   ` 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=20260822064013.333121F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tshah@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