mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: irogers@google.com,linux-kernel@vger.kernel.org,linux-trace-kernel@vger.kernel.org,linux-arch@vger.kernel.org
Cc: jpoimboe@kernel.org,rostedt@goodmis.org,peterz@infradead.org,mingo@redhat.com,tglx@kernel.org,bp@alien8.de,dave.hansen@linux.intel.com,x86@kernel.org,catalin.marinas@arm.com,will@kernel.org,mark.rutland@arm.com,linux-arm-kernel@lists.infradead.org,pjw@kernel.org,palmer@dabbelt.com,aou@eecs.berkeley.edu,alex@ghiti.fr,linux-riscv@lists.infradead.org,acme@kernel.org,namhyung@kernel.org,linux-perf-users@vger.kernel.org,mhiramat@kernel.org,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,bpf@vger.kernel.org,nathan@kernel.org,nsc@kernel.org,linux-kbuild@vger.kernel.org,ojeda@kernel.org,rust-for-linux@vger.kernel.org,ardb@kernel.org,linux-efi@vger.kernel.org,maz@kernel.org,oupton@kernel.org,kvmarm@lists.linux.dev,shuah@kernel.org,linux-kselftest@vger.kernel.org,indu.bhagat@oracle.com,jremus@linux.ibm.com,wnliu@google.com,dylanbhatch@google.com,irogers@google.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mas
	on@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [RFC PATCH v1 10/11] selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test
Date: Mon, 23 Nov 2026 00:40:12 +0000 (UTC)	[thread overview]
Message-ID: <3ae6b586116787e3221428028ac62cb6cd4fc70ba1740a541f515f78bb2c8ce0@mail.kernel.org> (raw)
In-Reply-To: <20261122235757.3456048-11-irogers@google.com>

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

> selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test

TL;DR:
- Selftest may report false "not ok" for 32-bit ARM builds on arm64 COMPAT
  kernels, since __arm__ is listed as supported (unverified)
- Redundant PERF_RECORD_CALLCHAIN_DEFERRED #ifndef (nit)

> diff --git a/tools/testing/selftests/perf_events/unwind_user_cfi.c b/tools/testing/selftests/perf_events/unwind_user_cfi.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/perf_events/unwind_user_cfi.c

[ ... ]

> +#include "../../../../include/linux/compiler_attributes.h"
> +
> +#ifndef PERF_RECORD_CALLCHAIN_DEFERRED
> +#define PERF_RECORD_CALLCHAIN_DEFERRED 22
> +#endif

this isn't a bug, but PERF_RECORD_CALLCHAIN_DEFERRED is an enumerator of
enum perf_event_type, not a preprocessor macro, so the #ifndef is always
true.

The defer_callchain and defer_output attr fields used later in main() come
from the same uapi change as the enumerator, so any header that compiles
this file already has it.

Could this #ifndef/#define fallback be dropped?

[ ... ]

> +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && \
> +	!defined(__arm__) && !defined(__riscv)
> +	ksft_test_result_skip("Architecture lacks Minimal DWARF CFI user unwind support\n");
> +	ksft_finished();
> +#endif

A subsystem pattern flags this as potentially concerning: exiting with a
status other than KSFT_SKIP when a feature is missing makes run_one()
record "not ok".

Is __arm__ correct in this list of supported architectures?

The kernel CFI user unwinder finds unwind data only through
PT_GNU_EH_FRAME.  parse_user_elf32_eh_hdr() returns -ENOENT without it:

    if (!have_load0 || !have_eh || !eh_memsz)
        return -ENOENT;

As far as I know, arm-linux-gnueabi(hf) toolchains emit ARM EHABI tables
(.ARM.exidx) rather than .eh_frame, so a normal AArch32 binary would have
no PT_GNU_EH_FRAME.  I did not have an ARM cross compiler to confirm this.

On a native arm32 kernel, arch/arm does not select HAVE_UNWIND_USER_FP or
HAVE_UNWIND_USER_CFI, so no deferred record arrives and the test reaches
its "No PERF_RECORD_CALLCHAIN_DEFERRED records" skip.

On an arm64 kernel with CONFIG_COMPAT, deferred records are produced since
unwind_user_cfi_arch() accepts ws == 4.  Each frame gets -ENOENT from
unwind_user_next_cfi(), and unwind_user_next() falls back to
unwind_user_next_fp(), which expects APCS frames at compat_fp (r11).  A
-fomit-frame-pointer build does not have those.

The record then stops after one or two entries and saw_full_chain stays
false:

    ksft_test_result(saw_full_chain, "unwind_user Minimal DWARF CFI across ...\n");
    ksft_finished();

ksft_finished() exits with KSFT_FAIL, so a 32-bit ARM build run on an
arm64 COMPAT kernel reports "not ok" because of an unsupported unwind
format rather than a kernel regression.

Should __arm__ be dropped from the supported list so the existing skip
runs, or should the test skip when the binary has no PT_GNU_EH_FRAME?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45087188604

  reply	other threads:[~2026-11-23  0:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 23:57 [RFC PATCH v1 00/11] unwind: Minimal DWARF CFI stack unwinding for x86, arm64, and riscv Ian Rogers
2026-11-22 23:57 ` [RFC PATCH v1 01/11] unwind: Add Minimal DWARF CFI bytecode interpreter and KUnit tests Ian Rogers
2026-11-23  0:40   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 02/11] unwind_user: Support Minimal DWARF CFI user-space unwinding Ian Rogers
2026-11-23  0:39   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 03/11] scripts, unwind: Add build-time .eh_frame minifier Ian Rogers
2026-11-23  0:40   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 04/11] objtool/ibt: Ignore .eh_frame relocations during ENDBR validation Ian Rogers
2026-11-22 23:57 ` [RFC PATCH v1 05/11] x86/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-23  0:56   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 06/11] arm64: unwind_user: Support Minimal DWARF CFI and FP user unwinding Ian Rogers
2026-11-22 23:57 ` [RFC PATCH v1 07/11] arm64/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-23  0:56   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 08/11] riscv: unwind_user: Support Minimal DWARF CFI and FP user unwinding Ian Rogers
2026-11-23  0:39   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 09/11] riscv/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-23  0:56   ` bot+bpf-ci
2026-11-22 23:57 ` [RFC PATCH v1 10/11] selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test Ian Rogers
2026-11-23  0:40   ` bot+bpf-ci [this message]
2026-11-22 23:57 ` [RFC PATCH v1 11/11] scripts: Add eh_frame_min.py .eh_frame coverage and size analyzer Ian Rogers
2026-11-23  0:39   ` bot+bpf-ci

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=3ae6b586116787e3221428028ac62cb6cd4fc70ba1740a541f515f78bb2c8ce0@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=acme@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=andrii@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=dylanbhatch@google.com \
    --cc=eddyz87@gmail.com \
    --cc=indu.bhagat@oracle.com \
    --cc=irogers@google.com \
    --cc=jpoimboe@kernel.org \
    --cc=jremus@linux.ibm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@kernel.org \
    --cc=maz@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=oupton@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=peterz@infradead.org \
    --cc=pjw@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=wnliu@google.com \
    --cc=x86@kernel.org \
    --cc=yonghong.song@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

all inboxes | Powered by JetHome®