Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 01/12] perf parse-events: Restrict core PMU bypass to --cputype option
Date: Tue, 16 Jun 2026 01:44:20 +0000	[thread overview]
Message-ID: <20260616014421.07FCD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260616012744.4049193-2-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch fails to correctly distinguish between `--cputype` and `--pmu-filter` when parsing metrics, causing uncore PMU events to incorrectly bypass the PMU filter.
--

commit 4dcfee88ee0f6425d471a5e115dd295cc67baf7d
Author: Ian Rogers <irogers@google.com>

perf parse-events: Restrict core PMU bypass to --cputype option

This commit introduces a cputype_filter flag to distinguish filtering
initiated by --cputype from --pmu-filter. This restricts the uncore
PMU bypass during event parsing to only apply when using --cputype.

> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
[ ... ]
> @@ -1317,7 +1317,9 @@ static int parse_ids(bool metric_no_merge, bool fake_pmu,
>  	pr_debug("Parsing metric events '%s'\n", events.buf);
>  	parse_events_error__init(&parse_error);
>  	ret = __parse_events(parsed_evlist, events.buf, filter_pmu,
> -			     &parse_error, fake_pmu, /*warn_if_reordered=*/false,
> +			     /*cputype_filter=*/filter_pmu != NULL,

[Severity: Medium]
Does hardcoding this argument to filter_pmu != NULL cause metric parsing to
lose the distinction between --cputype and --pmu-filter?

If metric parsing is initiated and a --pmu-filter was provided, this will
cause cputype_filter to be evaluated as true in __parse_events().

This will then trigger the new bypass logic in parse_events__filter_pmu(),
preventing uncore PMUs from being filtered out. As a result, users specifying
--pmu-filter with uncore metrics might silently aggregate events from all
identical uncore PMUs instead of the single requested one.

> +			     &parse_error, fake_pmu,
> +			     /*warn_if_reordered=*/false,
>  			     /*fake_tp=*/false);
>  	if (ret) {
>  		parse_events_error__print(&parse_error, events.buf);
[ ... ]
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
[ ... ]
> @@ -429,6 +429,9 @@ bool parse_events__filter_pmu(const struct parse_events_state *parse_state,
>  	if (parse_state->pmu_filter == NULL)
>  		return false;
>  
> +	if (parse_state->cputype_filter && !pmu->is_core)
> +		return false;
> +

[Severity: Medium]
Is it possible for this block to be incorrectly reached during metric
evaluation if cputype_filter was erroneously set to true by parse_ids()?

>  	return perf_pmu__wildcard_match(pmu, parse_state->pmu_filter) == 0;
>  }

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

  reply	other threads:[~2026-06-16  1:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  1:27 [PATCH v1 00/12] perf tests: Enhancements, speedups, and flakiness fixes Ian Rogers
2026-06-16  1:27 ` [PATCH v1 01/12] perf parse-events: Restrict core PMU bypass to --cputype option Ian Rogers
2026-06-16  1:44   ` sashiko-bot [this message]
2026-06-16  1:27 ` [PATCH v1 02/12] perf test: Truncate test description to fit terminal width Ian Rogers
2026-06-16  1:38   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 03/12] perf tests workloads: Support sub-second durations in noploop and thloop Ian Rogers
2026-06-16  1:35   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 04/12] perf tests: Add robust record retry helper and use subsecond workloads Ian Rogers
2026-06-16  1:38   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 05/12] perf tests: Skip metrics validation if system-wide recording lacks permission Ian Rogers
2026-06-16  1:41   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 06/12] perf tests: Fix Python JIT dump profiling test failure Ian Rogers
2026-06-16  1:39   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 07/12] perf tests: Fix flakiness in trace record and replay test Ian Rogers
2026-06-16  1:42   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 08/12] perf tests: Fix flakiness in BPF counters test on hybrid systems Ian Rogers
2026-06-16  1:35   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 09/12] perf tests: Fix flakiness in branch stack sampling tests Ian Rogers
2026-06-16  1:27 ` [PATCH v1 10/12] perf tests: Speed up off-cpu profiling tests Ian Rogers
2026-06-16  1:41   ` sashiko-bot
2026-06-16  1:27 ` [PATCH v1 11/12] perf tests: Speed up lock contention analysis shell test Ian Rogers
2026-06-16  1:27 ` [PATCH v1 12/12] perf tests: Speed up metrics checking shell tests Ian Rogers
  -- strict thread matches above, loose matches on Subject: below --
2026-06-16  1:25 [PATCH v1 00/12] perf tests: Enhancements, speedups, and flakiness fixes Ian Rogers
2026-06-16  1:25 ` [PATCH v1 01/12] perf parse-events: Restrict core PMU bypass to --cputype option Ian Rogers

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=20260616014421.07FCD1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@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