Re: [RFC PATCH v1 10/11] selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test
From: bot+bpf-ci
Date: Sun Nov 22 2026 - 19:40:20 EST
> 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