Re: [PATCH v2 2/2] perf evsel: Don't configure framepointer callchains on s390

Thomas Richter
2026-03-12T12:45:38Z

[-- Attachment #1: Type: text/plain, Size: 3149 bytes --]

On 3/12/26 07:16, Ian Rogers wrote:
> Frame pointer callchains are not supported on s390. Ignore the option
> and print a warning.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> v2: Only disable user callchains as AI is telling me native "kernel"
> callchains are supported on s390.
> ---
> tools/perf/util/evsel.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index bd14d9bbc91f..fa21b48cba86 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1076,6 +1076,12 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o
> attr->exclude_callchain_user = 1;
> }
>
> + if (EM_HOST == EM_S390 && (evsel->core.attr.sample_type & PERF_SAMPLE_CALLCHAIN) &&
> + !evsel->core.attr.exclude_callchain_user) {
> + pr_warning("Excluding user callchains that are not supported on s390. Try '--call-graph dwarf'\n");
> + evsel->core.attr.exclude_callchain_user = 1;
> + }
> +
> if (param->defer && !attr->exclude_callchain_user)
> attr->defer_callchain = 1;
> }

Ian, thanks very much.
Your patch set helps a lot. However there is a small nit (which is mandatory). Please add these lines

evsel->core.attr.sample_type &= ~PERF_SAMPLE_CALLCHAIN;
evsel->core.attr.sample_type &= ~PERF_SAMPLE_REGS_USER;
evsel->core.attr.sample_type &= ~PERF_SAMPLE_STACK_USER;

to the new if(EM_HOST == ...) above.
The s390 CPU Measurement sampling device driver does not check on the attr.core.exclude_callchain_user
member, but on the sample_type bit mask. It returns -EOPNOTSUPP when this bit PERF_SAMPLE_CALLCHAIN
is set. This solves the invocation with command line flag -g as in
# ./perf record -v -e cycles -g -- perf test -w noploop
...
perf record: Captured and wrote 0.183 MB perf.data ]

Also I discovered that the fallback when using --call-graph dwarf command line flag still fails:
# ./perf record -v -e cycles --call-graph dwarf -- perf test -w noploop
...
Warning:
Trying to fall back to excluding guest samples
Error:
Failure to open event 'cycles:H' on PMU 'cpum_cf' which will be removed.
cycles:H: PMU Hardware doesn't support sampling overflow-interrupts. Try 'perf stat'
Error:
Failure to open any events for recording.

The reason is in __evsel__config_callchain() which calls evsel__set_sample_bit(evsel, CALLCHAIN)
and sets the PERF_SAMPLE_CALLCHAIN bit in evsel->core.attr.sample_type. It also sets the
member attr->exclude_callchain_user = 1 and sets bits REGS_USER and _STACK_USER.
All three bits are not supported by s390.

I have modified your 2nd patch and appended it.

I find all these bits in sample_type and the attr.exclude_XXX stuff very confusing. If there
is a more consistant way of checking these feature, please let me know.

Thanks again for looking into this.
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

[-- Attachment #2: 0001-perf-evsel-Don-t-configure-framepointer-callchains-o.patch --]
[-- Type: text/x-patch, Size: 1269 bytes --]

From fa7720071277e7f892c9d81f2e277c4ae0359054 Mon Sep 17 00:00:00 2001
From: Ian Rogers <irogers@google.com>
Date: Wed, 11 Mar 2026 23:16:28 -0700
Subject: [PATCH] perf evsel: Don't configure framepointer callchains on s390

Frame pointer callchains are not supported on s390. Ignore the option
and print a warning.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/evsel.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index bd14d9bbc91f..ec4c6d8a736d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1076,6 +1076,14 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o
attr->exclude_callchain_user = 1;
}

+ if (EM_HOST == EM_S390 && (evsel->core.attr.sample_type & PERF_SAMPLE_CALLCHAIN)) {
+ pr_warning("Excluding user callchains that are not supported on s390. Try '--call-graph dwarf'\n");
+ evsel->core.attr.exclude_callchain_user = 1;
+ evsel->core.attr.sample_type &= ~PERF_SAMPLE_CALLCHAIN;
+ evsel->core.attr.sample_type &= ~PERF_SAMPLE_REGS_USER;
+ evsel->core.attr.sample_type &= ~PERF_SAMPLE_STACK_USER;
+ }
+
if (param->defer && !attr->exclude_callchain_user)
attr->defer_callchain = 1;
}
--
2.53.0