From: Daniel Borkmann <daniel@iogearbox.net>
To: Jiri Olsa <jolsa@redhat.com>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andriin@fb.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>
Subject: Re: [PATCH bpf-next] bpf, x86: Remove unused cnt increase from EMIT macro
Date: Thu, 17 Jun 2021 13:04:08 +0200 [thread overview]
Message-ID: <08876866-c004-ede7-6657-10a15f51f6d8@iogearbox.net> (raw)
In-Reply-To: <20210616133400.315039-1-jolsa@kernel.org>
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@redhat.com>
> ---
> 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.
> static int emit_patch(u8 **pprog, void *func, void *ip, u8 opcode)
> {
> u8 *prog = *pprog;
Otherwise, lgtm.
Thanks,
Daniel
next prev parent reply other threads:[~2021-06-17 11:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 13:34 [PATCH bpf-next] bpf, x86: Remove unused cnt increase from EMIT macro Jiri Olsa
2021-06-17 11:04 ` Daniel Borkmann [this message]
2021-06-18 20:07 ` Jiri Olsa
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=08876866-c004-ede7-6657-10a15f51f6d8@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@redhat.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox