mbox series

[bpf-next,v3,0/3] Global subprogs in RCU/{preempt,irq}-disabled sections

Message ID 20250301151846.1552362-1-memxor@gmail.com (mailing list archive)
Headers show
Series Global subprogs in RCU/{preempt,irq}-disabled sections | expand

Message

Kumar Kartikeya Dwivedi March 1, 2025, 3:18 p.m. UTC
Small change to allow non-sleepable global subprogs in
RCU, preempt-disabled, and irq-disabled sections. For
now, we don't lift the limitation for locks as it requires
more analysis, and will do this one resilient spin locks
land.

This surfaced a bug where sleepable global subprogs were
allowed in RCU read sections, that has been fixed. Tests
have been added to cover various cases.

Changelog:
----------
v2 -> v3
v2: https://lore.kernel.org/bpf/20250301030205.1221223-1-memxor@gmail.com

  * Fix broken to_be_replaced argument in the selftest.
  * Adjust selftest program type.

v1 -> v2
v1: https://lore.kernel.org/bpf/20250228162858.1073529-1-memxor@gmail.com

  * Rename subprog_info[i].sleepable to might_sleep, which more
    accurately reflects the nature of the bit. 'sleepable' means whether
    a given context is allowed to, while might_sleep captures if it
    does.
  * Disallow extensions that might sleep to attach to targets that don't
    sleep, since they'd be permitted to be called in atomic contexts. (Eduard)
  * Add tests for mixing non-sleepable and sleepable global function
    calls, and extensions attaching to non-sleepable global functions. (Eduard)
  * Rename changes_pkt_data -> summarization

Kumar Kartikeya Dwivedi (3):
  bpf: Summarize sleepable global subprogs
  selftests/bpf: Test sleepable global subprogs in atomic contexts
  selftests/bpf: Add tests for extending sleepable global subprogs

 include/linux/bpf.h                           |   1 +
 include/linux/bpf_verifier.h                  |   1 +
 kernel/bpf/verifier.c                         |  62 ++++++--
 .../bpf/prog_tests/changes_pkt_data.c         | 107 -------------
 .../selftests/bpf/prog_tests/rcu_read_lock.c  |   3 +
 .../selftests/bpf/prog_tests/spin_lock.c      |   3 +
 .../selftests/bpf/prog_tests/summarization.c  | 144 ++++++++++++++++++
 .../selftests/bpf/progs/changes_pkt_data.c    |  39 -----
 tools/testing/selftests/bpf/progs/irq.c       |  71 ++++++++-
 .../selftests/bpf/progs/preempt_lock.c        |  68 ++++++++-
 .../selftests/bpf/progs/rcu_read_lock.c       |  58 +++++++
 .../selftests/bpf/progs/summarization.c       |  78 ++++++++++
 ...ta_freplace.c => summarization_freplace.c} |  17 ++-
 .../selftests/bpf/progs/test_spin_lock_fail.c |  69 +++++++++
 14 files changed, 558 insertions(+), 163 deletions(-)
 delete mode 100644 tools/testing/selftests/bpf/prog_tests/changes_pkt_data.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/summarization.c
 delete mode 100644 tools/testing/selftests/bpf/progs/changes_pkt_data.c
 create mode 100644 tools/testing/selftests/bpf/progs/summarization.c
 rename tools/testing/selftests/bpf/progs/{changes_pkt_data_freplace.c => summarization_freplace.c} (57%)


base-commit: 0b9363131daf4227d5ae11ee677acdcfff06e938

Comments

patchwork-bot+netdevbpf@kernel.org March 2, 2025, 10:20 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Sat,  1 Mar 2025 07:18:43 -0800 you wrote:
> Small change to allow non-sleepable global subprogs in
> RCU, preempt-disabled, and irq-disabled sections. For
> now, we don't lift the limitation for locks as it requires
> more analysis, and will do this one resilient spin locks
> land.
> 
> This surfaced a bug where sleepable global subprogs were
> allowed in RCU read sections, that has been fixed. Tests
> have been added to cover various cases.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v3,1/3] bpf: Summarize sleepable global subprogs
    https://git.kernel.org/bpf/bpf-next/c/90d8c8980b5c
  - [bpf-next,v3,2/3] selftests/bpf: Test sleepable global subprogs in atomic contexts
    https://git.kernel.org/bpf/bpf-next/c/6e2cc6067e73
  - [bpf-next,v3,3/3] selftests/bpf: Add tests for extending sleepable global subprogs
    https://git.kernel.org/bpf/bpf-next/c/ce9add7b9028

You are awesome, thank you!