From: Yonghong Song <yonghong.song@linux.dev>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eduard Zingerman <eddyz87@gmail.com>,
kernel-team@fb.com
Subject: [PATCH bpf-next v3 07/15] bpf: Rename bpf_call_summary::num_params to arg_slot_cnt
Date: Fri, 11 Sep 2026 08:49:49 -0700 [thread overview]
Message-ID: <20260911154949.2008169-1-yonghong.song@linux.dev> (raw)
In-Reply-To: <20260911154914.2004336-1-yonghong.song@linux.dev>
The field 'num_params' counts the argument registers and outgoing
stack slots a helper or kfunc call takes. The next patch gives a
16-byte parameter two slots, so the name stops describing what the
field holds.
Rename 'num_params' to 'arg_slot_cnt'. No functional change.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
include/linux/bpf_verifier.h | 2 +-
kernel/bpf/liveness.c | 10 +++++-----
kernel/bpf/verifier.c | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index edb904424aba..64dfa29f6b45 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -1066,7 +1066,7 @@ static inline bool bpf_ret_reg_pair(struct bpf_verifier_env *env, int subprog)
}
struct bpf_call_summary {
- u8 num_params;
+ u8 arg_slot_cnt;
bool is_void;
bool fastcall;
};
diff --git a/kernel/bpf/liveness.c b/kernel/bpf/liveness.c
index 7165ea325961..44ecdc5b4ec2 100644
--- a/kernel/bpf/liveness.c
+++ b/kernel/bpf/liveness.c
@@ -1434,21 +1434,21 @@ static int record_call_access(struct bpf_verifier_env *env,
{
struct bpf_insn *insn = &env->prog->insnsi[insn_idx];
struct bpf_call_summary cs;
- int r, err, num_params = 5;
+ int r, err, arg_slot_cnt = 5;
if (bpf_pseudo_call(insn))
return 0;
if (bpf_get_call_summary(env, insn, &cs))
- num_params = cs.num_params;
+ arg_slot_cnt = cs.arg_slot_cnt;
- for (r = BPF_REG_1; r < BPF_REG_1 + min(num_params, MAX_BPF_FUNC_REG_ARGS); r++) {
+ for (r = BPF_REG_1; r < BPF_REG_1 + min(arg_slot_cnt, MAX_BPF_FUNC_REG_ARGS); r++) {
err = record_arg_access(env, instance, insn, &at[r], r - 1, insn_idx);
if (err)
return err;
}
- for (r = 0; r < MAX_STACK_ARG_SLOTS && r < num_params - MAX_BPF_FUNC_REG_ARGS; r++) {
+ for (r = 0; r < MAX_STACK_ARG_SLOTS && r < arg_slot_cnt - MAX_BPF_FUNC_REG_ARGS; r++) {
err = record_arg_access(env, instance, insn, &at[MAX_BPF_REG + r],
r + MAX_BPF_FUNC_REG_ARGS, insn_idx);
if (err)
@@ -2199,7 +2199,7 @@ static void compute_insn_live_regs(struct bpf_verifier_env *env,
def = ALL_CALLER_SAVED_REGS;
use = def & ~BIT(BPF_REG_0);
if (bpf_get_call_summary(env, insn, &cs))
- use = GENMASK(min_t(u8, cs.num_params, MAX_BPF_FUNC_REG_ARGS), 1);
+ use = GENMASK(min_t(u8, cs.arg_slot_cnt, MAX_BPF_FUNC_REG_ARGS), 1);
def = mask_widen(def);
use = mask_widen(use);
break;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 500092a2c924..c520c37bb3c9 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -17973,11 +17973,11 @@ bool bpf_get_call_summary(struct bpf_verifier_env *env, struct bpf_insn *call,
(bpf_verifier_inlines_helper_call(env, call->imm) ||
bpf_jit_inlines_helper_call(call->imm));
cs->is_void = fn->ret_type == RET_VOID;
- cs->num_params = 0;
+ cs->arg_slot_cnt = 0;
for (i = 0; i < ARRAY_SIZE(fn->arg_type); ++i) {
if (fn->arg_type[i] == ARG_DONTCARE)
break;
- cs->num_params++;
+ cs->arg_slot_cnt++;
}
return true;
}
@@ -17989,7 +17989,7 @@ bool bpf_get_call_summary(struct bpf_verifier_env *env, struct bpf_insn *call,
if (err < 0)
/* error would be reported later */
return false;
- cs->num_params = btf_type_vlen(meta.func_proto);
+ cs->arg_slot_cnt = btf_type_vlen(meta.func_proto);
cs->fastcall = meta.kfunc_flags & KF_FASTCALL;
cs->is_void = btf_type_is_void(btf_type_by_id(meta.btf, meta.func_proto->type));
return true;
@@ -18098,7 +18098,7 @@ static void mark_fastcall_pattern_for_call(struct bpf_verifier_env *env,
* - includes R1-R5 if corresponding parameter has is described
* in the function prototype.
*/
- clobbered_regs_mask = GENMASK(cs.num_params, cs.is_void ? 1 : 0);
+ clobbered_regs_mask = GENMASK(cs.arg_slot_cnt, cs.is_void ? 1 : 0);
/* e.g. if helper call clobbers r{0,1}, expect r{2,3,4,5} in the pattern */
expected_regs_mask = ~clobbered_regs_mask & ALL_CALLER_SAVED_REGS;
--
2.52.0
next prev parent reply other threads:[~2026-09-11 15:50 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 15:49 [PATCH bpf-next v3 00/15] bpf: Support by-value struct and __int128 arguments Yonghong Song
2026-09-11 15:49 ` [PATCH bpf-next v3 01/15] bpf: Read a kfunc's __sz argument only when it is in a register Yonghong Song
2026-09-11 15:49 ` [PATCH bpf-next v3 02/15] selftests/bpf: Add a test for an __int128 by-value argument Yonghong Song
2026-09-11 16:47 ` bot+bpf-ci
2026-09-12 17:07 ` Yonghong Song
2026-09-11 15:49 ` [PATCH bpf-next v3 03/15] bpf: Rename bpf_subprog_info::arg_cnt to arg_slot_cnt Yonghong Song
2026-09-11 15:49 ` [PATCH bpf-next v3 04/15] bpf: Index global function arguments by argument slot Yonghong Song
2026-09-11 15:49 ` [PATCH bpf-next v3 05/15] bpf: Support by-value struct arguments up to 16 bytes Yonghong Song
2026-09-11 15:49 ` [PATCH bpf-next v3 06/15] bpf: Support __int128 as a by-value function argument Yonghong Song
2026-09-11 15:49 ` Yonghong Song [this message]
2026-09-11 15:49 ` [PATCH bpf-next v3 08/15] bpf: Recognize by-value struct and __int128 kfunc arguments Yonghong Song
2026-09-11 16:47 ` bot+bpf-ci
2026-09-12 17:13 ` Yonghong Song
2026-09-11 15:50 ` [PATCH bpf-next v3 09/15] bpf: Prepare kfunc arguments for the JIT from an ABI description Yonghong Song
2026-09-11 15:50 ` [PATCH bpf-next v3 10/15] bpf, x86: Move kfunc arguments into the x86-64 calling convention Yonghong Song
2026-09-11 16:47 ` bot+bpf-ci
2026-09-12 17:14 ` Yonghong Song
2026-09-11 15:50 ` [PATCH bpf-next v3 11/15] bpf, arm64: Move kfunc arguments into the arm64 " Yonghong Song
2026-09-11 16:19 ` sashiko-bot
2026-09-12 17:16 ` Yonghong Song
2026-09-11 16:47 ` bot+bpf-ci
2026-09-12 17:19 ` Yonghong Song
2026-09-11 15:50 ` [PATCH bpf-next v3 12/15] selftests/bpf: Add C tests for by-value arguments up to 16 bytes Yonghong Song
2026-09-11 15:50 ` [PATCH bpf-next v3 13/15] selftests/bpf: Add inline-asm tests for by-value arguments Yonghong Song
2026-09-11 16:06 ` sashiko-bot
2026-09-11 15:50 ` [PATCH bpf-next v3 14/15] selftests/bpf: Add tests for by-value kfunc arguments Yonghong Song
2026-09-11 16:47 ` bot+bpf-ci
2026-09-12 17:24 ` Yonghong Song
2026-09-11 15:50 ` [PATCH bpf-next v3 15/15] selftests/bpf: Temporary hack to disable register mismatch in arm64 Yonghong Song
2026-09-11 16:47 ` bot+bpf-ci
2026-09-12 3:57 ` Alexei Starovoitov
2026-09-12 17:30 ` 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=20260911154949.2008169-1-yonghong.song@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@fb.com \
/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 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.