All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: <memxor@gmail.com>, <yonghong.song@linux.dev>,
	<puranjay@kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next 02/18] bpf, x86: Omit the displacement byte for zero offsets
Date: Thu, 15 Oct 2026 18:56:03 +0000	[thread overview]
Message-ID: <DM5N33KZWMCJ.AE5D51WCR236@gmail.com> (raw)
In-Reply-To: <20261013171230.523677-3-daniel@iogearbox.net>

On Tue, Oct 13, 2026 at 07:12 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
> @@ -1120,18 +1120,26 @@ static void emit_movsx_reg(u8 **pprog, int num_bits, bool is64, u32 dst_reg,
>  static void emit_insn_suffix(u8 **pprog, u32 ptr_reg, u32 val_reg, int off)
>  {
>  	u8 *prog = *pprog;
>
[...]
> +	if (!off && !base_needs_disp(ptr_reg)) {
> +		/* No displacement */
> +		EMIT1(add_2reg(0x00, ptr_reg, val_reg));

progs/verifier_jit_convergence.c depends on the size of these insns.
It's the reproducer for
commit c8831bdbfbab ("bpf, x64: Fix a jit convergence issue").
The code between 'if r1 == 0x0 goto l0' and l0 is 125 bytes when
the last 'goto l9' is 2 bytes and 128 when it's 5.
That's the je <-> jmp cycle.
There are three zero offset loads and stores in there,
so it's 122/125 after this patch.
'r2 += 0x1' and 'r3 &= 0x1' in patch 8 make it 120/123.
je fits into imm8 either way.
The test still passes, but it doesn't test anything.
Pls add few insns to the test to get the distance back.

  reply	other threads:[~2026-10-15 18:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 17:12 [PATCH bpf-next 00/18] bpf: Various x86-64 BPF JIT improvements Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 01/18] bpf, x86: Drop redundant REX prefixes from zero and sign extensions Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 02/18] bpf, x86: Omit the displacement byte for zero offsets Daniel Borkmann
2026-10-15 18:56   ` Alexei Starovoitov [this message]
2026-10-15 19:39     ` Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 03/18] bpf, x86: Shorten the stack adjusts and the tail call counter loads Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 04/18] bpf, x86: Use shorter test and cmp encodings for immediates Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 05/18] bpf, x86: Compare against 0, 127 and -128 with the adjusted condition Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 06/18] bpf, x86: Use movzx for byte and word masks and a not for xor with -1 Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 07/18] bpf, x86: Consolidate the ALU, shift and neg encodings into helpers Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 08/18] bpf, x86: Use shorter and faster forms for some ALU immediates Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 09/18] bpf, x86: Swap 16-bit values with bswap and shr, not ror and movzx Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 10/18] bpf, x86: Use BMI2 shifts also when the count is in rcx Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 11/18] bpf, x86: Fold the PROBE_MEM address computation into a lea Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 12/18] bpf, x86: Compare the PROBE_MEM address range with a shift Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 13/18] bpf, x86: Divide by constants via multiplication with a magic number Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 14/18] bpf, x86: Multiply by 3, 5 and 9 with lea Daniel Borkmann
2026-10-13 17:58   ` sashiko-bot
2026-10-13 19:15     ` Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 15/18] bpf, x86: Use emit_sub_rsp() for the trampoline stack Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 16/18] bpf, x86: Shorten the cast to a user address Daniel Borkmann
2026-10-13 17:12 ` [PATCH bpf-next 17/18] selftests/bpf: Add JIT instruction tests Daniel Borkmann
2026-10-13 18:46   ` bot+bpf-ci
2026-10-13 17:12 ` [PATCH bpf-next 18/18] selftests/bpf: Remove the old test_bpf module Daniel Borkmann
2026-10-13 18:22   ` bot+bpf-ci
2026-10-15  0:50 ` [PATCH bpf-next 00/18] bpf: Various x86-64 BPF JIT improvements patchwork-bot+netdevbpf

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=DM5N33KZWMCJ.AE5D51WCR236@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=memxor@gmail.com \
    --cc=puranjay@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.