Re: [PATCH bpf-next v5 07/16] bpf: Reuse MAX_BPF_FUNC_ARGS for maximum number of arguments

Yonghong Song
2026-04-18T17:03:41Z

On 4/17/26 5:52 PM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
>> --- a/include/linux/bpf.h
>> +++ b/include/linux/bpf.h
>> @@ -1151,6 +1151,10 @@ struct bpf_prog_offload {
>>
>> -/* The longest tracepoint has 12 args.
>> +/* The longest tracepoint has 12 args.
> This isn't a bug, but the multi-line comment opening doesn't follow BPF
> subsystem style. Per bpf.md: 'Multi-line comments MUST have the opening
> /* on its own line'. The rule applies even if surrounding code uses the
> old style.
>
> Should this be reformatted as:
>
> /*
> * The longest tracepoint has 12 args.
> * See include/trace/bpf_probe.h
> *
> * Also reuse this macro for maximum number of arguments a BPF function
> * or a kfunc can have. Args 1-5 are passed in registers, args 6-12 via
> * stack arg slots.
> */
>
>> * See include/trace/bpf_probe.h
>> + *
>> + * Also reuse this macro for maximum number of arguments a BPF function
>> + * or a kfunc can have. Args 1-5 are passed in registers, args 6-12 via
> Should this say "kfuncs" instead of "kfunc's"? The context is plural
> (referring to multiple functions), not possessive.
>
> Additionally, bot+bpf-ci@kernel.org raised a concern in v5 about the
> calling convention description. The comment states "Args 1-5 are passed
> in registers, args 6-12 via stack arg slots," but argument 6 is actually
> passed in the R9 register, not on the stack.
>
> Looking at arch/x86/net/bpf_jit_comp.c, the existing comment states:
> "x86-64 supports up to MAX_BPF_FUNC_ARGS arguments. 1-6 are passed
> through regs, the remains are through stack."
>
> The follow-up commit 0ef907c3ec2c in this patch series documents the
> actual calling convention as: "Follow x86-64 calling convention for both
> BPF-to-BPF and kfunc calls: - Arg 6 is passed in the R9 register - Args
> 7+ are passed on the stack at [rsp]"
>
> Should the comment say "Args 1-5 are passed in registers, arg 6 in R9
> register, args 7-12 via stack arg slots" instead?

See previous comment:

The JIT may map some stack arg slots to registers based on the native calling
convention (e.g., arg 6 to R9 on x86-64).

This should clarify.

>
> Reference: https://lore.kernel.org/bpf/d23db60b9c7e22d8ab443688b4f2da8d5594d6c07698cdc282faccaade757430@mail.kernel.org/
>
>> + * stack arg slots.
>> */
>> #define MAX_BPF_FUNC_ARGS 12
>>
>
> ---
> 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/24592562564