Skip to content

Enable static subprog calls in spin lock critical sections

Kumar Kartikeya Dwivedi bpf 2 versions Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied 2/2
  2. v12 patches 7 repliesSuperseded

Changes in v2 from the cover letter

v1: https://lore.kernel.org/bpf/[email protected]

* Indicate global function call in verifier error string (Yonghong, David)
* Add Acks from Yonghong, David

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Allow calling static subprogs while holding a bpf_spin_lockkernel/bpf/verifier.c tools/testing/selftests/bpf/progs/verifier_spin_lock.c+9 -40 repliesApplied
2/2selftests/bpf: Add test for static subprog call in lock cstools/testing/selftests/bpf/prog_tests/spin_lock.c tools/testing/selftests/bpf/progs/test_spin_lock.c tools/testing/selftests/bpf/progs/test_spin_lock_fail.c+111 -00 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchYonghong SongDavid Vernet
1/2A-b A-b
2/2A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/2] Enable static subprog calls in spin lock critical sections

This set allows a BPF program to make a call to a static subprog within a bpf_spin_lock critical section. This problem has been hit in sched-ext and ghOSt [0] as well, and is mostly an annoyance which is worked around by inling the static subprog into the critical section.

In case of sched-ext, there are a lot of other helper/kfunc calls that need to be allow listed for the support to be complete, but a separate follow up will deal with that.

Unlike static subprogs, global subprogs cannot be allowed yet as the verifier will not explore their body when encountering a call instruction for them. Therefore, we would need an alternative approach (some sort of function summarization to ensure a lock is never taken from a global subprog and all its callees).

[0]: https://lore.kernel.org/bpf/[email protected]

Changelog:
----------
v1 -> v2
v1: https://lore.kernel.org/bpf/[email protected]

* Indicate global function call in verifier error string (Yonghong, David)
* Add Acks from Yonghong, David

Kumar Kartikeya Dwivedi (2):
bpf: Allow calling static subprogs while holding a bpf_spin_lock selftests/bpf: Add test for static subprog call in lock cs

 kernel/bpf/verifier.c                         | 11 +++-
 .../selftests/bpf/prog_tests/spin_lock.c      |  2 +
 .../selftests/bpf/progs/test_spin_lock.c      | 65 +++++++++++++++++++
 .../selftests/bpf/progs/test_spin_lock_fail.c | 44 +++++++++++++
 .../selftests/bpf/progs/verifier_spin_lock.c  |  2 +-
 5 files changed, 120 insertions(+), 4 deletions(-)

base-commit: 2a79690eae953daaac232f93e6c5ac47ac539f2d

Signature · 1 line
2.40.1