BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 00/11] bpf: fixes and follow-ups for 32-/64-bit scalar evolution
@ 2026-10-24  0:03 Eduard Zingerman
  2026-10-24  0:03 ` [PATCH bpf-next 01/11] bpf: reject pointer operands for 32-bit recurrences/latches Eduard Zingerman
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Eduard Zingerman @ 2026-10-24  0:03 UTC (permalink / raw)
  To: bpf, ast; +Cc: andrii, daniel, kernel-team, yonghong.song, Eduard Zingerman

Fixes:
- bpf: look for current loop in upper frames in states_equal()
- bpf: do not intersect with current register range on clamp
- bpf: reject pointer operands for 32-bit recurrences/latches

Follow-ups:
- bpf: (zext32 (zext32 X)) -> (zext32 X) SCEV simplification rule
- bpf: check the iteration count before the predicted exit value

Note: this supersedes [1].

[1] bpf: reject pointer operands for 32-bit recurrences/latches
    https://lore.kernel.org/bpf/a7b9422e00b9a3f5438e996f01e97bef476040e0.camel@gmail.com/

There are some veristat improvements after clamping changes and new
zext32 simplification rule.

A: master; B: scev-simpler-clamp. Corpora: cilium, meta, scx, selftests.
Object exclusions: verifier_scev.bpf.o.
Histogram: selected programs, without the table filters.

Total progs: 8071
 -85 .. -75  %: 1
 -35 .. -25  %: 3
 -25 .. -20  %: 18
 -20 .. -10  %: 5
 -10 .. 0    %: 13
   0 .. 5    %: 8031

Tables: success in both runs; baseline Insns >= 5,000.
Ranked by percentage change, then instruction-count change, file, program.
Meta names are anonymized; numbered objects are distinct files.

Top wins
--------

File                       Program                            Insns (A)  Insns (B)      Insns (DIFF)
-------------------------  ---------------------------------  ---------  ---------  ----------------
profiler-06.bpf.o          on_perf_event                          94751      64595  -30156 (-31.83%)
profiler-19.bpf.o          sched_switch_offcpu                    21906      15726   -6180 (-28.21%)
profiler-12.bpf.o          sched_switch                           12105       9015   -3090 (-25.53%)
profiler-26.bpf.o          handle_cu_mem_address_reserve          12702       9738   -2964 (-23.33%)
profiler-26.bpf.o          handle_cu_mem_create                   12702       9738   -2964 (-23.33%)
profiler-26.bpf.o          handle_malloc                          12702       9738   -2964 (-23.33%)
profiler-26.bpf.o          handle_cu_mem_map                      12900       9936   -2964 (-22.98%)
profiler-09.bpf.o          on_custom_event_start                  12951       9987   -2964 (-22.89%)
profiler-09.bpf.o          trace_func_entry                       12951       9987   -2964 (-22.89%)
profiler-19.bpf.o          sched_waking                            6642       5160   -1482 (-22.31%)
profiler-27.bpf.o          handle_cuda_launch_exc                  6665       5183   -1482 (-22.24%)
profiler-27.bpf.o          handle_cuda_launch                      6678       5196   -1482 (-22.19%)
profiler-12.bpf.o          on_custom_event_begin                   6885       5403   -1482 (-21.53%)
profiler-12.bpf.o          on_custom_event_end                     6889       5407   -1482 (-21.51%)
profiler-26.bpf.o          handle_mtia_cached_alloc               13870      10906   -2964 (-21.37%)
profiler-26.bpf.o          handle_mtia_allocate_enter             13931      10967   -2964 (-21.28%)
profiler-26.bpf.o          handle_pytorch_malloc                  14223      11259   -2964 (-20.84%)
profiler-19.bpf.o          oncpu                                   7178       5696   -1482 (-20.65%)
profiler-12.bpf.o          on_task_enqueued                        7223       5741   -1482 (-20.52%)
profiler-12.bpf.o          sched_waking                            7258       5776   -1482 (-20.42%)
profiler-12.bpf.o          on_task_dequeued                        7398       5916   -1482 (-20.03%)
profiler-12.bpf.o          on_request_context_event                7489       6007   -1482 (-19.79%)
profiler-12.bpf.o          on_pytorch_event                        7490       6008   -1482 (-19.79%)
profiler-12.bpf.o          on_task_stats                           7572       6090   -1482 (-19.57%)
profiler-12.bpf.o          oncpu                                   7676       6194   -1482 (-19.31%)
profiler-12.bpf.o          get_crochet_walltime_stacks            22063      18973   -3090 (-14.01%)
profiler-24.bpf.o          get_task_stacks                        64928      61154    -3774 (-5.81%)

---
Eduard Zingerman (11):
      bpf: reject pointer operands for 32-bit recurrences/latches
      bpf: do not intersect with current register range on clamp
      bpf: look for current loop in upper frames in states_equal()
      bpf: check the iteration count before the predicted exit value
      bpf: (zext32 (zext32 X)) -> (zext32 X) SCEV simplification rule
      bpf: print 32-bit SCEV bounds as 32-bit numbers
      selftests/bpf: pointer operands for 32-bit recurrences/latches
      selftests/bpf: cases with empty range error under old clamping logic
      selftests/bpf: case reporting infinite loop w/o current_loop() changes
      selftests/bpf: 32-bit copy of the counter compared at the latch
      selftests/bpf: Restore stack pointer subrange pruning coverage

 include/linux/bpf_verifier.h                       |   1 +
 kernel/bpf/log.c                                   |   8 +
 kernel/bpf/scev.c                                  |  47 +++--
 kernel/bpf/states.c                                |  10 +-
 tools/testing/selftests/bpf/progs/verifier_scev.c  | 235 ++++++++++++++++++++-
 .../selftests/bpf/progs/verifier_stack_ptr.c       |  30 +--
 6 files changed, 289 insertions(+), 42 deletions(-)
---
base-commit: b116ac6087541d3d98031e786adbe9c733cd6df3
change-id: 20261022-scev-simpler-clamp-4b5486b201d2

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

end of thread, other threads:[~2026-10-26 18:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-24  0:03 [PATCH bpf-next 00/11] bpf: fixes and follow-ups for 32-/64-bit scalar evolution Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 01/11] bpf: reject pointer operands for 32-bit recurrences/latches Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 02/11] bpf: do not intersect with current register range on clamp Eduard Zingerman
2026-10-24  0:41   ` bot+bpf-ci
2026-10-24  6:57     ` Eduard Zingerman
2026-10-25  1:03       ` Alexei Starovoitov
2026-10-25  5:10         ` Alexei Starovoitov
2026-10-26 18:32           ` Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 03/11] bpf: look for current loop in upper frames in states_equal() Eduard Zingerman
2026-10-24  0:27   ` sashiko-bot
2026-10-24  0:41   ` bot+bpf-ci
2026-10-24  0:03 ` [PATCH bpf-next 04/11] bpf: check the iteration count before the predicted exit value Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 05/11] bpf: (zext32 (zext32 X)) -> (zext32 X) SCEV simplification rule Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 06/11] bpf: print 32-bit SCEV bounds as 32-bit numbers Eduard Zingerman
2026-10-24  0:41   ` bot+bpf-ci
2026-10-24  0:03 ` [PATCH bpf-next 07/11] selftests/bpf: pointer operands for 32-bit recurrences/latches Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 08/11] selftests/bpf: cases with empty range error under old clamping logic Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 09/11] selftests/bpf: case reporting infinite loop w/o current_loop() changes Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 10/11] selftests/bpf: 32-bit copy of the counter compared at the latch Eduard Zingerman
2026-10-24  0:03 ` [PATCH bpf-next 11/11] selftests/bpf: Restore stack pointer subrange pruning coverage Eduard Zingerman
2026-10-24  5:11 ` [PATCH bpf-next 00/11] bpf: fixes and follow-ups for 32-/64-bit scalar evolution Alexei Starovoitov
2026-10-24  5:33   ` Eduard Zingerman

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