BPF List
 help / color / mirror / Atom feed
* [PATCH v3 bpf-next 0/4] bpf: Introduce may_goto and cond_break
@ 2024-03-01  3:37 Alexei Starovoitov
  2024-03-01  3:37 ` [PATCH v3 bpf-next 1/4] bpf: Introduce may_goto instruction Alexei Starovoitov
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Alexei Starovoitov @ 2024-03-01  3:37 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, martin.lau, memxor, eddyz87, kernel-team

From: Alexei Starovoitov <ast@kernel.org>

v2 -> v3: Major change
- drop bpf_can_loop() kfunc and introduce may_goto instruction instead
  kfunc is a function call while may_goto doesn't consume any registers
  and LLVM can produce much better code due to less register pressure.
- instead of counting from zero to BPF_MAX_LOOPS start from it instead
  and break out of the loop when count reaches zero
- use may_goto instruction in cond_break macro
- recognize that 'exact' state comparison doesn't need to be truly exact.
  regsafe() should ignore precision and liveness marks, but range_within
  logic is safe to use while evaluating open coded iterators.

Alexei Starovoitov (4):
  bpf: Introduce may_goto instruction
  bpf: Recognize that two registers are safe when their ranges match
  bpf: Add cond_break macro
  selftests/bpf: Test may_goto

 include/linux/bpf_verifier.h                  |   2 +
 include/uapi/linux/bpf.h                      |   1 +
 kernel/bpf/core.c                             |   1 +
 kernel/bpf/disasm.c                           |   3 +
 kernel/bpf/verifier.c                         | 269 +++++++++++++-----
 tools/include/uapi/linux/bpf.h                |   1 +
 tools/testing/selftests/bpf/DENYLIST.s390x    |   1 +
 .../testing/selftests/bpf/bpf_experimental.h  |  12 +
 .../bpf/progs/verifier_iterating_callbacks.c  |  72 ++++-
 9 files changed, 291 insertions(+), 71 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2024-03-02  1:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01  3:37 [PATCH v3 bpf-next 0/4] bpf: Introduce may_goto and cond_break Alexei Starovoitov
2024-03-01  3:37 ` [PATCH v3 bpf-next 1/4] bpf: Introduce may_goto instruction Alexei Starovoitov
2024-03-01  3:37 ` [PATCH v3 bpf-next 2/4] bpf: Recognize that two registers are safe when their ranges match Alexei Starovoitov
2024-03-01  3:37 ` [PATCH v3 bpf-next 3/4] bpf: Add cond_break macro Alexei Starovoitov
2024-03-01  3:37 ` [PATCH v3 bpf-next 4/4] selftests/bpf: Test may_goto Alexei Starovoitov
2024-03-01 19:47   ` John Fastabend
2024-03-01 21:16     ` Alexei Starovoitov
2024-03-01 21:47       ` John Fastabend
2024-03-01 22:06         ` John Fastabend
2024-03-01 22:12           ` Alexei Starovoitov
2024-03-01 21:22   ` Alexei Starovoitov
2024-03-01  5:24 ` [PATCH v3 bpf-next 0/4] bpf: Introduce may_goto and cond_break John Fastabend
2024-03-02  1:20 ` Eduard Zingerman
2024-03-02  1:28   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox