bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/8] Optimize BPF tail calls for direct jumps
@ 2019-11-19  1:38 Daniel Borkmann
  2019-11-19  1:38 ` [PATCH bpf-next 1/8] bpf, x86: generalize and extend bpf_arch_text_poke " Daniel Borkmann
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Daniel Borkmann @ 2019-11-19  1:38 UTC (permalink / raw)
  To: ast; +Cc: john.fastabend, andrii.nakryiko, netdev, bpf, Daniel Borkmann

This gets rid of indirect jumps for BPF tail calls whenever possible.
The series adds emission for *direct* jumps for tail call maps in order
to avoid the retpoline overhead from a493a87f38cf ("bpf, x64: implement
retpoline for tail call") for situations that allow for it, meaning,
for known constant keys at verification time which are used as index
into the tail call map. See patch 7/8 for more general details.

Thanks!

rfc -> v1:
  - Applied Alexei's and Andrii's feeback from
    https://lore.kernel.org/bpf/cover.1573779287.git.daniel@iogearbox.net/T/#t

Daniel Borkmann (8):
  bpf, x86: generalize and extend bpf_arch_text_poke for direct jumps
  bpf: move bpf_free_used_maps into sleepable section
  bpf: move owner type,jited info into array auxiliary data
  bpf: add initial poke descriptor table for jit images
  bpf: add poke dependency tracking for prog array maps
  bpf: constant map key tracking for prog array pokes
  bpf, x86: emit patchable direct jump as tail call
  bpf, testing: add various tail call test cases

 arch/x86/net/bpf_jit_comp.c                   | 250 +++++++++++++-----
 include/linux/bpf.h                           |  84 +++++-
 include/linux/bpf_verifier.h                  |   3 +-
 include/linux/filter.h                        |  10 +
 kernel/bpf/arraymap.c                         | 183 ++++++++++++-
 kernel/bpf/core.c                             |  73 ++++-
 kernel/bpf/map_in_map.c                       |   5 +-
 kernel/bpf/syscall.c                          |  36 +--
 kernel/bpf/verifier.c                         | 116 +++++++-
 .../selftests/bpf/prog_tests/tailcalls.c      | 210 +++++++++++++++
 tools/testing/selftests/bpf/progs/tailcall1.c |  48 ++++
 tools/testing/selftests/bpf/progs/tailcall2.c |  59 +++++
 12 files changed, 947 insertions(+), 130 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/tailcalls.c
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall1.c
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall2.c

-- 
2.21.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-11-20 19:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19  1:38 [PATCH bpf-next 0/8] Optimize BPF tail calls for direct jumps Daniel Borkmann
2019-11-19  1:38 ` [PATCH bpf-next 1/8] bpf, x86: generalize and extend bpf_arch_text_poke " Daniel Borkmann
2019-11-20 18:11   ` Andrii Nakryiko
2019-11-19  1:38 ` [PATCH bpf-next 2/8] bpf: move bpf_free_used_maps into sleepable section Daniel Borkmann
2019-11-19  1:38 ` [PATCH bpf-next 3/8] bpf: move owner type,jited info into array auxiliary data Daniel Borkmann
2019-11-19  1:38 ` [PATCH bpf-next 4/8] bpf: add initial poke descriptor table for jit images Daniel Borkmann
2019-11-20 18:34   ` Andrii Nakryiko
2019-11-19  1:38 ` [PATCH bpf-next 5/8] bpf: add poke dependency tracking for prog array maps Daniel Borkmann
2019-11-20 18:56   ` Andrii Nakryiko
2019-11-19  1:38 ` [PATCH bpf-next 6/8] bpf: constant map key tracking for prog array pokes Daniel Borkmann
2019-11-20 19:02   ` Andrii Nakryiko
2019-11-19  1:38 ` [PATCH bpf-next 7/8] bpf, x86: emit patchable direct jump as tail call Daniel Borkmann
2019-11-20 19:16   ` Andrii Nakryiko
2019-11-19  1:38 ` [PATCH bpf-next 8/8] bpf, testing: add various tail call test cases Daniel Borkmann
2019-11-20 19:26   ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).