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

bot+bpf-ci
2026-04-17T04:30:07Z

[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]

> 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.
> * 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.

Is this description of the calling convention accurate? The comment states
"Args 1-5 are passed in registers, args 6-12 via stack arg slots," but
doesn't argument 6 get passed in the R9 register rather than 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 ("bpf,x86: Implement
JIT support for stack arguments") 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?

> */
> #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/24546989054