From: Leon Hwang <hffilwlqm@gmail.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
maciej.fijalkowski@intel.com, jakub@cloudflare.com,
pulehui@huawei.com, hengqi.chen@gmail.com, hffilwlqm@gmail.com,
kernel-patches-bot@fb.com
Subject: [PATCH bpf-next v3 1/3] bpf: Add bpf_tail_call_cnt to task_struct
Date: Tue, 2 Apr 2024 23:26:36 +0800 [thread overview]
Message-ID: <20240402152638.31377-2-hffilwlqm@gmail.com> (raw)
In-Reply-To: <20240402152638.31377-1-hffilwlqm@gmail.com>
In order to get rid of propagating tail call counter by rax and stack,
it's to store tail call counter at task_struct.
Then, at the prologue of bpf prog, it has to initialise the tail call
counter at task_struct. And when tail call happens, it has to compare
and increment the tail call counter at task_struct.
Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
---
include/linux/sched.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3c2abbc587b49..d0696fcabf14f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1501,6 +1501,8 @@ struct task_struct {
struct bpf_local_storage __rcu *bpf_storage;
/* Used for BPF run context */
struct bpf_run_ctx *bpf_ctx;
+ /* Used for BPF run time */
+ u32 bpf_tail_call_cnt;
#endif
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
--
2.44.0
next prev parent reply other threads:[~2024-04-02 15:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 15:26 [PATCH bpf-next v3 0/3] bpf, x64: Fix tailcall hierarchy Leon Hwang
2024-04-02 15:26 ` Leon Hwang [this message]
2024-04-02 15:26 ` [PATCH bpf-next v3 2/3] " Leon Hwang
2024-04-05 1:03 ` Alexei Starovoitov
2024-04-07 11:34 ` Leon Hwang
2024-04-07 16:30 ` Alexei Starovoitov
2024-04-10 14:09 ` Leon Hwang
2024-04-11 3:42 ` Alexei Starovoitov
2024-04-14 11:47 ` Leon Hwang
2024-04-02 15:26 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add testcases for tailcall hierarchy fixing Leon Hwang
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=20240402152638.31377-2-hffilwlqm@gmail.com \
--to=hffilwlqm@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hengqi.chen@gmail.com \
--cc=jakub@cloudflare.com \
--cc=kernel-patches-bot@fb.com \
--cc=maciej.fijalkowski@intel.com \
--cc=pulehui@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox