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 v10 2/7] bpf: Enable private stack for eligible subprogs
Date: Wed, 6 Nov 2024 18:41:49 -0800 [thread overview]
Message-ID: <20241107024149.3356316-1-yonghong.song@linux.dev> (raw)
In-Reply-To: <20241107024138.3355687-1-yonghong.song@linux.dev>
If private stack is requested by any subprog, set that subprog
prog->aux->priv_stack_requested to be true so later jit can allocate
private stack for that subprog properly.
Also set env->prog->aux->priv_stack_requested to be true if
subprog[0] requests private stack. This is a use case for a
single main prog (no subprogs) to use private stack.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
kernel/bpf/verifier.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 2284b909b499..09bb9dc939d6 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -6278,6 +6278,10 @@ static int check_max_stack_depth(struct bpf_verifier_env *env)
return ret;
}
}
+
+ if (si[0].priv_stack_mode == PRIV_STACK_ADAPTIVE)
+ env->prog->aux->priv_stack_requested = true;
+
return 0;
}
@@ -20211,6 +20215,9 @@ static int jit_subprogs(struct bpf_verifier_env *env)
func[i]->aux->name[0] = 'F';
func[i]->aux->stack_depth = env->subprog_info[i].stack_depth;
+ if (env->subprog_info[i].priv_stack_mode == PRIV_STACK_ADAPTIVE)
+ func[i]->aux->priv_stack_requested = true;
+
func[i]->jit_requested = 1;
func[i]->blinding_requested = prog->blinding_requested;
func[i]->aux->kfunc_tab = prog->aux->kfunc_tab;
--
2.43.5
next prev parent reply other threads:[~2024-11-07 2:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 2:41 [PATCH bpf-next v10 0/7] bpf: Support private stack for bpf progs Yonghong Song
2024-11-07 2:41 ` [PATCH bpf-next v10 1/7] bpf: Find eligible subprogs for private stack support Yonghong Song
2024-11-07 2:41 ` Yonghong Song [this message]
2024-11-08 19:11 ` [PATCH bpf-next v10 2/7] bpf: Enable private stack for eligible subprogs Alexei Starovoitov
2024-11-08 21:41 ` Yonghong Song
2024-11-07 2:41 ` [PATCH bpf-next v10 3/7] bpf, x86: Avoid repeated usage of bpf_prog->aux->stack_depth Yonghong Song
2024-11-07 2:41 ` [PATCH bpf-next v10 4/7] bpf, x86: Support private stack in jit Yonghong Song
2024-11-07 2:42 ` [PATCH bpf-next v10 5/7] selftests/bpf: Add tracing prog private stack tests Yonghong Song
2024-11-07 2:42 ` [PATCH bpf-next v10 6/7] bpf: Support private stack for struct_ops progs Yonghong Song
2024-11-07 19:20 ` Tejun Heo
2024-11-07 2:42 ` [PATCH bpf-next v10 7/7] selftests/bpf: Add struct_ops prog private stack tests 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=20241107024149.3356316-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