Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andi Kleen" <ak@linux.intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 3/4] perf tools: Add support for displaying weights in annotate
Date: Fri, 14 Aug 2026 01:43:31 +0000	[thread overview]
Message-ID: <20260814014336.8717A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813214143.253418-4-ak@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The 'w' hotkey caches the active event's weight mask into a global configuration variable, corrupting the display of weight columns for any subsequently viewed events.
--

--- Patch [3]: [PATCH v3 3/4] perf tools: Add support for displaying weights in annotate ---
commit 4886f581054e1fcacbf3f1649fad566092ced17b
Author: Andi Kleen <ak@linux.intel.com>

perf tools: Add support for displaying weights in annotate

This commit adds support for showing all three possible per-IP weights in
the annotation view, enabled by default if any are non-zero. It also
introduces a hotkey ('w') and a command line option to toggle these weight
columns.

> diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
> index e47a467750890..d6126a7d51e4a 100644
> --- a/tools/perf/ui/browsers/annotate.c
> +++ b/tools/perf/ui/browsers/annotate.c
[ ... ]
> @@ -1091,6 +1093,15 @@ 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_user = true;
> +			symbol_conf.weight_mask = symbol_conf.hide_weight ?
> +				0 : sym_hist__weight_mask(annotation__histogram(notes, evsel));

[Severity: Medium]
Will caching the active event's weight mask into the global symbol_conf
corrupt the display for subsequently viewed events?

If the user toggles weights with 'w', symbol_conf.weight_mask_user is set
to true and the current event's mask is saved to the global
symbol_conf.weight_mask. If the user then opens an annotation for a
different event, it seems this stale global state will persist and
override the dynamic column visibility for the new event.

> +			browser->b.width = notes->src->widths.max_line_len +
> +					   annotation__pcnt_width(notes, evsel);
> +			ui_browser__refresh_dimensions(&browser->b);
> +			continue;
[ ... ]
> diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
> index fa08d09b80f76..63bce7a920f32 100644
> --- a/tools/perf/util/annotate.h
> +++ b/tools/perf/util/annotate.h
[ ... ]
> @@ -376,9 +391,22 @@ static inline int annotation__cycles_width(struct annotation *notes)
>  	return notes->branch ? ANNOTATION__IPC_WIDTH + ANNOTATION__CYCLES_WIDTH : 0;
>  }
>  
> -static inline int annotation__pcnt_width(struct annotation *notes)
> +static inline u8 annotation__weight_mask(struct annotation *notes,
> +					 const struct evsel *evsel)
> +{
> +	if (symbol_conf.weight_mask_user)
> +		return symbol_conf.weight_mask;

[Severity: Medium]
Because symbol_conf is a global variable, does applying it uniformly here
break the dynamic weight mask calculation for other events once the user
has triggered the hotkey?

> +	if (symbol_conf.hide_weight)
> +		return 0;
> +	return sym_hist__weight_mask(&notes->src->histograms[evsel->core.idx]);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813214143.253418-1-ak@linux.intel.com?part=3

  reply	other threads:[~2026-08-14  1:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 21:40 Another perf annotate weight patchkit Andi Kleen
2026-08-13 21:40 ` [PATCH v3 1/4] perf tools record: Modernize -W man page Andi Kleen
2026-08-14  1:22   ` sashiko-bot
2026-08-13 21:40 ` [PATCH v3 2/4] perf tools top: Add --weight option Andi Kleen
2026-08-14  1:29   ` sashiko-bot
2026-08-13 21:40 ` [PATCH v3 3/4] perf tools: Add support for displaying weights in annotate Andi Kleen
2026-08-14  1:43   ` sashiko-bot [this message]
2026-08-13 21:40 ` [PATCH v3 4/4] perf tools: Add test for weight annotation Andi Kleen
2026-08-14  1:50   ` 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=20260814014336.8717A1F000E9@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