BPF List
 help / color / mirror / Atom feed
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,
	eddyz87@gmail.com, kernel-team@fb.com, martin.lau@kernel.org,
	mason@kernel.org, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 09/11] selftests/bpf: Test trampolines on more BPF functions with stack args
Date: Tue, 13 Oct 2026 07:31:04 -0700	[thread overview]
Message-ID: <95eb26fb-f44e-48df-a549-5c2a9959f88c@linux.dev> (raw)
In-Reply-To: <e1e2e14c0e37c53d1bee32ec10d50b60f46c645c37b2b1cbf832a66c8fb84967@mail.kernel.org>



On 10/13/26 3:28 AM, bot+bpf-ci@kernel.org wrote:
>> selftests/bpf: Test trampolines on more BPF functions with stack args
> TL;DR: Nit only: the callee_split() comment in the selftest says h is split
> between register and stack, but that is x86-64 specific; on arm64 nothing is
> split. Suggests saying so.
>
>> diff --git a/tools/testing/selftests/bpf/progs/tracing_struct_int128_tgt.c b/tools/testing/selftests/bpf/progs/tracing_struct_int128_tgt.c
>> --- a/tools/testing/selftests/bpf/progs/tracing_struct_int128_tgt.c
>> +++ b/tools/testing/selftests/bpf/progs/tracing_struct_int128_tgt.c
> [ ... ]
>
>> @@ -44,6 +44,25 @@ static __noinline __u64 callee_stack(__u64 a, __u64 b, __u64 c, __u64 d,
>>   	       i * 10;
>>   }
>>
>> +/* BPF code splits h between the last argument register and the stack. */
>> +static __noinline __u64 callee_split(__u64 a, __u64 b, __u64 c, __u64 d,
>> +				     __u64 e, struct int128_arg h, __u64 i)
>> +{
>> +	return a + b * 2 + c * 3 + d * 4 + e * 5 + (__u64)h.v * 6 +
>> +	       (__u64)((unsigned __int128)h.v >> 64) * 7 + i * 8;
>> +}
> This isn't a bug, but is this comment accurate for every architecture this
> test runs on?
>
> test_int128_tgt_prog() is built for x86-64 and for arm64, and a..e already
> occupy R1-R5 in BPF terms, so h and i are each stack arguments as far as
> the BPF ISA is concerned.
>
> The split between a register and the stack only comes from the x86-64 JIT,
> which maps the first stack argument slot to r9:
>
> arch/x86/net/bpf_jit_comp.c:x86_arg_reg[] = { BPF_REG_1, ..., BPF_REG_5,
> X86_REG_R9 }
>
> On arm64 the first three stack argument slots are mapped to x5-x7, so h
> would land in x5/x6 and i in x7, with nothing split.
>
> The commit message already says "on x86-64 it is passed split between r9
> and the stack", and the comment on the neighbouring callee_stack() names
> x86-64 and arm64 separately.
>
> Could this comment say that the split is x86-64 specific, for example "x86-64
> BPF code passes h in r9 and its first stack slot"?

You are right. The comment is not good. Will fix.

>
>
> ---
> 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/38329598343


  reply	other threads:[~2026-10-13 14:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  0:34 [PATCH bpf-next v2 00/11] bpf: Follow up by-value struct and __int128 argument support Yonghong Song
2026-10-13  0:34 ` [PATCH bpf-next v2 01/11] bpf, x86: Pass a trampoline's stack arguments by the calling convention Yonghong Song
2026-10-13  0:34 ` [PATCH bpf-next v2 02/11] selftests/bpf: Test trampoline stack args in a program that can tail call Yonghong Song
2026-10-13  0:34 ` [PATCH bpf-next v2 03/11] selftests/bpf: Test by-value __int128 kfunc arguments at an odd slot Yonghong Song
2026-10-13  0:34 ` [PATCH bpf-next v2 04/11] bpf: Describe a BPF function to its trampoline as one u64 per slot Yonghong Song
2026-10-13  0:34 ` [PATCH bpf-next v2 05/11] bpf, x86: Place trampoline arguments by the x86-64 calling convention Yonghong Song
2026-10-13  1:28   ` bot+bpf-ci
2026-10-13  0:34 ` [PATCH bpf-next v2 06/11] selftests/bpf: Test trampoline args around a 16-byte aligned stack arg Yonghong Song
2026-10-13  0:43   ` sashiko-bot
2026-10-13 14:07     ` Yonghong Song
2026-10-13  0:35 ` [PATCH bpf-next v2 07/11] selftests/bpf: Test trampoline args of a BPF function at an odd slot Yonghong Song
2026-10-13  0:35 ` [PATCH bpf-next v2 08/11] bpf: Refuse a trampoline on an unreliable static function with stack args Yonghong Song
2026-10-13  0:35 ` [PATCH bpf-next v2 09/11] selftests/bpf: Test trampolines on more BPF functions " Yonghong Song
2026-10-13  0:51   ` sashiko-bot
2026-10-13 14:25     ` Yonghong Song
2026-10-13  1:28   ` bot+bpf-ci
2026-10-13 14:31     ` Yonghong Song [this message]
2026-10-13  0:35 ` [PATCH bpf-next v2 10/11] bpf, x86: Pass a kfunc's 16-byte aligned stack argument 16-byte aligned Yonghong Song
2026-10-13  0:35 ` [PATCH bpf-next v2 11/11] selftests/bpf: Test that a kfunc gets a 16-byte aligned __int128 aligned Yonghong Song

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=95eb26fb-f44e-48df-a549-5c2a9959f88c@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=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=mason@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