Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 4/6] perf test attr: Fix legacy event encodings in group tests
Date: Tue, 06 Oct 2026 16:30:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-162257@kernel.org> (raw)
In-Reply-To: <20261006161309.3078488-5-acme@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] perf test attr: test-record-group-sampling fails on bare cycles
- [Medium] perf: test attr fails on hybrid due to PMU type shift in legacy-hardware-config
--

commit 89d023b229e1044502e25f88b4301ecff3715694
Author: Arnaldo Carvalho de Melo <acme@redhat.com>

perf test attr: Fix legacy event encodings in group tests

Since b1c5efbfd92eb84d ("perf parse-events: Remove hard coded legacy
hardware and cache parsing"), event names are resolved with sysfs/JSON
priority over the legacy encodings, so bare cache-misses and
instructions now become the core PMU sysfs/JSON events. This patch
requests the legacy encodings explicitly with the legacy-hardware-config
term.

> diff --git a/tools/perf/tests/shell/attr/test-record-group-sampling1 b/tools/perf/tests/shell/attr/test-record-group-sampling1
> index 4748ab7bf6843..5be9a1a2a4ff0 100644
> --- a/tools/perf/tests/shell/attr/test-record-group-sampling1
> +++ b/tools/perf/tests/shell/attr/test-record-group-sampling1
> @@ -1,6 +1,6 @@
>  [config]
>  command = record
> -args    = --no-bpf-event -e '{cycles,cache-misses}:S' kill >/dev/null 2>&1
> +args    = --no-bpf-event -e '{cycles,default_core/legacy-hardware-config=3/}:S' kill >/dev/null 2>&1

[Severity: Medium]
Since "cycles" is left as a bare event, wouldn't this still fail the strict
type=0 and config=0 requirements later in this file? 

If "cycles" resolves dynamically via sysfs/JSON to a core PMU event (typically
type=4), attr.py will read a non-zero type and fail the equality check. Should
"cycles" also be updated to "default_core/legacy-hardware-config=0/" to match
these expectations?

>  ret     = 1
>  kernel_since = 6.12

[ ... ]

> diff --git a/tools/perf/tests/shell/attr/test-record-group-sampling2 b/tools/perf/tests/shell/attr/test-record-group-sampling2
> index e0432244a0eb7..c05225167ec34 100644
> --- a/tools/perf/tests/shell/attr/test-record-group-sampling2
> +++ b/tools/perf/tests/shell/attr/test-record-group-sampling2
> @@ -1,6 +1,6 @@
>  [config]
>  command = record
> -args    = --no-bpf-event -c 10000 -e '{cycles,cache-misses}:S' kill >/dev/null 2>&1
> +args    = --no-bpf-event -c 10000 -e '{cycles,default_core/legacy-hardware-config=3/}:S' kill >/dev/null 2>&1

[Severity: Medium]
Similarly, will leaving "cycles" as a bare event here cause a failure against
the strict expectations?

>  ret     = 1
>  kernel_since = 6.12

[ ... ]

> diff --git a/tools/perf/tests/shell/attr/test-record-group1 b/tools/perf/tests/shell/attr/test-record-group1
> index eeb1db392bc9c..0437ea4939e88 100644
> --- a/tools/perf/tests/shell/attr/test-record-group1
> +++ b/tools/perf/tests/shell/attr/test-record-group1
> @@ -1,6 +1,6 @@
>  [config]
>  command = record
> -args    = --no-bpf-event -e '{cycles,instructions}' kill >/dev/null 2>&1
> +args    = --no-bpf-event -e '{cycles,default_core/legacy-hardware-config=1/}' kill >/dev/null 2>&1

[Severity: Medium]
Will this fail on hybrid architectures like Intel Alder Lake?

On hybrid platforms, perf_pmus__supports_extended_type() evaluates to true.
This causes config_term_pmu() in tools/perf/util/parse-events.c to shift the
dynamic PMU type into the upper 32 bits of attr->config when using
legacy-hardware-config:

tools/perf/util/parse-events.c:config_term_pmu() {
	...
	attr->config = term->val.num;
	if (perf_pmus__supports_extended_type())
		attr->config |= (__u64)attr->type << PERF_PMU_TYPE_SHIFT;
	attr->type = PERF_TYPE_HARDWARE;
	...
}

This could yield a config value of (4 << 32) | 1 instead of 1.

Since the test script keeps the hardcoded expected attribute config=1 and
tools/perf/tests/shell/lib/attr.py uses strict string equality, will this
result in an unavoidable test failure?

>  ret     = 1
>  
>  [event-1:base-record]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006161309.3078488-1-acme@kernel.org?part=4

  reply	other threads:[~2026-10-06 16:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 16:13 [PATCH 0/6 v1] perf test attr: Fix the re-enabled test Arnaldo Carvalho de Melo
2026-10-06 16:13 ` [PATCH 1/6] perf test attr: Propagate the return value from the test to the wrapper Arnaldo Carvalho de Melo
2026-10-06 16:18   ` sashiko-bot
2026-10-06 16:13 ` [PATCH 2/6] perf test attr: Fix wrong size expectation for events Arnaldo Carvalho de Melo
2026-10-06 16:24   ` sashiko-bot
2026-10-06 16:13 ` [PATCH 3/6] perf test attr: Fix record dwarf sample_type expectation Arnaldo Carvalho de Melo
2026-10-06 16:18   ` sashiko-bot
2026-10-06 16:13 ` [PATCH 4/6] perf test attr: Fix legacy event encodings in group tests Arnaldo Carvalho de Melo
2026-10-06 16:30   ` sashiko-bot [this message]
2026-10-06 16:13 ` [PATCH 5/6] perf test attr: Fix default stat metrics expectations Arnaldo Carvalho de Melo
2026-10-06 16:26   ` sashiko-bot
2026-10-06 16:13 ` [PATCH 6/6] perf test attr: Relax group checking for ungrouped expectations Arnaldo Carvalho de Melo
2026-10-06 16:22   ` sashiko-bot
2026-10-07  0:00 ` [PATCH 0/6 v1] perf test attr: Fix the re-enabled test Namhyung Kim
2026-10-07  0:22   ` Namhyung Kim
2026-10-07  5:58     ` Arnaldo Melo
2026-10-07  8:31   ` 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=sashiko-outbox-162257@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --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