* [PATCH 0/3] bpf: fsession support for LoongArch
@ 2026-02-26 6:59 Hengqi Chen
2026-02-26 6:59 ` [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper Hengqi Chen
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Hengqi Chen @ 2026-02-26 6:59 UTC (permalink / raw)
To: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu,
vincent.mc.li, menglong8.dong
Cc: loongarch, bpf, Hengqi Chen
This small set implements fsession support for LoongArch.
Patch 1 introduces a helper named emit_store_stack_imm64().
Patch 2 implements fsession support.
Patch 3 enable fsession selftests on LoongArch.
Hengqi Chen (3):
LoongArch: BPF: Introduce emit_store_stack_imm64() helper
LoongArch: BPF: Add fsession support for trampolines
bpf/selftests: Enable fsession tests for LoongArch
arch/loongarch/net/bpf_jit.c | 100 ++++++++++++++----
.../selftests/bpf/progs/get_func_args_test.c | 3 +-
.../selftests/bpf/progs/get_func_ip_test.c | 3 +-
3 files changed, 83 insertions(+), 23 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper 2026-02-26 6:59 [PATCH 0/3] bpf: fsession support for LoongArch Hengqi Chen @ 2026-02-26 6:59 ` Hengqi Chen 2026-03-04 2:04 ` Menglong Dong 2026-02-26 6:59 ` [PATCH 2/3] LoongArch: BPF: Add fsession support for trampolines Hengqi Chen ` (2 subsequent siblings) 3 siblings, 1 reply; 9+ messages in thread From: Hengqi Chen @ 2026-02-26 6:59 UTC (permalink / raw) To: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, vincent.mc.li, menglong8.dong Cc: loongarch, bpf, Hengqi Chen Introduce a helper to store 64-bit immediate on the trampoline stack. The helper will be used in the next patch. Also refactor the existing code to use this helper. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> --- arch/loongarch/net/bpf_jit.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c index 3bd89f55960d..e3deb0da6a50 100644 --- a/arch/loongarch/net/bpf_jit.c +++ b/arch/loongarch/net/bpf_jit.c @@ -1480,6 +1480,12 @@ static void restore_args(struct jit_ctx *ctx, int nargs, int args_off) } } +static void emit_store_stack_imm64(struct jit_ctx *ctx, int reg, int stack_off, u64 imm64) +{ + move_imm(ctx, reg, imm64, false); + emit_insn(ctx, std, reg, LOONGARCH_GPR_FP, stack_off); +} + static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l, int args_off, int retval_off, int run_ctx_off, bool save_ret) { @@ -1488,12 +1494,11 @@ static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l, struct bpf_prog *p = l->link.prog; int cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); - if (l->cookie) { - move_imm(ctx, LOONGARCH_GPR_T1, l->cookie, false); - emit_insn(ctx, std, LOONGARCH_GPR_T1, LOONGARCH_GPR_FP, -run_ctx_off + cookie_off); - } else { + if (l->cookie) + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, + -run_ctx_off + cookie_off, l->cookie); + else emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -run_ctx_off + cookie_off); - } /* arg1: prog */ move_imm(ctx, LOONGARCH_GPR_A0, (const s64)p, false); @@ -1726,14 +1731,11 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i emit_insn(ctx, std, LOONGARCH_GPR_S1, LOONGARCH_GPR_FP, -sreg_off); /* store ip address of the traced function */ - if (flags & BPF_TRAMP_F_IP_ARG) { - move_imm(ctx, LOONGARCH_GPR_T1, (const s64)func_addr, false); - emit_insn(ctx, std, LOONGARCH_GPR_T1, LOONGARCH_GPR_FP, -ip_off); - } + if (flags & BPF_TRAMP_F_IP_ARG) + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -ip_off, (u64)func_addr); /* store nargs number */ - move_imm(ctx, LOONGARCH_GPR_T1, nargs, false); - emit_insn(ctx, std, LOONGARCH_GPR_T1, LOONGARCH_GPR_FP, -nargs_off); + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -nargs_off, nargs); store_args(ctx, nargs, args_off); -- 2.43.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper 2026-02-26 6:59 ` [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper Hengqi Chen @ 2026-03-04 2:04 ` Menglong Dong 0 siblings, 0 replies; 9+ messages in thread From: Menglong Dong @ 2026-03-04 2:04 UTC (permalink / raw) To: yangtiezhu, Hengqi Chen Cc: ast, daniel, andrii, martin.lau, chenhuacai, vincent.mc.li, menglong8.dong, loongarch, bpf, Hengqi Chen On 2026/2/26 14:59 Hengqi Chen <hengqi.chen@gmail.com> write: > Introduce a helper to store 64-bit immediate on the trampoline stack. > The helper will be used in the next patch. Also refactor the existing > code to use this helper. > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > --- > arch/loongarch/net/bpf_jit.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c > index 3bd89f55960d..e3deb0da6a50 100644 > --- a/arch/loongarch/net/bpf_jit.c > +++ b/arch/loongarch/net/bpf_jit.c > @@ -1480,6 +1480,12 @@ static void restore_args(struct jit_ctx *ctx, int nargs, int args_off) > } > } LGTM. Reviewed-by: Menglong Dong <menglong8.dong@gmail.com> > > +static void emit_store_stack_imm64(struct jit_ctx *ctx, int reg, int stack_off, u64 imm64) > +{ > + move_imm(ctx, reg, imm64, false); > + emit_insn(ctx, std, reg, LOONGARCH_GPR_FP, stack_off); > +} > + > static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l, > int args_off, int retval_off, int run_ctx_off, bool save_ret) > { > @@ -1488,12 +1494,11 @@ static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l, > struct bpf_prog *p = l->link.prog; > int cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); > > - if (l->cookie) { > - move_imm(ctx, LOONGARCH_GPR_T1, l->cookie, false); > - emit_insn(ctx, std, LOONGARCH_GPR_T1, LOONGARCH_GPR_FP, -run_ctx_off + cookie_off); > - } else { > + if (l->cookie) > + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, > + -run_ctx_off + cookie_off, l->cookie); > + else > emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -run_ctx_off + cookie_off); > - } > > /* arg1: prog */ > move_imm(ctx, LOONGARCH_GPR_A0, (const s64)p, false); > @@ -1726,14 +1731,11 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i > emit_insn(ctx, std, LOONGARCH_GPR_S1, LOONGARCH_GPR_FP, -sreg_off); > > /* store ip address of the traced function */ > - if (flags & BPF_TRAMP_F_IP_ARG) { > - move_imm(ctx, LOONGARCH_GPR_T1, (const s64)func_addr, false); > - emit_insn(ctx, std, LOONGARCH_GPR_T1, LOONGARCH_GPR_FP, -ip_off); > - } > + if (flags & BPF_TRAMP_F_IP_ARG) > + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -ip_off, (u64)func_addr); > > /* store nargs number */ > - move_imm(ctx, LOONGARCH_GPR_T1, nargs, false); > - emit_insn(ctx, std, LOONGARCH_GPR_T1, LOONGARCH_GPR_FP, -nargs_off); > + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -nargs_off, nargs); > > store_args(ctx, nargs, args_off); > > -- > 2.43.5 > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] LoongArch: BPF: Add fsession support for trampolines 2026-02-26 6:59 [PATCH 0/3] bpf: fsession support for LoongArch Hengqi Chen 2026-02-26 6:59 ` [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper Hengqi Chen @ 2026-02-26 6:59 ` Hengqi Chen 2026-03-04 2:11 ` Menglong Dong 2026-02-26 6:59 ` [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch Hengqi Chen 2026-03-04 2:51 ` [PATCH 0/3] bpf: fsession support " Menglong Dong 3 siblings, 1 reply; 9+ messages in thread From: Hengqi Chen @ 2026-02-26 6:59 UTC (permalink / raw) To: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, vincent.mc.li, menglong8.dong Cc: loongarch, bpf, Hengqi Chen Implement BPF_TRACE_FSESSION support in LoongArch BPF JIT. The logic here is almost identical to what has been done in RISC-V JIT. The key changes are: - Allocate stack space for function meta and session cookies - Introduce invoke_bpf() as a wrapper around invoke_bpf_prog() that populates session cookies before each invocation - Implement bpf_jit_supports_fsession() callback Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> --- arch/loongarch/net/bpf_jit.c | 78 +++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 11 deletions(-) diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c index e3deb0da6a50..16da53f80266 100644 --- a/arch/loongarch/net/bpf_jit.c +++ b/arch/loongarch/net/bpf_jit.c @@ -1549,6 +1549,31 @@ static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l, return ret; } +static int invoke_bpf(struct jit_ctx *ctx, 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) +{ + 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])) { + u64 meta = func_meta | ((u64)cur_cookie << BPF_TRAMP_COOKIE_INDEX_SHIFT); + + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, meta); + cur_cookie--; + } + err = invoke_bpf_prog(ctx, tl->links[i], args_off, retval_off, + run_ctx_off, save_ret); + if (err) + return err; + } + + return 0; +} + static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_links *tl, int args_off, int retval_off, int run_ctx_off, u32 **branches) { @@ -1610,13 +1635,15 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i { int i, ret, save_ret; int stack_size, nargs; - int retval_off, args_off, nargs_off, ip_off, run_ctx_off, sreg_off, tcc_ptr_off; + int retval_off, args_off, func_meta_off, ip_off, run_ctx_off, sreg_off, tcc_ptr_off; + int cookie_off, cookie_cnt; bool is_struct_ops = flags & BPF_TRAMP_F_INDIRECT; void *orig_call = func_addr; struct bpf_tramp_links *fentry = &tlinks[BPF_TRAMP_FENTRY]; struct bpf_tramp_links *fexit = &tlinks[BPF_TRAMP_FEXIT]; struct bpf_tramp_links *fmod_ret = &tlinks[BPF_TRAMP_MODIFY_RETURN]; u32 **branches = NULL; + u64 func_meta; /* * FP + 8 [ RA to parent func ] return address to parent @@ -1634,10 +1661,14 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i * [ ... ] * FP - args_off [ arg1 ] * - * FP - nargs_off [ regs count ] + * FP - func_meta_off [ regs count, etc ] * * FP - ip_off [ traced func ] BPF_TRAMP_F_IP_ARG * + * [ stack cookie N ] + * [ ... ] + * FP - cookie_off [ stack cookie 1 ] + * * FP - run_ctx_off [ bpf_tramp_run_ctx ] * * FP - sreg_off [ callee saved reg ] @@ -1671,9 +1702,9 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i stack_size += nargs * 8; args_off = stack_size; - /* Room of trampoline frame to store args number */ + /* function metadata, such as regs count */ stack_size += 8; - nargs_off = stack_size; + func_meta_off = stack_size; /* Room of trampoline frame to store ip address */ if (flags & BPF_TRAMP_F_IP_ARG) { @@ -1681,6 +1712,11 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i ip_off = stack_size; } + cookie_cnt = bpf_fsession_cookie_cnt(tlinks); + /* room for session cookies */ + stack_size += cookie_cnt * 8; + cookie_off = stack_size; + /* Room of trampoline frame to store struct bpf_tramp_run_ctx */ stack_size += round_up(sizeof(struct bpf_tramp_run_ctx), 8); run_ctx_off = stack_size; @@ -1734,11 +1770,19 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i if (flags & BPF_TRAMP_F_IP_ARG) emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -ip_off, (u64)func_addr); - /* store nargs number */ - emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -nargs_off, nargs); + func_meta = nargs; + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, func_meta); store_args(ctx, nargs, args_off); + if (bpf_fsession_cnt(tlinks)) { + /* clear all session cookies' value */ + for (i = 0; i < cookie_cnt; i++) + emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -cookie_off + 8 * i); + /* clear return value to make sure fentry always get 0 */ + emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -retval_off); + } + /* To traced function */ /* Ftrace jump skips 2 NOP instructions */ if (is_kernel_text((unsigned long)orig_call) || @@ -1755,9 +1799,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i return ret; } - for (i = 0; i < fentry->nr_links; i++) { - ret = invoke_bpf_prog(ctx, fentry->links[i], args_off, retval_off, - run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET); + if (fentry->nr_links) { + ret = invoke_bpf(ctx, fentry, args_off, retval_off, run_ctx_off, + func_meta_off, flags & BPF_TRAMP_F_RET_FENTRY_RET, + func_meta, cookie_off); if (ret) return ret; } @@ -1791,8 +1836,14 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i *branches[i] = larch_insn_gen_bne(LOONGARCH_GPR_T1, LOONGARCH_GPR_ZERO, offset); } - for (i = 0; i < fexit->nr_links; i++) { - ret = invoke_bpf_prog(ctx, fexit->links[i], args_off, retval_off, run_ctx_off, false); + /* set "is_return" flag for fsession */ + func_meta |= (1ULL << BPF_TRAMP_IS_RETURN_SHIFT); + if (bpf_fsession_cnt(tlinks)) + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, func_meta); + + if (fexit->nr_links) { + ret = invoke_bpf(ctx, fexit, args_off, retval_off, run_ctx_off, + func_meta_off, false, func_meta, cookie_off); if (ret) goto out; } @@ -2132,3 +2183,8 @@ bool bpf_jit_supports_subprog_tailcalls(void) { return true; } + +bool bpf_jit_supports_fsession(void) +{ + return true; +} -- 2.43.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] LoongArch: BPF: Add fsession support for trampolines 2026-02-26 6:59 ` [PATCH 2/3] LoongArch: BPF: Add fsession support for trampolines Hengqi Chen @ 2026-03-04 2:11 ` Menglong Dong 0 siblings, 0 replies; 9+ messages in thread From: Menglong Dong @ 2026-03-04 2:11 UTC (permalink / raw) To: Hengqi Chen Cc: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, vincent.mc.li, menglong8.dong, loongarch, bpf, Hengqi Chen On 2026/2/26 14:59 Hengqi Chen <hengqi.chen@gmail.com> write: > Implement BPF_TRACE_FSESSION support in LoongArch BPF JIT. > The logic here is almost identical to what has been done in > RISC-V JIT. > > The key changes are: > - Allocate stack space for function meta and session cookies > - Introduce invoke_bpf() as a wrapper around invoke_bpf_prog() > that populates session cookies before each invocation > - Implement bpf_jit_supports_fsession() callback > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > --- > arch/loongarch/net/bpf_jit.c | 78 +++++++++++++++++++++++++++++++----- > 1 file changed, 67 insertions(+), 11 deletions(-) > > diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c > index e3deb0da6a50..16da53f80266 100644 > --- a/arch/loongarch/net/bpf_jit.c > +++ b/arch/loongarch/net/bpf_jit.c > @@ -1549,6 +1549,31 @@ static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l, > return ret; > } > LGTM. Reviewed-by: Menglong Dong <menglong8.dong@gmail.com> Some nits maybe you can do when you respin the V2 if you don't mind, see below. > +static int invoke_bpf(struct jit_ctx *ctx, 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) > +{ [...] > > + if (bpf_fsession_cnt(tlinks)) { > + /* clear all session cookies' value */ > + for (i = 0; i < cookie_cnt; i++) > + emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -cookie_off + 8 * i); > + /* clear return value to make sure fentry always get 0 */ > + emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -retval_off); > + } > + > /* To traced function */ > /* Ftrace jump skips 2 NOP instructions */ > if (is_kernel_text((unsigned long)orig_call) || > @@ -1755,9 +1799,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i > return ret; > } > > - for (i = 0; i < fentry->nr_links; i++) { > - ret = invoke_bpf_prog(ctx, fentry->links[i], args_off, retval_off, > - run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET); > + if (fentry->nr_links) { This checking is unnecessary, as invoke_bpf() will return directly if !fentry->nr_links. PS: I was told this when I implement the fsession for s390 this way :) > + ret = invoke_bpf(ctx, fentry, args_off, retval_off, run_ctx_off, > + func_meta_off, flags & BPF_TRAMP_F_RET_FENTRY_RET, > + func_meta, cookie_off); > if (ret) > return ret; > } > @@ -1791,8 +1836,14 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i > *branches[i] = larch_insn_gen_bne(LOONGARCH_GPR_T1, LOONGARCH_GPR_ZERO, offset); > } > > - for (i = 0; i < fexit->nr_links; i++) { > - ret = invoke_bpf_prog(ctx, fexit->links[i], args_off, retval_off, run_ctx_off, false); > + /* set "is_return" flag for fsession */ > + func_meta |= (1ULL << BPF_TRAMP_IS_RETURN_SHIFT); > + if (bpf_fsession_cnt(tlinks)) > + emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, func_meta); > + > + if (fexit->nr_links) { And this checking. Thanks! Menglong Dong > + ret = invoke_bpf(ctx, fexit, args_off, retval_off, run_ctx_off, > + func_meta_off, false, func_meta, cookie_off); > if (ret) > goto out; > } > @@ -2132,3 +2183,8 @@ bool bpf_jit_supports_subprog_tailcalls(void) > { > return true; > } > + > +bool bpf_jit_supports_fsession(void) > +{ > + return true; > +} > -- > 2.43.5 > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch 2026-02-26 6:59 [PATCH 0/3] bpf: fsession support for LoongArch Hengqi Chen 2026-02-26 6:59 ` [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper Hengqi Chen 2026-02-26 6:59 ` [PATCH 2/3] LoongArch: BPF: Add fsession support for trampolines Hengqi Chen @ 2026-02-26 6:59 ` Hengqi Chen 2026-02-27 1:59 ` Vincent Li 2026-03-04 1:43 ` Menglong Dong 2026-03-04 2:51 ` [PATCH 0/3] bpf: fsession support " Menglong Dong 3 siblings, 2 replies; 9+ messages in thread From: Hengqi Chen @ 2026-02-26 6:59 UTC (permalink / raw) To: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, vincent.mc.li, menglong8.dong Cc: loongarch, bpf, Hengqi Chen Now that the LoongArch JIT supports BPF_TRACE_FSESSION, allow the fsession-related tests to run on LoongArch. $ ./test_progs -a fsession_test,get_func_args_test,get_func_ip_test #136/1 fsession_test/fsession_test:OK #136/2 fsession_test/fsession_reattach:OK #136/3 fsession_test/fsession_cookie:OK #136 fsession_test:OK #138 get_func_args_test:OK #139 get_func_ip_test:OK Summary: 3/3 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> --- tools/testing/selftests/bpf/progs/get_func_args_test.c | 3 ++- tools/testing/selftests/bpf/progs/get_func_ip_test.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/get_func_args_test.c b/tools/testing/selftests/bpf/progs/get_func_args_test.c index 075a1180ec26..afb185fdf60c 100644 --- a/tools/testing/selftests/bpf/progs/get_func_args_test.c +++ b/tools/testing/selftests/bpf/progs/get_func_args_test.c @@ -167,7 +167,8 @@ int BPF_PROG(tp_test2) } __u64 test7_result = 0; -#if defined(bpf_target_x86) || defined(bpf_target_arm64) || defined(bpf_target_riscv) +#if defined(bpf_target_x86) || defined(bpf_target_arm64) || \ + defined(bpf_target_riscv) || defined(bpf_target_loongarch) SEC("fsession/bpf_fentry_test1") int BPF_PROG(test7) { diff --git a/tools/testing/selftests/bpf/progs/get_func_ip_test.c b/tools/testing/selftests/bpf/progs/get_func_ip_test.c index 45eaa54d1ac7..3816a3616fbe 100644 --- a/tools/testing/selftests/bpf/progs/get_func_ip_test.c +++ b/tools/testing/selftests/bpf/progs/get_func_ip_test.c @@ -106,7 +106,8 @@ int BPF_URETPROBE(test8, int ret) __u64 test9_entry_result = 0; __u64 test9_exit_result = 0; -#if defined(bpf_target_x86) || defined(bpf_target_arm64) || defined(bpf_target_riscv) +#if defined(bpf_target_x86) || defined(bpf_target_arm64) || \ + defined(bpf_target_riscv) || defined(bpf_target_loongarch) SEC("fsession/bpf_fentry_test1") int BPF_PROG(test9, int a) { -- 2.43.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch 2026-02-26 6:59 ` [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch Hengqi Chen @ 2026-02-27 1:59 ` Vincent Li 2026-03-04 1:43 ` Menglong Dong 1 sibling, 0 replies; 9+ messages in thread From: Vincent Li @ 2026-02-27 1:59 UTC (permalink / raw) To: Hengqi Chen Cc: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, menglong8.dong, loongarch, bpf On Wed, Feb 25, 2026 at 11:00 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > Now that the LoongArch JIT supports BPF_TRACE_FSESSION, allow > the fsession-related tests to run on LoongArch. > > $ ./test_progs -a fsession_test,get_func_args_test,get_func_ip_test > #136/1 fsession_test/fsession_test:OK > #136/2 fsession_test/fsession_reattach:OK > #136/3 fsession_test/fsession_cookie:OK > #136 fsession_test:OK > #138 get_func_args_test:OK > #139 get_func_ip_test:OK > Summary: 3/3 PASSED, 0 SKIPPED, 0 FAILED > [root@fedora bpf]# ./test_progs -a fsession_test,get_func_args_test,get_func_ip_test #135/1 fsession_test/fsession_test:OK #135/2 fsession_test/fsession_reattach:OK #135/3 fsession_test/fsession_cookie:OK #135 fsession_test:OK #138 get_func_args_test:OK #139 get_func_ip_test:OK Summary: 3/3 PASSED, 0 SKIPPED, 0 FAILED Tested-by: Vincent Li <vincent.mc.li@gmail.com> > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > --- > tools/testing/selftests/bpf/progs/get_func_args_test.c | 3 ++- > tools/testing/selftests/bpf/progs/get_func_ip_test.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/get_func_args_test.c b/tools/testing/selftests/bpf/progs/get_func_args_test.c > index 075a1180ec26..afb185fdf60c 100644 > --- a/tools/testing/selftests/bpf/progs/get_func_args_test.c > +++ b/tools/testing/selftests/bpf/progs/get_func_args_test.c > @@ -167,7 +167,8 @@ int BPF_PROG(tp_test2) > } > > __u64 test7_result = 0; > -#if defined(bpf_target_x86) || defined(bpf_target_arm64) || defined(bpf_target_riscv) > +#if defined(bpf_target_x86) || defined(bpf_target_arm64) || \ > + defined(bpf_target_riscv) || defined(bpf_target_loongarch) > SEC("fsession/bpf_fentry_test1") > int BPF_PROG(test7) > { > diff --git a/tools/testing/selftests/bpf/progs/get_func_ip_test.c b/tools/testing/selftests/bpf/progs/get_func_ip_test.c > index 45eaa54d1ac7..3816a3616fbe 100644 > --- a/tools/testing/selftests/bpf/progs/get_func_ip_test.c > +++ b/tools/testing/selftests/bpf/progs/get_func_ip_test.c > @@ -106,7 +106,8 @@ int BPF_URETPROBE(test8, int ret) > > __u64 test9_entry_result = 0; > __u64 test9_exit_result = 0; > -#if defined(bpf_target_x86) || defined(bpf_target_arm64) || defined(bpf_target_riscv) > +#if defined(bpf_target_x86) || defined(bpf_target_arm64) || \ > + defined(bpf_target_riscv) || defined(bpf_target_loongarch) > SEC("fsession/bpf_fentry_test1") > int BPF_PROG(test9, int a) > { > -- > 2.43.5 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch 2026-02-26 6:59 ` [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch Hengqi Chen 2026-02-27 1:59 ` Vincent Li @ 2026-03-04 1:43 ` Menglong Dong 1 sibling, 0 replies; 9+ messages in thread From: Menglong Dong @ 2026-03-04 1:43 UTC (permalink / raw) To: Hengqi Chen Cc: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, vincent.mc.li, menglong8.dong, loongarch, bpf, Hengqi Chen On 2026/2/26 14:59 Hengqi Chen <hengqi.chen@gmail.com> write: > Now that the LoongArch JIT supports BPF_TRACE_FSESSION, allow > the fsession-related tests to run on LoongArch. > > $ ./test_progs -a fsession_test,get_func_args_test,get_func_ip_test > #136/1 fsession_test/fsession_test:OK > #136/2 fsession_test/fsession_reattach:OK > #136/3 fsession_test/fsession_cookie:OK > #136 fsession_test:OK > #138 get_func_args_test:OK > #139 get_func_ip_test:OK > Summary: 3/3 PASSED, 0 SKIPPED, 0 FAILED Hi Hengqi, The testcases is updated in c1eee8d1e84f "selftests/bpf: factor out get_func_* tests for fsession", so we don't need the 3rd patch anymore. Thanks! Menglong Dong > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > --- > tools/testing/selftests/bpf/progs/get_func_args_test.c | 3 ++- > tools/testing/selftests/bpf/progs/get_func_ip_test.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/get_func_args_test.c b/tools/testing/selftests/bpf/progs/get_func_args_test.c > index 075a1180ec26..afb185fdf60c 100644 > --- a/tools/testing/selftests/bpf/progs/get_func_args_test.c > +++ b/tools/testing/selftests/bpf/progs/get_func_args_test.c > @@ -167,7 +167,8 @@ int BPF_PROG(tp_test2) > } > > __u64 test7_result = 0; > -#if defined(bpf_target_x86) || defined(bpf_target_arm64) || defined(bpf_target_riscv) > +#if defined(bpf_target_x86) || defined(bpf_target_arm64) || \ > + defined(bpf_target_riscv) || defined(bpf_target_loongarch) > SEC("fsession/bpf_fentry_test1") > int BPF_PROG(test7) > { > diff --git a/tools/testing/selftests/bpf/progs/get_func_ip_test.c b/tools/testing/selftests/bpf/progs/get_func_ip_test.c > index 45eaa54d1ac7..3816a3616fbe 100644 > --- a/tools/testing/selftests/bpf/progs/get_func_ip_test.c > +++ b/tools/testing/selftests/bpf/progs/get_func_ip_test.c > @@ -106,7 +106,8 @@ int BPF_URETPROBE(test8, int ret) > > __u64 test9_entry_result = 0; > __u64 test9_exit_result = 0; > -#if defined(bpf_target_x86) || defined(bpf_target_arm64) || defined(bpf_target_riscv) > +#if defined(bpf_target_x86) || defined(bpf_target_arm64) || \ > + defined(bpf_target_riscv) || defined(bpf_target_loongarch) > SEC("fsession/bpf_fentry_test1") > int BPF_PROG(test9, int a) > { > -- > 2.43.5 > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] bpf: fsession support for LoongArch 2026-02-26 6:59 [PATCH 0/3] bpf: fsession support for LoongArch Hengqi Chen ` (2 preceding siblings ...) 2026-02-26 6:59 ` [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch Hengqi Chen @ 2026-03-04 2:51 ` Menglong Dong 3 siblings, 0 replies; 9+ messages in thread From: Menglong Dong @ 2026-03-04 2:51 UTC (permalink / raw) To: Hengqi Chen Cc: ast, daniel, andrii, martin.lau, chenhuacai, yangtiezhu, vincent.mc.li, menglong8.dong, loongarch, bpf, Hengqi Chen On 2026/2/26 14:59 Hengqi Chen <hengqi.chen@gmail.com> write: > This small set implements fsession support for LoongArch. > > Patch 1 introduces a helper named emit_store_stack_imm64(). > Patch 2 implements fsession support. > Patch 3 enable fsession selftests on LoongArch. I think this series belongs to the bpf-next tree, right? So pls add the "bpf-next" tag in the next version. > > Hengqi Chen (3): > LoongArch: BPF: Introduce emit_store_stack_imm64() helper > LoongArch: BPF: Add fsession support for trampolines > bpf/selftests: Enable fsession tests for LoongArch > > arch/loongarch/net/bpf_jit.c | 100 ++++++++++++++---- > .../selftests/bpf/progs/get_func_args_test.c | 3 +- > .../selftests/bpf/progs/get_func_ip_test.c | 3 +- > 3 files changed, 83 insertions(+), 23 deletions(-) > > -- > 2.43.5 > > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-03-04 2:51 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-02-26 6:59 [PATCH 0/3] bpf: fsession support for LoongArch Hengqi Chen 2026-02-26 6:59 ` [PATCH 1/3] LoongArch: BPF: Introduce emit_store_stack_imm64() helper Hengqi Chen 2026-03-04 2:04 ` Menglong Dong 2026-02-26 6:59 ` [PATCH 2/3] LoongArch: BPF: Add fsession support for trampolines Hengqi Chen 2026-03-04 2:11 ` Menglong Dong 2026-02-26 6:59 ` [PATCH bpf-next 3/3] bpf/selftests: Enable fsession tests for LoongArch Hengqi Chen 2026-02-27 1:59 ` Vincent Li 2026-03-04 1:43 ` Menglong Dong 2026-03-04 2:51 ` [PATCH 0/3] bpf: fsession support " Menglong Dong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox