Re: [PATCH v4 2/2] perf symbol: Lazily compute idle and use the perf_env

Namhyung Kim
2026-04-06T05:10:29Z

On Thu, Mar 26, 2026 at 09:50:25PM -0700, Ian Rogers wrote:
> Move the idle boolean to a helper symbol__is_idle function. In the
> function lazily compute whether a symbol is an idle function taking
> into consideration the kernel version and architecture of the
> machine. As symbols__insert no longer needs to know if a symbol is for
> the kernel, remove the argument.
>
> This change is inspired by mailing list discussion, particularly from
> Thomas Richter <tmricht@linux.ibm.com> and Heiko Carstens
> <hca@linux.ibm.com>:
> https://lore.kernel.org/lkml/20260219113850.354271-1-tmricht@linux.ibm.com/
>
> The change switches x86 matches to use strstarts which means
> intel_idle_irq is matched as part of strstarts(name, "intel_idle"), a
> change suggested by Honglei Wang <jameshongleiwang@126.com> in:
> https://lore.kernel.org/lkml/20260323085255.98173-1-jameshongleiwang@126.com/
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
[SNIP]
> + if (e_machine == EM_S390 && strstarts(name, "psw_idle")) {
> + int major = 0, minor = 0;
> + const char *release = env && env->os_release
> + ? env->os_release : perf_version_string;

I think Sashiko's review is right. You need to check the kernel version
instead of perf.

Thanks,
Namhyung

> +
> + /* Before v6.10, s390 used psw_idle. */
> + if (sscanf(release, "%d.%d", &major, &minor) != 2 ||
> + major < 6 || (major == 6 && minor < 10)) {
> + sym->idle = SYMBOL_IDLE__IDLE;
> + return true;
> + }
> + }
> +
> + sym->idle = SYMBOL_IDLE__NOT_IDLE;
> + return false;
> }