* [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases
@ 2026-11-18 7:33 Yun Lu
2026-11-18 8:12 ` bot+bpf-ci
2026-11-19 1:49 ` Alexei Starovoitov
0 siblings, 2 replies; 4+ messages in thread
From: Yun Lu @ 2026-11-18 7:33 UTC (permalink / raw)
To: andrii, eddyz87, ihor.solodrai, ast, daniel, memxor, martin.lau,
song, yonghong.song, jolsa, emil, shuah
Cc: bpf, linux-kselftest
From: Yun Lu <luyun@kylinos.cn>
The test matrix groups targets by the side effect under test.
ARRAY_SIZE(mains) gives the number of groups, so using it as the
target loop bound skips the two standalone entry-point targets in
each group.
Use the target and replacement counts from the current group and
derive the group count from mains. This restores four packet-data
cases and enables four sleepable-program cases.
Fixes: 72ed076abf54 ("selftests/bpf: Add tests for extending sleepable global subprogs")
Reported-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Yun Lu <luyun@kylinos.cn>
---
tools/testing/selftests/bpf/prog_tests/summarization.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/summarization.c b/tools/testing/selftests/bpf/prog_tests/summarization.c
index 3e4bcf071735..f51b203eca8a 100644
--- a/tools/testing/selftests/bpf/prog_tests/summarization.c
+++ b/tools/testing/selftests/bpf/prog_tests/summarization.c
@@ -116,9 +116,9 @@ void test_summarization_freplace(void)
};
char buf[64];
- for (int t = 0; t < 2; t++) {
- for (int i = 0; i < ARRAY_SIZE(mains); ++i) {
- for (int j = 0; j < ARRAY_SIZE(replacements); ++j) {
+ for (int t = 0; t < ARRAY_SIZE(mains); t++) {
+ for (int i = 0; i < ARRAY_SIZE(mains[t]); ++i) {
+ for (int j = 0; j < ARRAY_SIZE(replacements[t]); ++j) {
snprintf(buf, sizeof(buf), "%s_with_%s",
mains[t][i].to_be_replaced, replacements[t][j].func);
if (!test__start_subtest(buf))
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases
2026-11-18 7:33 [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases Yun Lu
@ 2026-11-18 8:12 ` bot+bpf-ci
2026-11-19 1:49 ` Alexei Starovoitov
1 sibling, 0 replies; 4+ messages in thread
From: bot+bpf-ci @ 2026-11-18 8:12 UTC (permalink / raw)
To: luyun_611, andrii, eddyz87, ihor.solodrai, ast, daniel, memxor,
martin.lau, song, yonghong.song, jolsa, emil, shuah
Cc: bpf, linux-kselftest, ast, andrii, daniel, martin.lau, eddyz87,
yonghong.song, mason, ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 3155 bytes --]
> selftests/bpf: Run all summarization freplace cases
TL;DR: The four newly enabled sleepable freplace selftests will likely fail on
arm64 and s390, because main_might_sleep and main_does_not_sleep lack
__arg_ctx and the extension is rejected; they only work on x86.
> diff --git a/tools/testing/selftests/bpf/prog_tests/summarization.c b/tools/testing/selftests/bpf/prog_tests/summarization.c
> --- a/tools/testing/selftests/bpf/prog_tests/summarization.c
> +++ b/tools/testing/selftests/bpf/prog_tests/summarization.c
[ ... ]
> @@ -116,9 +116,9 @@ void test_summarization_freplace(void)
> };
> char buf[64];
>
> - for (int t = 0; t < 2; t++) {
> - for (int i = 0; i < ARRAY_SIZE(mains); ++i) {
> - for (int j = 0; j < ARRAY_SIZE(replacements); ++j) {
> + for (int t = 0; t < ARRAY_SIZE(mains); t++) {
> + for (int i = 0; i < ARRAY_SIZE(mains[t]); ++i) {
> + for (int j = 0; j < ARRAY_SIZE(replacements[t]); ++j) {
The four sleepable cases that now run (main_might_sleep_with_* and
main_does_not_sleep_with_*) look likely to fail on arm64 and s390.
The replaced main programs in progs/summarization.c take an untagged
pt_regs pointer:
SEC("?uprobe.s")
int main_might_sleep(struct pt_regs *ctx)
SEC("?uprobe.s")
int main_does_not_sleep(struct pt_regs *ctx)
When the target loads, do_check_common() calls btf_prepare_func_args() for
the main function, and the argument is only treated as ARG_PTR_TO_CTX if
btf_is_prog_ctx_type() matches it against bpf_user_pt_regs_t:
- x86: typedef struct pt_regs bpf_user_pt_regs_t, so the name matches.
- arm64: typedef struct user_pt_regs bpf_user_pt_regs_t, which does not
match "pt_regs".
- s390: typedef user_pt_regs bpf_user_pt_regs_t is an anonymous struct, so
the tname is empty and the check fails.
On arm64 and s390 the argument then becomes ARG_PTR_TO_MEM | PTR_MAYBE_NULL
and func_info_aux[0].unreliable is set. libbpf does not rewrite it since
there is no arg:ctx decl tag.
Then bpf_check_attach_target() rejects the extension first:
conservative = aux->func_info_aux[subprog].unreliable;
if (prog_extension) {
if (aux->func_info_aux[subprog].linkage != BTF_FUNC_GLOBAL ||
conservative) {
bpf_log(log, "Cannot replace static functions\n");
return -EINVAL;
}
test_aux() expects the load to fail with "Cannot extend a function that
runs without RCU read lock", and ASSERT_HAS_SUBSTR() on the log will not
find that string. All four subtests would fail on aarch64 and s390x, both
of which are in the BPF CI matrix.
The sleepable subprogram variants avoid this by using
"struct pt_regs *ctx __arg_ctx".
Should main_might_sleep() and main_does_not_sleep() get __arg_ctx on their
arguments (or use bpf_user_pt_regs_t *) so the cases work on every
architecture? As it stands, the claim that the patch "enables four
sleepable-program cases" holds only for x86_64.
---
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/44261555055
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases
2026-11-18 7:33 [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases Yun Lu
2026-11-18 8:12 ` bot+bpf-ci
@ 2026-11-19 1:49 ` Alexei Starovoitov
2026-11-19 2:09 ` luyun
1 sibling, 1 reply; 4+ messages in thread
From: Alexei Starovoitov @ 2026-11-19 1:49 UTC (permalink / raw)
To: Yun Lu, andrii, eddyz87, ihor.solodrai, daniel, memxor,
martin.lau, song, yonghong.song, jolsa, emil, shuah
Cc: bpf, linux-kselftest
On Tue, Nov 17, 2026 at 11:33 PM Yun Lu <luyun_611@163.com> wrote:
> derive the group count from mains. This restores four packet-data
> cases and enables four sleepable-program cases.
The four sleepable cases will fail on arm64 and s390x.
Their targets have no __arg_ctx:
int main_might_sleep(struct pt_regs *ctx)
int main_does_not_sleep(struct pt_regs *ctx)
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases
2026-11-19 1:49 ` Alexei Starovoitov
@ 2026-11-19 2:09 ` luyun
0 siblings, 0 replies; 4+ messages in thread
From: luyun @ 2026-11-19 2:09 UTC (permalink / raw)
To: Alexei Starovoitov, andrii, eddyz87, ihor.solodrai, daniel,
memxor, martin.lau, song, yonghong.song, jolsa, emil, shuah
Cc: bpf, linux-kselftest
在 2026/11/19 09:49, Alexei Starovoitov 写道:
> On Tue, Nov 17, 2026 at 11:33 PM Yun Lu <luyun_611@163.com> wrote:
>> derive the group count from mains. This restores four packet-data
>> cases and enables four sleepable-program cases.
> The four sleepable cases will fail on arm64 and s390x.
> Their targets have no __arg_ctx:
>
> int main_might_sleep(struct pt_regs *ctx)
> int main_does_not_sleep(struct pt_regs *ctx)
>
> pw-bot: cr
Hi Alexei,
The bpf-ci also confirmed that all four cases fail on arm64 and s390x.
The verifier rejects the target before it reaches the intended RCU
read-lock check.
I'll add __arg_ctx to the ctx parameters of main_might_sleep() and
main_does_not_sleep() in v2 version.
---
Thanks,
Yun Lu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-19 2:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 7:33 [PATCH bpf-next] selftests/bpf: Run all summarization freplace cases Yun Lu
2026-11-18 8:12 ` bot+bpf-ci
2026-11-19 1:49 ` Alexei Starovoitov
2026-11-19 2:09 ` luyun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.