Skip to content

Transfer RCU lock state across subprog calls

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 3 repliesApplied 2/2
  2. v12 patches 5 repliesSuperseded

Changes in v2 from the cover letter

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

* Add tests for global subprog behaviour (Yafang)
* Add Acks, Tested-by (Yonghong, Yafang)

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Transfer RCU lock state between subprog callskernel/bpf/verifier.c+1 -21 replyApplied
2/2selftests/bpf: Add tests for RCU lock transfer between subprogstools/testing/selftests/bpf/prog_tests/rcu_read_lock.c tools/testing/selftests/bpf/progs/rcu_read_lock.c+126 -02 repliesApplied

Reviews trailers per patch

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

PatchYafang ShaoYonghong SongDavid Vernet
1/2T-b A-b A-b
2/2Acked-and-Tested-by A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/2] Transfer RCU lock state across subprog calls

David suggested during the discussion in [0] that we should handle RCU locks in a similar fashion to spin locks where the verifier understands when a lock held in a caller is released in callee, or lock taken in callee is released in a caller, or the callee is called within a lock critical section. This set extends the same semantics to RCU read locks and adds a few selftests to verify correct behavior. This issue has also come up for sched-ext programs.

This would now allow static subprog calls to be made without errors within RCU read sections, for subprogs to release RCU locks of callers and return to them, or for subprogs to take RCU lock which is later released in the caller.

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

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

* Add tests for global subprog behaviour (Yafang)
* Add Acks, Tested-by (Yonghong, Yafang)

Kumar Kartikeya Dwivedi (2):
bpf: Transfer RCU lock state between subprog calls selftests/bpf: Add tests for RCU lock transfer between subprogs

 kernel/bpf/verifier.c                         |   3 +-
 .../selftests/bpf/prog_tests/rcu_read_lock.c  |   6 +
 .../selftests/bpf/progs/rcu_read_lock.c       | 120 ++++++++++++++++++
 3 files changed, 127 insertions(+), 2 deletions(-)

base-commit: 2a79690eae953daaac232f93e6c5ac47ac539f2d

Signature · 1 line
2.40.1