[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADxym3Y098836fHHRSjeryxCp=CPB8sDU19TBBVs07VZOERJXw@mail.gmail.com>
Date: Fri, 19 Dec 2025 22:04:32 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Andreas Schwab <schwab@...ux-m68k.org>
Cc: Menglong Dong <menglong.dong@...ux.dev>, ast@...nel.org, rostedt@...dmis.org,
daniel@...earbox.net, john.fastabend@...il.com, andrii@...nel.org,
martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
yonghong.song@...ux.dev, kpsingh@...nel.org, sdf@...ichev.me,
haoluo@...gle.com, jolsa@...nel.org, mhiramat@...nel.org,
mark.rutland@....com, mathieu.desnoyers@...icios.com, jiang.biao@...ux.dev,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org
Subject: Re: [PATCH bpf-next v3 3/6] bpf: fix the usage of BPF_TRAMP_F_SKIP_FRAME
On Fri, Dec 19, 2025 at 9:49 PM Andreas Schwab <schwab@...ux-m68k.org> wrote:
>
> On Dez 19 2025, Menglong Dong wrote:
>
> > diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> > index 5f9457e910e8..09b70bf362d3 100644
> > --- a/arch/riscv/net/bpf_jit_comp64.c
> > +++ b/arch/riscv/net/bpf_jit_comp64.c
> > @@ -1134,7 +1134,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
> > store_args(nr_arg_slots, args_off, ctx);
> >
> > /* skip to actual body of traced function */
> > - if (flags & BPF_TRAMP_F_ORIG_STACK)
> > + if (flags & BPF_TRAMP_F_CALL_ORIG)
> > orig_call += RV_FENTRY_NINSNS * 4;
>
> There are now three occurrences of that condition, and only the third
> one uses orig_call. How about merging them?
Yeah, I think we can merge it to the third one, like this:
diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
index 5f9457e910e8..37888abee70c 100644
--- a/arch/riscv/net/bpf_jit_comp64.c
+++ b/arch/riscv/net/bpf_jit_comp64.c
@@ -1133,10 +1133,6 @@ static int __arch_prepare_bpf_trampoline(struct
bpf_tramp_image *im,
store_args(nr_arg_slots, args_off, ctx);
- /* skip to actual body of traced function */
- if (flags & BPF_TRAMP_F_ORIG_STACK)
- orig_call += RV_FENTRY_NINSNS * 4;
-
if (flags & BPF_TRAMP_F_CALL_ORIG) {
emit_imm(RV_REG_A0, ctx->insns ? (const s64)im :
RV_MAX_COUNT_IMM, ctx);
ret = emit_call((const u64)__bpf_tramp_enter, true, ctx);
@@ -1171,6 +1167,8 @@ static int __arch_prepare_bpf_trampoline(struct
bpf_tramp_image *im,
}
if (flags & BPF_TRAMP_F_CALL_ORIG) {
+ /* skip to actual body of traced function */
+ orig_call += RV_FENTRY_NINSNS * 4;
restore_args(min_t(int, nr_arg_slots,
RV_MAX_REG_ARGS), args_off, ctx);
restore_stack_args(nr_arg_slots - RV_MAX_REG_ARGS,
args_off, stk_arg_off, ctx);
ret = emit_call((const u64)orig_call, true, ctx);
>
> --
> Andreas Schwab, schwab@...ux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
Powered by blists - more mailing lists