From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 04/12] perf annotate-data: Count flexible array accesses for the whole struct
Date: Fri, 13 Nov 2026 15:20:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-213077@kernel.org> (raw)
In-Reply-To: <20261113150555.1163049-5-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf annotate-data: missing member_extent() use in TUI
get_member_overhead()
--
commit db1590c6b9cdacf042578dbb6359cc6b78b628eb
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf annotate-data: Count flexible array accesses for the whole struct
This commit introduces member_extent() to extend a struct or union member's
sample range to the end of its last child so flexible array accesses count
toward the enclosing type in print_annotated_data_type().
> diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c
> index dd9c1d7b2da8b..7fae186ffd76b 100644
> --- a/tools/perf/util/annotate-data.c
> +++ b/tools/perf/util/annotate-data.c
> @@ -2233,6 +2233,25 @@ static void print_annotated_data_value(struct type_hist *h, u64 period, int nr_s
> color_fprintf(stdout, color, " %7.2f", percent);
> }
>
> +/*
> + * A flexible array member is resolved past the end of its parent, so the
> + * parent's samples are not bounded by its size.
> + */
> +static int member_extent(struct annotated_member *member)
> +{
> + struct annotated_member *child;
> + int end = member->offset + member->size;
> +
> + list_for_each_entry(child, &member->children, node) {
> + int child_end = member_extent(child);
> +
> + if (child_end > end)
> + end = child_end;
> + }
> +
> + return end;
> +}
> +
> static void print_annotated_data_type(struct annotated_data_type *mem_type,
> struct annotated_member *member,
> struct evsel *evsel, int indent)
> @@ -2240,6 +2259,7 @@ static void print_annotated_data_type(struct annotated_data_type *mem_type,
> struct annotated_member *child;
> struct type_hist *h;
> int i, nr_events = 0, samples = 0;
> + int end = member_extent(member);
> u64 period = 0;
> int width = symbol_conf.show_total_period ? 11 : 7;
> struct evsel *pos;
> @@ -2253,10 +2273,10 @@ static void print_annotated_data_type(struct annotated_data_type *mem_type,
>
> samples = 0;
> period = 0;
> - for (i = 0; i < member->size; i++) {
> + for (i = member->offset; i < end; i++) {
> struct type_hist_entry *entry;
>
> - if (!hashmap__find(&h->samples, member->offset + i, &entry))
> + if (!hashmap__find(&h->samples, i, &entry))
> continue;
>
> samples += entry->nr_samples;
[Severity: Low]
Should get_member_overhead() in the TUI data-type browser also use
member_extent()?
tools/perf/ui/browsers/annotate-data.c:get_member_overhead() {
struct annotated_member *member = entry->data;
int i, k;
for (i = 0; i < member->size; i++) {
struct type_hist *h;
struct evsel *evsel;
int offset = member->offset + i;
...
}
Because get_member_overhead() still iterates only up to member->size,
inspecting a struct with flexible array accesses in the TUI browser continues
to omit those samples from the enclosing struct's overhead, sample count, and
period.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113150555.1163049-1-acme@kernel.org?part=4
next prev parent reply other threads:[~2026-11-13 15:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 15:05 [PATCH v1 0/12] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
2026-11-13 15:05 ` [PATCH v1 01/12] perf scripts: Add a coverage harness for perf Arnaldo Carvalho de Melo
2026-11-13 15:23 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 02/12] perf annotate-data: Resolve DW_OP_addrx global variables Arnaldo Carvalho de Melo
2026-11-13 15:14 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 03/12] perf tests: Exercise the flexible array member path Arnaldo Carvalho de Melo
2026-11-13 15:12 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 04/12] perf annotate-data: Count flexible array accesses for the whole struct Arnaldo Carvalho de Melo
2026-11-13 15:20 ` sashiko-bot [this message]
2026-11-13 15:05 ` [PATCH v1 05/12] perf tests: Exercise data type resolution from a register Arnaldo Carvalho de Melo
2026-11-13 15:13 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 06/12] perf annotate: Print the stats after the annotations Arnaldo Carvalho de Melo
2026-11-13 15:24 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 07/12] perf tests: Silence the libbfd probe in build-test Arnaldo Carvalho de Melo
2026-11-13 15:08 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 08/12] perf build: Record the display-only features in FEATURE-DUMP Arnaldo Carvalho de Melo
2026-11-13 15:14 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 09/12] perf cs-etm: Fall back to the recorded instruction size on a failed read Arnaldo Carvalho de Melo
2026-11-13 15:11 ` sashiko-bot
2026-11-13 15:15 ` Leo Yan
2026-11-13 15:20 ` Arnaldo Carvalho de Melo
2026-11-13 15:05 ` [PATCH v1 10/12] perf tests: Fix the Intel PT virtual LBR check Arnaldo Carvalho de Melo
2026-11-13 15:25 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 11/12] perf test: Drop samples without an IP in the dlfilter test Arnaldo Carvalho de Melo
2026-11-13 15:13 ` sashiko-bot
2026-11-13 15:05 ` [PATCH v1 12/12] perf test: Skip the LBR inline unwinding check when unsupported Arnaldo Carvalho de Melo
2026-11-13 15:16 ` 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=sashiko-outbox-213077@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@kernel.org \
--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