From: Yonghong Song <yonghong.song@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
kernel-team@fb.com, martin.lau@kernel.org, eddyz87@gmail.com,
clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 1/2] selftests/bpf: Keep int return type for tailcall subprogs
Date: Tue, 9 Jun 2026 20:45:13 -0700 [thread overview]
Message-ID: <811b9cd4-829e-4a02-8265-ea0f64d7991f@linux.dev> (raw)
In-Reply-To: <5ece679164a4c99cbba93f55c2f9609be6e315d4813737a15b083c9f7dffa17f@mail.kernel.org>
On 6/9/26 5:07 PM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2.c b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2.c
>> index ce97d141daee..c4fadee5aadc 100644
>> --- a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2.c
>> +++ b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2.c
> [ ... ]
>
>> diff --git a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
>> index ae94c9c70ab7..6fde0ab92148 100644
>> --- a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
>> +++ b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
>> @@ -25,8 +25,11 @@ int count1 = 0;
>> static __noinline
>> int subprog_tail0(struct __sk_buff *skb)
>> {
>> + int ret = 0;
>> +
>> bpf_tail_call_static(skb, &jmp_table, 0);
>> - return 0;
>> + barrier_var(ret);
>> + return ret;
>> }
>>
>> __auxiliary
>> SEC("tc")
>> int classifier_0(struct __sk_buff *skb)
>> {
>> count0++;
>> subprog_tail0(skb);
>> return 0;
>> }
> The patch adds barrier_var() to subprog_tail0() to prevent the compiler
> from optimizing its return type from int to void. However, is the
> approach sufficient for classifier_0()?
>
> Looking at how the patch handles other callers like classifier_1():
>
>> @@ -41,16 +44,22 @@ int classifier_0(struct __sk_buff *skb)
>> static __noinline
>> int subprog_tail1(struct __sk_buff *skb)
>> {
>> + int ret = 0;
>> +
>> bpf_tail_call_static(skb, &jmp_table, 1);
>> - return 0;
>> + barrier_var(ret);
>> + return ret;
>> }
>>
>> __auxiliary
>> SEC("tc")
>> int classifier_1(struct __sk_buff *skb)
>> {
>> + int ret;
>> +
>> count1++;
>> - subprog_tail1(skb);
>> + ret = subprog_tail1(skb);
>> + __sink(ret);
>> return 0;
>> }
> In classifier_1(), the return value is captured and passed to __sink().
> This creates a use at the callsite that forces the compiler to preserve
> the int return type.
>
> Without capturing and sinking the return value in classifier_0(), could
> LLVM still create a void-returning clone of subprog_tail0() for this
> specific callsite? While subprog_tail0() is also called from
> tailcall_bpf2bpf_hierarchy_2() where its return value is properly sunk,
> the compiler might still specialize the function differently for the two
> callsites.
We should be fine. In the same file, we have SEC("tc")
__success
__retval(33)
SEC("tc")
int tailcall_bpf2bpf_hierarchy_2(struct __sk_buff *skb)
{
int ret = 0, ret1, ret2;
clobber_regs_stack();
ret1 = subprog_tail0(skb);
ret2 = subprog_tail1(skb);
__sink(ret1);
__sink(ret2);
__sink(ret);
return (count1 << 16) | count0;
}
This will guarantee subprog_tail0() will have a return value.
>
> [ ... ]
>
>
> ---
> 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/27243286945
next prev parent reply other threads:[~2026-06-10 3:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 23:34 [PATCH bpf-next v2 0/2] selftests/bpf: Fix tests for llvm23 true signature Yonghong Song
2026-06-09 23:34 ` [PATCH bpf-next v2 1/2] selftests/bpf: Keep int return type for tailcall subprogs Yonghong Song
2026-06-09 23:42 ` sashiko-bot
2026-06-10 3:41 ` Yonghong Song
2026-06-10 4:06 ` Yonghong Song
2026-06-10 0:07 ` bot+bpf-ci
2026-06-10 3:45 ` Yonghong Song [this message]
2026-06-09 23:34 ` [PATCH bpf-next v2 2/2] selftests/bpf: Adjust fexit_bpf2bpf ctx layout for llvm23 true signature Yonghong Song
2026-06-10 4:30 ` [PATCH bpf-next v2 0/2] selftests/bpf: Fix tests " patchwork-bot+netdevbpf
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=811b9cd4-829e-4a02-8265-ea0f64d7991f@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
/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