Re: [RFC PATCH v2 20/30] selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test
From: bot+bpf-ci
Date: Wed Nov 25 2026 - 02:06:02 EST
> selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test
TL;DR: Test issues only, low severity: unwind_user_cfi.c includes a
kernel-internal header and #undefs macros, and may report "not ok" instead of
skip when perf_event_open returns ENOSYS.
> 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
> index 000000000000..a36e9f4d39e2
> --- /dev/null
> +++ b/tools/testing/selftests/perf_events/unwind_user_cfi.c
> @@ -0,0 +1,482 @@
[ ... ]
> +#include "../kselftest.h"
> +#undef __always_inline
> +#undef __attribute_const__
> +#undef __must_check
> +#undef __printf
> +#include "../../../../include/linux/compiler_attributes.h"
This isn't a bug, but would it be simpler to spell the few attributes this
test needs directly, for example __attribute__((noinline, noclone)) and
__attribute__((aligned(64))), instead of including
include/linux/compiler_attributes.h and #undef'ing the clashing macros
first?
>From tools/testing/selftests/perf_events/ that path resolves to the
kernel-internal include/linux/ header rather than a tools/include copy, and
no other selftest includes a kernel-internal header this way. Also,
__must_check is not defined by either earlier include, so that #undef
appears to do nothing.
[ ... ]
> + fd = (int)sys_perf_event_open(&attr, /*pid=*/0, /*cpu=*/-1,
> + /*group_fd=*/-1, /*flags=*/0);
> + if (fd < 0) {
> + if (jit_page != MAP_FAILED)
> + munmap(jit_page, page_sz);
> + if (errno == EACCES || errno == EPERM || errno == EINVAL) {
> + ksft_test_result_skip("perf_event_open(defer_callchain) unavailable: %s\n",
> + strerror(errno));
> + ksft_finished();
> + }
> + ksft_exit_fail_msg("perf_event_open failed: %s\n", strerror(errno));
> + }
Should ENOSYS be treated as a skip here as well?
On a kernel built without CONFIG_PERF_EVENTS, perf_event_open is a
COND_SYSCALL and returns -ENOSYS, so main() reaches ksft_exit_fail_msg()
and the runner records "not ok" instead of a skip. The selftests guide
flags exiting nonzero other than KSFT_SKIP when a feature or config option
is missing.
The other missing prerequisites in main() (unsupported architecture, no
PT_GNU_EH_FRAME, defer bits unknown to an older kernel) are already
reported as skips, so adding ENOSYS to the errno check would make this case
consistent with them. The neighbouring perf_events tests also fail rather
than skip when perf_event_open() fails, so this is low severity.
---
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/45561209846