On Thu, Jun 17, 2021 at 01:04:08PM +0200, Daniel Borkmann wrote: > On 6/16/21 3:34 PM, Jiri Olsa wrote: > > Removing unused cnt increase from EMIT macro together > > with cnt declarations. This was introduced in commit [1] > > to ensure proper code generation. But that code was > > removed in commit [2] and this extra code was left in. > > > > [1] b52f00e6a715 ("x86: bpf_jit: implement bpf_tail_call() helper") > > [2] ebf7d1f508a7 ("bpf, x64: rework pro/epilogue and tailcall handling in JIT") > > > > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> > > --- > > arch/x86/net/bpf_jit_comp.c | 39 ++++++++++--------------------------- > > 1 file changed, 10 insertions(+), 29 deletions(-) > > > > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > > index 2a2e290fa5d8..19715542cd9c 100644 > > --- a/arch/x86/net/bpf_jit_comp.c > > +++ b/arch/x86/net/bpf_jit_comp.c > > @@ -31,7 +31,7 @@ static u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len) > > } > > #define EMIT(bytes, len) \ > > - do { prog = emit_code(prog, bytes, len); cnt += len; } while (0) > > + do { prog = emit_code(prog, bytes, len); } while (0) > > #define EMIT1(b1) EMIT(b1, 1) > > #define EMIT2(b1, b2) EMIT((b1) + ((b2) << 8), 2) > > @@ -239,7 +239,6 @@ struct jit_context { > > static void push_callee_regs(u8 **pprog, bool *callee_regs_used) > > { > > u8 *prog = *pprog; > > - int cnt = 0; > > if (callee_regs_used[0]) > > EMIT1(0x53); /* push rbx */ > > @@ -255,7 +254,6 @@ static void push_callee_regs(u8 **pprog, bool *callee_regs_used) > > static void pop_callee_regs(u8 **pprog, bool *callee_regs_used) > > { > > u8 *prog = *pprog; > > - int cnt = 0; > > if (callee_regs_used[3]) > > EMIT2(0x41, 0x5F); /* pop r15 */ > > @@ -303,7 +301,6 @@ static void emit_prologue(u8 **pprog, u32 stack_depth, bool ebpf_from_cbpf, > > nit: In emit_prologue() we also have cnt that we could just replace with X86_PATCH_SIZE > directly as well. right, will send v2 thanks, jirka > > > static int emit_patch(u8 **pprog, void *func, void *ip, u8 opcode) > > { > > u8 *prog = *pprog; > > Otherwise, lgtm. > > Thanks, > Daniel >