lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d9663547acce_59e82ace6a9345b4a3@john-XPS-13-9370.notmuch>
Date:   Thu, 03 Oct 2019 14:08:36 -0700
From:   John Fastabend <john.fastabend@...il.com>
To:     Song Liu <liu.song.a23@...il.com>,
        Daniel Borkmann <daniel@...earbox.net>
Cc:     Alexei Starovoitov <ast@...nel.org>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/2] bpf, x86: Small optimization in comparing
 against imm0

Song Liu wrote:
> On Wed, Oct 2, 2019 at 5:30 PM Daniel Borkmann <daniel@...earbox.net> wrote:
> >
> > Replace 'cmp reg, 0' with 'test reg, reg' for comparisons against
> > zero. Saves 1 byte of instruction encoding per occurrence. The flag
> > results of test 'reg, reg' are identical to 'cmp reg, 0' in all
> > cases except for AF which we don't use/care about. In terms of
> > macro-fusibility in combination with a subsequent conditional jump
> > instruction, both have the same properties for the jumps used in
> > the JIT translation. For example, same JITed Cilium program can
> > shrink a bit from e.g. 12,455 to 12,317 bytes as tests with 0 are
> > used quite frequently.
> >
> > Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> 
> Acked-by: Song Liu <songliubraving@...com>

Bonus points for causing me to spend the morning remembering the
differences between cmd, and, or, and test.

Also wonder if at some point we should clean up the jit a bit and
add some defines/helpers for all the open coded opcodes and such.

Acked-by: John Fastabend <john.fastabend@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ