public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	kkd@meta.com, kernel-team@meta.com
Subject: [PATCH bpf-next v3 0/3] Global subprogs in RCU/{preempt,irq}-disabled sections
Date: Sat,  1 Mar 2025 07:18:43 -0800	[thread overview]
Message-ID: <20250301151846.1552362-1-memxor@gmail.com> (raw)

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
-- 
2.43.5


             reply	other threads:[~2025-03-01 15:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-01 15:18 Kumar Kartikeya Dwivedi [this message]
2025-03-01 15:18 ` [PATCH bpf-next v3 1/3] bpf: Summarize sleepable global subprogs Kumar Kartikeya Dwivedi
2025-03-01 15:18 ` [PATCH bpf-next v3 2/3] selftests/bpf: Test sleepable global subprogs in atomic contexts Kumar Kartikeya Dwivedi
2025-03-01 15:18 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add tests for extending sleepable global subprogs Kumar Kartikeya Dwivedi
2025-03-02 22:20 ` [PATCH bpf-next v3 0/3] Global subprogs in RCU/{preempt,irq}-disabled sections patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250301151846.1552362-1-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=martin.lau@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox