All of lore.kernel.org
 help / color / mirror / Atom feed
From: Menglong Dong <menglong.dong@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Menglong Dong <menglong8.dong@gmail.com>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	David Ahern <dsahern@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	jiang.biao@linux.dev, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	X86 ML <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	bpf <bpf@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v6 00/10] bpf: fsession support
Date: Tue, 06 Jan 2026 15:10:53 +0800	[thread overview]
Message-ID: <8625659.T7Z3S40VBb@7940hx> (raw)
In-Reply-To: <CAADnVQ+EzgMEXAN9oJ8asRj_WYOZh2VQOKDJz8mhkqehr7f=3g@mail.gmail.com>

On 2026/1/6 12:20 Alexei Starovoitov <alexei.starovoitov@gmail.com> write:
> On Mon, Jan 5, 2026 at 7:05 PM Menglong Dong <menglong.dong@linux.dev> wrote:
> >
> > On 2026/1/6 05:20 Andrii Nakryiko <andrii.nakryiko@gmail.com> write:
> > > On Sun, Jan 4, 2026 at 4:28 AM Menglong Dong <menglong8.dong@gmail.com> wrote:
> > > >
> > > > Hi, all.
> > > >
> > [......]
> > > > 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





  reply	other threads:[~2026-01-06  7:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04 12:28 [PATCH bpf-next v6 00/10] bpf: fsession support Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 01/10] bpf: add " Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 02/10] bpf: use last 8-bits for the nr_args in trampoline Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 03/10] bpf: add the kfunc bpf_fsession_is_return Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 04/10] bpf: add the kfunc bpf_fsession_cookie Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 05/10] bpf,x86: introduce emit_st_r0_imm64() for trampoline Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 06/10] bpf,x86: add fsession support for x86_64 Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 07/10] libbpf: add fsession support Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 08/10] selftests/bpf: add testcases for fsession Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 09/10] selftests/bpf: add testcases for fsession cookie Menglong Dong
2026-01-04 12:28 ` [PATCH bpf-next v6 10/10] selftests/bpf: test fsession mixed with fentry and fexit Menglong Dong
2026-01-05 21:20 ` [PATCH bpf-next v6 00/10] bpf: fsession support Andrii Nakryiko
2026-01-06  3:04   ` Menglong Dong
2026-01-06  4:20     ` Alexei Starovoitov
2026-01-06  7:10       ` Menglong Dong [this message]
2026-01-05 22:33 ` Alexei Starovoitov
2026-01-05 23:20   ` Andrii Nakryiko
2026-01-06  8:54     ` Jiri Olsa
2026-01-06 12:48       ` Menglong Dong

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=8625659.T7Z3S40VBb@7940hx \
    --to=menglong.dong@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=hpa@zytor.com \
    --cc=jiang.biao@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=menglong8.dong@gmail.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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.