Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: alexei.starovoitov@gmail.com, daniel@iogearbox.net
Cc: yhs@fb.com, netdev@vger.kernel.org, oss-drivers@netronome.com,
	kafai@fb.com, Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH bpf-next v5 00/12] bpf: dead code elimination
Date: Tue, 22 Jan 2019 22:45:17 -0800	[thread overview]
Message-ID: <20190123064529.13518-1-jakub.kicinski@netronome.com> (raw)

Hi!

This set adds support for complete removal of dead code.

Patch 3 contains all the code removal logic, patches 2 and 4
additionally optimize branches around and to dead code.

Patches 6 and 7 allow offload JITs to take advantage of the
optimization.  After a few small clean ups (8, 9, 10) nfp
support is added (11, 12).

Removing code directly in the verifier makes it easy to adjust
the relevant metadata (line info, subprogram info).  JITs for
code store constrained architectures would have hard time
performing such adjustments at JIT level.  Removing subprograms
or line info is very hard once BPF core finished the verification.
For user space to perform dead code removal it would have to perform
the execution simulation/analysis similar to what the verifier does.

v3:
 - fix uninitilized var warning in GCC 6 (buildbot).
v4:
 - simplify the linfo-keeping logic (Yonghong).  Instead of
   trying to figure out that we are removing first instruction
   of a subprogram, just always keep last dead line info, if
   first live instruction doesn't have one.
v5:
 - improve comments (Martin Lau).

Jakub Kicinski (12):
  bpf: change parameters of call/branch offset adjustment
  bpf: verifier: hard wire branches to dead code
  bpf: verifier: remove dead code
  bpf: verifier: remove unconditional branches by 0
  selftests: bpf: add tests for dead code removal
  bpf: verifier: record original instruction index
  bpf: notify offload JITs about optimizations
  nfp: bpf: don't use instruction number for jump target
  nfp: bpf: split up the skip flag
  nfp: bpf: save original program length
  nfp: bpf: support optimizing dead branches
  nfp: bpf: support removing dead code

 drivers/net/ethernet/netronome/nfp/bpf/jit.c  |  42 +-
 drivers/net/ethernet/netronome/nfp/bpf/main.h |  33 +-
 .../net/ethernet/netronome/nfp/bpf/offload.c  |   9 +-
 .../net/ethernet/netronome/nfp/bpf/verifier.c |  74 +++-
 include/linux/bpf.h                           |   7 +
 include/linux/bpf_verifier.h                  |   6 +
 include/linux/filter.h                        |   1 +
 kernel/bpf/core.c                             |  52 ++-
 kernel/bpf/offload.c                          |  35 ++
 kernel/bpf/verifier.c                         | 256 ++++++++++-
 tools/testing/selftests/bpf/test_btf.c        | 396 +++++++++++++++++-
 tools/testing/selftests/bpf/test_verifier.c   | 160 +++++++
 12 files changed, 1004 insertions(+), 67 deletions(-)

-- 
2.19.2


             reply	other threads:[~2019-01-23  6:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23  6:45 Jakub Kicinski [this message]
2019-01-23  6:45 ` [PATCH bpf-next v5 01/12] bpf: change parameters of call/branch offset adjustment Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 02/12] bpf: verifier: hard wire branches to dead code Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 03/12] bpf: verifier: remove " Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 04/12] bpf: verifier: remove unconditional branches by 0 Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 05/12] selftests: bpf: add tests for dead code removal Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 06/12] bpf: verifier: record original instruction index Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 07/12] bpf: notify offload JITs about optimizations Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 08/12] nfp: bpf: don't use instruction number for jump target Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 09/12] nfp: bpf: split up the skip flag Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 10/12] nfp: bpf: save original program length Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 11/12] nfp: bpf: support optimizing dead branches Jakub Kicinski
2019-01-23  6:45 ` [PATCH bpf-next v5 12/12] nfp: bpf: support removing dead code Jakub Kicinski
2019-01-24  1:42 ` [PATCH bpf-next v5 00/12] bpf: dead code elimination Alexei Starovoitov

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=20190123064529.13518-1-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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