BPF List
 help / color / mirror / Atom feed
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>,
	kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>,
	Tejun Heo <tj@kernel.org>
Subject: [PATCH bpf-next v6 2/9] bpf: Rename bpf_struct_ops_arg_info to bpf_struct_ops_func_info
Date: Sun, 20 Oct 2024 12:13:53 -0700	[thread overview]
Message-ID: <20241020191353.2105313-1-yonghong.song@linux.dev> (raw)
In-Reply-To: <20241020191341.2104841-1-yonghong.song@linux.dev>

In the subsequent patch, some not argument information will be added to
struct bpf_struct_ops_arg_info. So let us rename the struct to
bpf_struct_ops_func_info. No functionality change.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 include/linux/bpf.h         |  4 ++--
 kernel/bpf/bpf_struct_ops.c | 36 ++++++++++++++++++------------------
 kernel/bpf/verifier.c       |  4 ++--
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 6ad8ace7075a..f3884ce2603d 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1773,7 +1773,7 @@ struct bpf_struct_ops {
  * btf_ctx_access() will lookup prog->aux->ctx_arg_info to find the
  * corresponding entry for an given argument.
  */
-struct bpf_struct_ops_arg_info {
+struct bpf_struct_ops_func_info {
 	struct bpf_ctx_arg_aux *info;
 	u32 cnt;
 };
@@ -1787,7 +1787,7 @@ struct bpf_struct_ops_desc {
 	u32 value_id;
 
 	/* Collection of argument information for each member */
-	struct bpf_struct_ops_arg_info *arg_info;
+	struct bpf_struct_ops_func_info *func_info;
 };
 
 enum bpf_struct_ops_state {
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
index fda3dd2ee984..8279b5a57798 100644
--- a/kernel/bpf/bpf_struct_ops.c
+++ b/kernel/bpf/bpf_struct_ops.c
@@ -182,11 +182,11 @@ find_stub_func_proto(const struct btf *btf, const char *st_op_name,
 /* Prepare argument info for every nullable argument of a member of a
  * struct_ops type.
  *
- * Initialize a struct bpf_struct_ops_arg_info according to type info of
+ * Initialize a struct bpf_struct_ops_func_info according to type info of
  * the arguments of a stub function. (Check kCFI for more information about
  * stub functions.)
  *
- * Each member in the struct_ops type has a struct bpf_struct_ops_arg_info
+ * Each member in the struct_ops type has a struct bpf_struct_ops_func_info
  * to provide an array of struct bpf_ctx_arg_aux, which in turn provides
  * the information that used by the verifier to check the arguments of the
  * BPF struct_ops program assigned to the member. Here, we only care about
@@ -196,14 +196,14 @@ find_stub_func_proto(const struct btf *btf, const char *st_op_name,
  * prog->aux->ctx_arg_info of BPF struct_ops programs and passed to the
  * verifier. (See check_struct_ops_btf_id())
  *
- * arg_info->info will be the list of struct bpf_ctx_arg_aux if success. If
+ * func_info->info will be the list of struct bpf_ctx_arg_aux if success. If
  * fails, it will be kept untouched.
  */
-static int prepare_arg_info(struct btf *btf,
+static int prepare_func_info(struct btf *btf,
 			    const char *st_ops_name,
 			    const char *member_name,
 			    const struct btf_type *func_proto,
-			    struct bpf_struct_ops_arg_info *arg_info)
+			    struct bpf_struct_ops_func_info *func_info)
 {
 	const struct btf_type *stub_func_proto, *pointed_type;
 	const struct btf_param *stub_args, *args;
@@ -282,8 +282,8 @@ static int prepare_arg_info(struct btf *btf,
 	}
 
 	if (info_cnt) {
-		arg_info->info = info_buf;
-		arg_info->cnt = info_cnt;
+		func_info->info = info_buf;
+		func_info->cnt = info_cnt;
 	} else {
 		kfree(info_buf);
 	}
@@ -296,17 +296,17 @@ static int prepare_arg_info(struct btf *btf,
 	return -EINVAL;
 }
 
-/* Clean up the arg_info in a struct bpf_struct_ops_desc. */
+/* Clean up the func_info in a struct bpf_struct_ops_desc. */
 void bpf_struct_ops_desc_release(struct bpf_struct_ops_desc *st_ops_desc)
 {
-	struct bpf_struct_ops_arg_info *arg_info;
+	struct bpf_struct_ops_func_info *func_info;
 	int i;
 
-	arg_info = st_ops_desc->arg_info;
+	func_info = st_ops_desc->func_info;
 	for (i = 0; i < btf_type_vlen(st_ops_desc->type); i++)
-		kfree(arg_info[i].info);
+		kfree(func_info[i].info);
 
-	kfree(arg_info);
+	kfree(func_info);
 }
 
 int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
@@ -314,7 +314,7 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
 			     struct bpf_verifier_log *log)
 {
 	struct bpf_struct_ops *st_ops = st_ops_desc->st_ops;
-	struct bpf_struct_ops_arg_info *arg_info;
+	struct bpf_struct_ops_func_info *func_info;
 	const struct btf_member *member;
 	const struct btf_type *t;
 	s32 type_id, value_id;
@@ -359,12 +359,12 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
 	if (!is_valid_value_type(btf, value_id, t, value_name))
 		return -EINVAL;
 
-	arg_info = kcalloc(btf_type_vlen(t), sizeof(*arg_info),
+	func_info = kcalloc(btf_type_vlen(t), sizeof(*func_info),
 			   GFP_KERNEL);
-	if (!arg_info)
+	if (!func_info)
 		return -ENOMEM;
 
-	st_ops_desc->arg_info = arg_info;
+	st_ops_desc->func_info = func_info;
 	st_ops_desc->type = t;
 	st_ops_desc->type_id = type_id;
 	st_ops_desc->value_id = value_id;
@@ -403,9 +403,9 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
 			goto errout;
 		}
 
-		err = prepare_arg_info(btf, st_ops->name, mname,
+		err = prepare_func_info(btf, st_ops->name, mname,
 				       func_proto,
-				       arg_info + i);
+				       func_info + i);
 		if (err)
 			goto errout;
 	}
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 45bea4066272..ccfe159cfbde 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -21880,9 +21880,9 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env)
 
 	/* btf_ctx_access() used this to provide argument type info */
 	prog->aux->ctx_arg_info =
-		st_ops_desc->arg_info[member_idx].info;
+		st_ops_desc->func_info[member_idx].info;
 	prog->aux->ctx_arg_info_size =
-		st_ops_desc->arg_info[member_idx].cnt;
+		st_ops_desc->func_info[member_idx].cnt;
 
 	prog->aux->attach_func_proto = func_proto;
 	prog->aux->attach_func_name = mname;
-- 
2.43.5


  parent reply	other threads:[~2024-10-20 19:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-20 19:13 [PATCH bpf-next v6 0/9] bpf: Support private stack for bpf progs Yonghong Song
2024-10-20 19:13 ` [PATCH bpf-next v6 1/9] bpf: Allow each subprog having stack size of 512 bytes Yonghong Song
2024-10-22  1:18   ` Alexei Starovoitov
2024-10-22  3:21     ` Yonghong Song
2024-10-22  3:43       ` Alexei Starovoitov
2024-10-22  4:08         ` Yonghong Song
2024-10-22 20:13         ` Yonghong Song
2024-10-22 20:41           ` Alexei Starovoitov
2024-10-22 21:29             ` Kumar Kartikeya Dwivedi
2024-10-22 21:36               ` Kumar Kartikeya Dwivedi
2024-10-22 21:43             ` Yonghong Song
2024-10-22 21:57               ` Alexei Starovoitov
2024-10-22 22:41                 ` Yonghong Song
2024-10-22 22:59                   ` Alexei Starovoitov
2024-10-22 23:53                     ` Yonghong Song
2024-10-20 19:13 ` Yonghong Song [this message]
2024-10-20 19:13 ` [PATCH bpf-next v6 3/9] bpf: Support private stack for struct ops programs Yonghong Song
2024-10-22  1:34   ` Alexei Starovoitov
2024-10-22  2:59     ` Yonghong Song
2024-10-22 17:26     ` Martin KaFai Lau
2024-10-22 20:19       ` Alexei Starovoitov
2024-10-23 21:00         ` Tejun Heo
2024-10-23 23:07           ` Alexei Starovoitov
2024-10-24  0:56             ` Tejun Heo
2024-10-20 19:14 ` [PATCH bpf-next v6 4/9] bpf: Mark each subprog with proper private stack modes Yonghong Song
2024-10-20 22:01   ` Jiri Olsa
2024-10-21  4:22     ` Yonghong Song
2024-10-20 19:14 ` [PATCH bpf-next v6 5/9] bpf, x86: Refactor func emit_prologue Yonghong Song
2024-10-20 19:14 ` [PATCH bpf-next v6 6/9] bpf, x86: Create a helper for certain "reg <op>= imm" operations Yonghong Song
2024-10-20 19:14 ` [PATCH bpf-next v6 7/9] bpf, x86: Add jit support for private stack Yonghong Song
2024-10-20 19:14 ` [PATCH bpf-next v6 8/9] selftests/bpf: Add tracing prog private stack tests Yonghong Song
2024-10-20 21:59   ` Jiri Olsa
2024-10-21  4:32     ` Yonghong Song
2024-10-21 10:40       ` Jiri Olsa
2024-10-21 16:19         ` Yonghong Song
2024-10-21 21:13           ` Jiri Olsa
2024-10-20 19:14 ` [PATCH bpf-next v6 9/9] selftests/bpf: Add struct_ops " 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=20241020191353.2105313-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=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=tj@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