From: sashiko-bot@kernel.org
To: "Andi Kleen" <ak@linux.intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 4/4] perf tools: Add test for weight annotation
Date: Thu, 13 Aug 2026 14:18:53 +0000 [thread overview]
Message-ID: <20260813141854.463931F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813132907.50738-4-ak@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Background thread in perf top continually overwrites the TUI user preference for displaying weight columns due to an unprotected data race.
--
--- Patch [4]: [PATCH v1 4/4] perf tools: Add test for weight annotation ---
commit 7947c9d694355b6721ccd7944dc41891a9968db4
Author: Andi Kleen <ak@linux.intel.com>
perf tools: Add support for displaying weights in annotate
Add support for showing all the three possible per IP weights in
annotate. The weights are shown by defaults if any are non zero. This
is useful, especially with the new insn lat statistics, but also
for all the existing weights.
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 2888ac3b7b926..32bd6e23f6fdd 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -827,6 +827,7 @@ static void perf_event__process_sample(const struct perf_tool *tool,
> top->vmlinux_warned = true;
> }
> }
> + symbol_conf__set_weight_mode(&symbol_conf, sample);
[Severity: Medium]
Will this background sample processing thread concurrently overwrite the TUI
user preference for displaying weight columns?
The TUI thread modifies the global symbol_conf structure when the user attempts
to hide the weight columns. If the background thread is continually calling
symbol_conf__set_weight_mode() on every sample without locking, it appears the
user's preference could get immediately overridden, causing the TUI to flicker
or misalign columns.
[ ... ]
> diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
> index e47a467750890..dada5fa6d29f2 100644
> --- a/tools/perf/ui/browsers/annotate.c
> +++ b/tools/perf/ui/browsers/annotate.c
[ ... ]
> @@ -1091,6 +1092,14 @@ static int annotate_browser__run(struct annotate_browser *browser,
> symbol_conf.show_total_period = true;
> annotation__update_column_widths(notes);
> continue;
> + case 'w':
> + symbol_conf.hide_weight = !symbol_conf.hide_weight;
> + symbol_conf.weight_mask = symbol_conf.hide_weight ? 0 :
> + annotation__histogram(notes, evsel)->weight_mask;
[Severity: Medium]
Could this unprotected update to the global symbol_conf.weight_mask race with
the background thread's read-modify-write operations?
[ ... ]
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 94f9c8faeddab..4b04320e35ecb 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
[ ... ]
> +void symbol_conf__set_weight_mode(struct symbol_conf *c,
> + struct perf_sample *sample)
> +{
> + if (sample->weight)
> + c->weight_mask |= BIT(WEIGHT_WEIGHT);
[Severity: Medium]
Does this unprotected read-modify-write on the global symbol_conf structure
corrupt the state when called concurrently with the TUI thread?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260813132907.50738-1-ak@linux.intel.com?part=4
next prev parent reply other threads:[~2026-08-13 14:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 13:29 [PATCH v1 1/4] perf tools record: Modernize -W man page Andi Kleen
2026-08-13 13:29 ` [PATCH v1 2/4] perf tools top: Add --weight option Andi Kleen
2026-08-13 13:53 ` sashiko-bot
2026-08-13 13:29 ` [PATCH v1 3/4] perf tools: Add support for displaying weights in annotate Andi Kleen
2026-08-13 14:04 ` sashiko-bot
2026-08-13 13:29 ` [PATCH v1 4/4] perf tools: Add test for weight annotation Andi Kleen
2026-08-13 14:18 ` sashiko-bot [this message]
2026-08-13 13:47 ` [PATCH v1 1/4] perf tools record: Modernize -W man page 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=20260813141854.463931F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ak@linux.intel.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