From: Menglong Dong <menglong.dong@linux.dev>
To: menglong8.dong@gmail.com, "Björn Töpel" <bjorn@kernel.org>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
jolsa@kernel.org, pulehui@huawei.com, puranjay@kernel.org,
pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
alex@ghiti.fr, bpf@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
jiang.biao@linux.dev, martin.lau@kernel.org, clm@meta.com,
ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v3 2/3] bpf, riscv: add fsession support for trampolines
Date: Fri, 06 Feb 2026 22:27:22 +0800 [thread overview]
Message-ID: <5059733.GXAFRqVoOG@7950hx> (raw)
In-Reply-To: <CAJ+HfNj5JZJ-k5bJibSgLPD5xnTzf7kfvma4kJOBKoNTnSLLDg@mail.gmail.com>
On 2026/2/6 21:42, Björn Töpel wrote:
> Menglong!
>
> On Fri, 6 Feb 2026 at 13:51, <bot+bpf-ci@kernel.org> wrote:
> >
> > > diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> > > --- a/arch/riscv/net/bpf_jit_comp64.c
> > > +++ b/arch/riscv/net/bpf_jit_comp64.c
> >
> > [ ... ]
> >
> > > +static int invoke_bpf(struct bpf_tramp_links *tl, int args_off, int retval_off,
> > > + int run_ctx_off, int func_meta_off, bool save_ret, u64 func_meta,
> > > + int cookie_off, struct rv_jit_context *ctx)
> > > +{
> > > + int i, cur_cookie = (cookie_off - args_off) / 8;
> > > +
> > > + for (i = 0; i < tl->nr_links; i++) {
> > > + int err;
> > > +
> > > + if (bpf_prog_calls_session_cookie(&tl->links[i])) {
> > ^^^^^^^^^^^^^^
> >
> > Should this be tl->links[i] instead of &tl->links[i]?
> >
> > The function bpf_prog_calls_session_cookie() expects a struct bpf_tramp_link
> > pointer, but tl->links is an array of pointers, so tl->links[i] is already
> > a struct bpf_tramp_link pointer. The extra & passes a pointer-to-pointer.
> >
> > For comparison, arm64 uses:
> >
> > if (bpf_prog_calls_session_cookie(fentry->links[i]))
> >
> > And include/linux/bpf.h uses:
> >
> > if (bpf_prog_calls_session_cookie(fentries.links[i]))
> >
> > Both without the &.
> >
> > > + u64 meta = func_meta | ((u64)cur_cookie << BPF_TRAMP_COOKIE_INDEX_SHIFT);
> > > +
> > > + emit_store_stack_imm64(RV_REG_T1, -func_meta_off, meta, ctx);
> > > + cur_cookie--;
> > > + }
> > > + err = invoke_bpf_prog(tl->links[i], args_off, retval_off, run_ctx_off,
> > > + save_ret, ctx);
> >
> > Note that invoke_bpf_prog() correctly uses tl->links[i] without the &.
>
> Menglong, the v3 doesn't build. Please refrain from just stressing
> versions out. For v4, make sure you properly build/test. On that note;
> on what hardware/simulator did you perform the tests on?
Ah, sorry that the CONFIG_BPF_JIT is not enabled in my config, which
makes me didn't find this compile error.
I used to test it in qemu. As this is a tiny change, so I didn't run the
test again :/
I'll make sure the build and test pass in the V4.
Thanks!
Menglong Dong
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Menglong Dong <menglong.dong@linux.dev>
To: menglong8.dong@gmail.com, "Björn Töpel" <bjorn@kernel.org>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
jolsa@kernel.org, pulehui@huawei.com, puranjay@kernel.org,
pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
alex@ghiti.fr, bpf@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
jiang.biao@linux.dev, martin.lau@kernel.org, clm@meta.com,
ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v3 2/3] bpf, riscv: add fsession support for trampolines
Date: Fri, 06 Feb 2026 22:27:22 +0800 [thread overview]
Message-ID: <5059733.GXAFRqVoOG@7950hx> (raw)
In-Reply-To: <CAJ+HfNj5JZJ-k5bJibSgLPD5xnTzf7kfvma4kJOBKoNTnSLLDg@mail.gmail.com>
On 2026/2/6 21:42, Björn Töpel wrote:
> Menglong!
>
> On Fri, 6 Feb 2026 at 13:51, <bot+bpf-ci@kernel.org> wrote:
> >
> > > diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> > > --- a/arch/riscv/net/bpf_jit_comp64.c
> > > +++ b/arch/riscv/net/bpf_jit_comp64.c
> >
> > [ ... ]
> >
> > > +static int invoke_bpf(struct bpf_tramp_links *tl, int args_off, int retval_off,
> > > + int run_ctx_off, int func_meta_off, bool save_ret, u64 func_meta,
> > > + int cookie_off, struct rv_jit_context *ctx)
> > > +{
> > > + int i, cur_cookie = (cookie_off - args_off) / 8;
> > > +
> > > + for (i = 0; i < tl->nr_links; i++) {
> > > + int err;
> > > +
> > > + if (bpf_prog_calls_session_cookie(&tl->links[i])) {
> > ^^^^^^^^^^^^^^
> >
> > Should this be tl->links[i] instead of &tl->links[i]?
> >
> > The function bpf_prog_calls_session_cookie() expects a struct bpf_tramp_link
> > pointer, but tl->links is an array of pointers, so tl->links[i] is already
> > a struct bpf_tramp_link pointer. The extra & passes a pointer-to-pointer.
> >
> > For comparison, arm64 uses:
> >
> > if (bpf_prog_calls_session_cookie(fentry->links[i]))
> >
> > And include/linux/bpf.h uses:
> >
> > if (bpf_prog_calls_session_cookie(fentries.links[i]))
> >
> > Both without the &.
> >
> > > + u64 meta = func_meta | ((u64)cur_cookie << BPF_TRAMP_COOKIE_INDEX_SHIFT);
> > > +
> > > + emit_store_stack_imm64(RV_REG_T1, -func_meta_off, meta, ctx);
> > > + cur_cookie--;
> > > + }
> > > + err = invoke_bpf_prog(tl->links[i], args_off, retval_off, run_ctx_off,
> > > + save_ret, ctx);
> >
> > Note that invoke_bpf_prog() correctly uses tl->links[i] without the &.
>
> Menglong, the v3 doesn't build. Please refrain from just stressing
> versions out. For v4, make sure you properly build/test. On that note;
> on what hardware/simulator did you perform the tests on?
Ah, sorry that the CONFIG_BPF_JIT is not enabled in my config, which
makes me didn't find this compile error.
I used to test it in qemu. As this is a tiny change, so I didn't run the
test again :/
I'll make sure the build and test pass in the V4.
Thanks!
Menglong Dong
>
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-02-06 14:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 12:19 [PATCH bpf-next v3 0/3] bpf: fsession support for riscv Menglong Dong
2026-02-06 12:19 ` Menglong Dong
2026-02-06 12:20 ` [PATCH bpf-next v3 1/3] bpf, riscv: introduce emit_store_stack_imm64() for trampoline Menglong Dong
2026-02-06 12:20 ` Menglong Dong
2026-02-07 1:13 ` Pu Lehui
2026-02-07 1:13 ` Pu Lehui
2026-02-07 10:53 ` Menglong Dong
2026-02-07 10:53 ` Menglong Dong
2026-02-08 1:58 ` Pu Lehui
2026-02-08 1:58 ` Pu Lehui
2026-02-06 12:20 ` [PATCH bpf-next v3 2/3] bpf, riscv: add fsession support for trampolines Menglong Dong
2026-02-06 12:20 ` Menglong Dong
2026-02-06 12:51 ` bot+bpf-ci
2026-02-06 12:51 ` bot+bpf-ci
2026-02-06 13:42 ` Björn Töpel
2026-02-06 13:42 ` Björn Töpel
2026-02-06 14:27 ` Menglong Dong [this message]
2026-02-06 14:27 ` Menglong Dong
2026-02-06 20:22 ` kernel test robot
2026-02-06 20:22 ` kernel test robot
2026-02-06 21:47 ` kernel test robot
2026-02-06 21:47 ` kernel test robot
2026-02-06 12:20 ` [PATCH bpf-next v3 3/3] selftests/bpf: enable fsession_test on riscv64 Menglong Dong
2026-02-06 12:20 ` 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=5059733.GXAFRqVoOG@7950hx \
--to=menglong.dong@linux.dev \
--cc=alex@ghiti.fr \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--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=linux-riscv@lists.infradead.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=menglong8.dong@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=pulehui@huawei.com \
--cc=puranjay@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@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.