Skip to contentSkip to conversation

perf test attr: Fix and re-enable the test

PATCH Applied Michael Petlan 4 participants 9 messages Sep 24 – Oct 6 perf events

lore
Share & tools
lore
#0 lore raw

cover perf test attr: Fix and re-enable the test

Hello all,

I have noticed that a testcase formerly known as "Setup struct perf_event_attr", later renamed to "Perf attribute expectations test" has been disabled by accident during the move.

That also probably led to forgetting to update the struct size, which is now fixed by the second patch.

Michael

Michael Petlan (2):
perf test attr: Propagate the return value from the test to the
wrapper
perf test attr: Fix wrong size expectation for events

 tools/perf/tests/shell/attr.sh                   | 1 +
 tools/perf/tests/shell/attr/base-record          | 2 +-
 tools/perf/tests/shell/attr/base-stat            | 2 +-
 tools/perf/tests/shell/attr/system-wide-dummy    | 2 +-
 tools/perf/tests/shell/attr/test-record-dummy-C0 | 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/2 perf test attr: Propagate the return value from the test to the wrapper

Currently it does not matter what the python script actually returns, the test always passes, as the $err variable is always 0.

Fix that.

Fixes 8519e4f44c2af72214dc029f0334be068466e71f perf test: Add a shell wrapper for "Setup struct perf_event_attr"
---
 tools/perf/tests/shell/attr.sh | 1 +
 1 file changed, 1 insertion(+)
tools/perf/tests/shell/attr.sh +1 -0
index 5a4e43b2471d..307e1535795a 100755
@@ -18,5 +18,6 @@ trap trap_cleanup EXIT TERM INT
 shelldir=$(dirname "$0")
 perf_path=$(which perf)
 python "${shelldir}"/lib/attr.py -d "${shelldir}"/attr -v -p "$perf_path"
+err=$?
 cleanup
 exit $err
Signature · 1 line
2.52.0
#2 lore raw

Re: [PATCH 1/2] perf test attr: Propagate the return value from the test to the wrapper

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

Currently it does not matter what the python script actually returns, the test always passes, as the $err variable is always 0.

Fix that.

Fixes 8519e4f44c2af72214dc029f0334be068466e71f perf test: Add a shell wrapper for "Setup struct perf_event_attr"

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH 2/2 perf test attr: Fix wrong size expectation for events

In reply to Michael Petlan

Although config4 has been added into struct perf_event_attr, the size expectation for the struct hasn't been adjusted. This hasn't been noticed, since the testcase's return value has been ignored after rewriting the testcase to python until previous commit.

Fix that.

Fixes 80cdf208117a36de82a30d210b3b8df0f193e75b ("tools headers UAPI: Sync linux/perf_event.h with the kernel sources")
Fixes cbbfba4847b8a5299d36e002bf864b21bb83295d ("perf: Add perf_event_attr::config4")
---
 tools/perf/tests/shell/attr/base-record          | 2 +-
 tools/perf/tests/shell/attr/base-stat            | 2 +-
 tools/perf/tests/shell/attr/system-wide-dummy    | 2 +-
 tools/perf/tests/shell/attr/test-record-dummy-C0 | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/tests/shell/attr/base-record +1 -1
index b44e4e6e4443..dd76fbdb628f 100644
@@ -5,7 +5,7 @@ group_fd=-1
 flags=0|8
 cpu=*
 type=0|1
-size=136
+size=144
 config=0|1
 sample_period=*
 sample_type=263
tools/perf/tests/shell/attr/base-stat +1 -1
index fccd8ec4d1b0..d769e69bb4f5 100644
@@ -5,7 +5,7 @@ group_fd=-1
 flags=0|8
 cpu=*
 type=0
-size=136
+size=144
 config=0
 sample_period=0
 sample_type=65536
tools/perf/tests/shell/attr/system-wide-dummy +1 -1
index a1e1d6a263bf..9806de3d9c9e 100644
@@ -7,7 +7,7 @@ cpu=*
 pid=-1
 flags=8
 type=1
-size=136
+size=144
 config=9
 sample_period=1
 # PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
tools/perf/tests/shell/attr/test-record-dummy-C0 +1 -1
index 91499405fff4..23e00e7f8ace 100644
@@ -10,7 +10,7 @@ cpu=0
 pid=-1
 flags=8
 type=1
-size=136
+size=144
 config=9
 sample_period=4000
 # PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
Signature · 1 line
2.52.0
#4 lore raw

Re: [PATCH 2/2] perf test attr: Fix wrong size expectation for events

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines

Although config4 has been added into struct perf_event_attr, the size expectation for the struct hasn't been adjusted. This hasn't been noticed, since the testcase's return value has been ignored after rewriting the testcase to python until previous commit.

Fix that.

Fixes 80cdf208117a36de82a30d210b3b8df0f193e75b ("tools headers UAPI: Sync linux/perf_event.h with the kernel sources")
Fixes cbbfba4847b8a5299d36e002bf864b21bb83295d ("perf: Add perf_event_attr::config4")

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#5 lore raw

Re: [PATCH 2/2] perf test attr: Fix wrong size expectation for events

In reply to Michael Petlan
Quoted 10 lines · Michael Petlan

Although config4 has been added into struct perf_event_attr, the size expectation for the struct hasn't been adjusted. This hasn't been noticed, since the testcase's return value has been ignored after rewriting the testcase to python until previous commit.

Fix that.

Fixes 80cdf208117a36de82a30d210b3b8df0f193e75b ("tools headers UAPI: Sync linux/perf_event.h with the kernel sources")
Fixes cbbfba4847b8a5299d36e002bf864b21bb83295d ("perf: Add perf_event_attr::config4")

This cset changes a kernel header, kernel developers are not expected to update tools/ living code, they are welcomed to do so, so it didn't introduce a problem, so the cset that updates the tools/include/ is the one that should be in the fixes.

I was going to do that when I noticed this:

 #define PERF_ATTR_SIZE_VER9                    144     /* add: config4 */
+#define PERF_ATTR_SIZE_VER10                   176     /* Add: sample_simd_{vec|pred}_reg_* */

in tools/include/uapi/linux/perf_event.h, i.e. with your patch it will continue broken, as it is not taking into account this one:

commit eb89aef367e4701038869e1ddfa719463524e3e3

Author: Dapeng Mi <[email protected]>
Date:   Mon Sep 14 09:40:43 2026 +0800

perf headers: Sync perf_event.h/perf_regs.h with the kernel headers

Sync the UAPI header changes of supporting SIMD/eGPRs/SSP sampling into corresponding tools UAPI headers.

So I'm updating your patch to have 176 instead of 144.

The test is still failing tho, for some other reason:

running '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-default' test limitation '!aarch64'
excluded architecture list ['aarch64']
running '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-default-aarch64' test limitation 'aarch64'
skipped [x86_64] '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-default-aarch64' running '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-dwarf' expected sample_type=45359, got 12583
FAILED '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-dwarf' - match failure ---- end(-1) ----
82: Perf attribute expectations test : FAILED!

=== Test Summary ===
Passed main tests : 0
Passed subtests : 0
Skipped tests : 0
Failed tests : 1
List of failed tests:
82: Perf attribute expectations test
root@x2:~#

Investigating.

- Arnaldo

Quoted 63 lines
---
 tools/perf/tests/shell/attr/base-record          | 2 +-
 tools/perf/tests/shell/attr/base-stat            | 2 +-
 tools/perf/tests/shell/attr/system-wide-dummy    | 2 +-
 tools/perf/tests/shell/attr/test-record-dummy-C0 | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/tests/shell/attr/base-record +1 -1
index b44e4e6e4443..dd76fbdb628f 100644
@@ -5,7 +5,7 @@ group_fd=-1
 flags=0|8
 cpu=*
 type=0|1
-size=136
+size=144
 config=0|1
 sample_period=*
 sample_type=263
tools/perf/tests/shell/attr/base-stat +1 -1
index fccd8ec4d1b0..d769e69bb4f5 100644
@@ -5,7 +5,7 @@ group_fd=-1
 flags=0|8
 cpu=*
 type=0
-size=136
+size=144
 config=0
 sample_period=0
 sample_type=65536
tools/perf/tests/shell/attr/system-wide-dummy +1 -1
index a1e1d6a263bf..9806de3d9c9e 100644
@@ -7,7 +7,7 @@ cpu=*
 pid=-1
 flags=8
 type=1
-size=136
+size=144
 config=9
 sample_period=1
 # PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
tools/perf/tests/shell/attr/test-record-dummy-C0 +1 -1
index 91499405fff4..23e00e7f8ace 100644
@@ -10,7 +10,7 @@ cpu=0
 pid=-1
 flags=8
 type=1
-size=136
+size=144
 config=9
 sample_period=4000
 # PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
Signature · 1 line
2.52.0
#6 lore raw

Re: [PATCH 2/2] perf test attr: Fix wrong size expectation for events

Quoted 13 lines · Arnaldo Carvalho de Melo

The test is still failing tho, for some other reason:

running '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-default' test limitation '!aarch64'
excluded architecture list ['aarch64']
running '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-default-aarch64' test limitation 'aarch64'
skipped [x86_64] '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-default-aarch64' running '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-dwarf' expected sample_type=45359, got 12583
FAILED '/home/acme/libexec/perf-core/tests/shell/attr/test-record-graph-dwarf' - match failure ---- end(-1) ----
82: Perf attribute expectations test : FAILED!

Some fixes for problems undetected because of the lack of error propagation:

⬢ [acme@tb-x2-perf perf-tools-next]$ git log --oneline -5
027108ff3952e8ae (HEAD -> perf-tools-next) perf test attr: Fix legacy event encodings in group tests
12d947c0d8e7aac6 perf test attr: Fix record dwarf sample_type expectation
cec590f3de003895 perf test attr: Fix wrong size expectation for events
04a0a19ede01e771 perf test attr: Propagate the return value from the test to the wrapper
1dc462fc21490767 (perf-tools-next.korg/tmp.perf-tools-next, perf-tools-next.korg/perf-tools-next, five/perf-tools-next, acme.korg/tmp.perf-tools-next, acme.korg/perf-tools-next) perf test: Add a test for perf timechart --tui ⬢ [acme@tb-x2-perf perf-tools-next]$

Still working to see all gets fixed and that test passes again.

- Arnado

maintainer Acked-by on the v1 series
#7 lore raw
In reply to Michael Petlan

Hello,

Quoted 9 lines · Michael Petlan

Hello all,

I have noticed that a testcase formerly known as "Setup struct perf_event_attr", later renamed to "Perf attribute expectations test" has been disabled by accident during the move.

That also probably led to forgetting to update the struct size, which is now fixed by the second patch.

Quoted 7 lines

Michael

Michael Petlan (2):
perf test attr: Propagate the return value from the test to the
wrapper
perf test attr: Fix wrong size expectation for events

The "Fixes" tag format is a bit different, but otherwise

Thanks,
Namhyung

maintainer Applied
#8 lore raw
Quoted 8 lines · Namhyung Kim
Quoted 6 lines · Michael Petlan

I have noticed that a testcase formerly known as "Setup struct perf_event_attr", later renamed to "Perf attribute expectations test" has been disabled by accident during the move.

That also probably led to forgetting to update the struct size, which is now fixed by the second patch.

Quoted 6 lines
Quoted 4 lines

Michael Petlan (2):
perf test attr: Propagate the return value from the test to the
wrapper
perf test attr: Fix wrong size expectation for events

The "Fixes" tag format is a bit different, but otherwise

I fixed the Fixes tags.

Quoted 1 line

Thanks, applied both patches,

- Arnaldo