Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chun-Tse Shao" <ctshao@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2] perf stat: Fix false NMI watchdog warning in aggregation modes
Date: Thu, 11 Jun 2026 22:10:22 +0000	[thread overview]
Message-ID: <20260611221022.7AB671F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260611215632.562900-1-ctshao@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Directly accessing `counter->pmu` without lazy initialization suppresses the NMI watchdog hint during `perf stat report`.
--

commit 8ecd592e1137cf0841158570884e6514049ebf6f
Author: Chun-Tse Shao <ctshao@google.com>

perf stat: Fix false NMI watchdog warning in aggregation modes

This commit fixes false NMI watchdog warnings in aggregation modes by
restricting the hint to core PMU events. It prevents the warning from
triggering on uncore PMU events by checking the event's PMU and its
core flag.

> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index 993f4c4b8f442..b576776917353 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
[ ... ]
> @@ -823,9 +823,9 @@ static void printout(struct perf_stat_config *config, struct outstate *os,
>  		ok = false;
>  
>  		if (counter->supported) {
> -			if (!evlist__has_hybrid_pmus(counter->evlist)) {
> +			if (!evlist__has_hybrid_pmus(counter->evlist) &&
> +			    counter->pmu && counter->pmu->is_core)

[Severity: Medium]
During a perf stat report on non-hybrid machines, will counter->pmu be null
here because it is lazily initialized when constructed from perf.data?

Since evlist__has_hybrid_pmus() immediately returns false on non-hybrid
machines without iterating over the events, counter->pmu would remain
uninitialized.

Does this code safely handle lazy initialization, or should it use
evsel__find_pmu(counter) to guarantee the PMU is resolved before checking
is_core?

>  				config->print_free_counters_hint = 1;
> -			}
>  		}
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260611215632.562900-1-ctshao@google.com?part=1

  reply	other threads:[~2026-06-11 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 21:56 [PATCH v2] perf stat: Fix false NMI watchdog warning in aggregation modes Chun-Tse Shao
2026-06-11 22:10 ` sashiko-bot [this message]
2026-06-11 22:33 ` Ian Rogers
2026-06-12  0:22   ` Arnaldo Carvalho de Melo

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=20260611221022.7AB671F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ctshao@google.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