public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leo Yan" <leo.yan@arm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf pmu: Skip test on Arm64 when #slots is zero
Date: Fri, 10 Apr 2026 10:59:32 +0000	[thread overview]
Message-ID: <20260410105933.90D24C19421@smtp.kernel.org> (raw)
In-Reply-To: <20260410-perf_fix_pmu_metrics_test-v1-1-18a5d80f71b6@arm.com>

Sashiko AI review found 1 potential issue(s):
- [Medium] Incorrect field check and negated logic in `is_expected_broken_metric()` masks legitimate test failures.
--

commit 06b8acc454fc829193782764d8f5906526599677
Author: Leo Yan <leo.yan@arm.com>

perf pmu: Skip test on Arm64 when #slots is zero

This commit introduces a check to skip metric tests on Arm64 platforms when
the slot count is zero, preventing syntax errors from failing the PMU metric
tests.

> diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c
> --- a/tools/perf/tests/pmu-events.c
> +++ b/tools/perf/tests/pmu-events.c

[ ... ]

> +static bool is_expected_broken_metric(const struct pmu_metric *pm)
> +{
> +	if (!strcmp(pm->metric_name, "M1") || !strcmp(pm->metric_name, "M2") ||
> +	    !strcmp(pm->metric_name, "M3"))
> +		return true;
> +
> +#if defined(__aarch64__)
> +	/*
> +	 * Arm64 platforms may return “#slots == 0”, which is treated as a
> +	 * syntax error by the parser. Don't test these metrics when running
> +	 * on such platforms.
> +	 */
> +	if (!strstr(pm->metric_name, "#slots") &&
> +	    !tool_pmu__cpu_slots_per_cycle())
> +		return true;

Should this check pm->metric_expr instead of pm->metric_name, and should
the negation be removed?

The string "#slots" appears to be part of the metric expression rather than
the metric name. Additionally, the !strstr() condition evaluates to true
when the string is not found.

Because most metric names do not contain "#slots", this condition seems to
evaluate to true for almost all metrics. On Arm64 platforms where
tool_pmu__cpu_slots_per_cycle() returns 0, could this cause any metric
parsing failure to be falsely identified as an expected broken metric and
silently skipped?

> +#endif
> +
> +	return false;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260410-perf_fix_pmu_metrics_test-v1-1-18a5d80f71b6@arm.com?part=1

      reply	other threads:[~2026-04-10 10:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:48 [PATCH] perf pmu: Skip test on Arm64 when #slots is zero Leo Yan
2026-04-10 10:59 ` sashiko-bot [this message]

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=20260410105933.90D24C19421@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko@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