Thread (19 messages) 19 messages, 5 authors, 2026-01-06

Re: [PATCH bpf-next v6 00/10] bpf: fsession support

From: Menglong Dong <hidden>
Date: 2026-01-06 07:11:22
Also in: bpf, lkml

On 2026/1/6 12:20 Alexei Starovoitov [off-list ref] write:
On Mon, Jan 5, 2026 at 7:05 PM Menglong Dong [off-list ref] wrote:
quoted
On 2026/1/6 05:20 Andrii Nakryiko [off-list ref] write:
quoted
On Sun, Jan 4, 2026 at 4:28 AM Menglong Dong [off-list ref] wrote:
quoted
Hi, all.
[......]
quoted
quoted
Maybe it's possible to reuse the existing bpf_session_cookie() and
bpf_session_is_return(). First, we move the nr_regs from stack to struct
bpf_tramp_run_ctx, as Andrii suggested before. Then, we define the session
cookies as flexible array in bpf_tramp_run_ctx like this:
    struct bpf_tramp_run_ctx {
        struct bpf_run_ctx run_ctx;
        u64 bpf_cookie;
        struct bpf_run_ctx *saved_run_ctx;
        u64 func_meta; /* nr_args, cookie_index, etc */
        u64 fsession_cookies[];
    };

The problem of this approach is that we can't inlined the bpf helper
anymore, such as get_func_arg, get_func_ret, get_func_arg_cnt, etc, as
we can't use the "current" in BPF assembly.
We can, as Alexei suggested on your other patch set. Is this still a
valid concern?
Yeah, with the support of BPF_MOV64_PERCPU_REG, it's much easier
now.

So what approach should I use now? Change the prototype of
bpf_session_is_return/bpf_session_cookie, as Alexei suggested, or
use the approach here? I think both works, and I'm a little torn
now. Any suggestions?
I think adding 'void *ctx' to existing kfuncs makes tramp-based
kfuncs faster, since less work needs to be done to store/read
the same data from run_ctx/current.
So that's my preference.
Okay, I'll implement it this way in the next version.

Thanks!
Menglong Dong



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help