BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v1 0/7] IRQ save/restore
@ 2024-11-21  0:53 Kumar Kartikeya Dwivedi
  2024-11-21  0:53 ` [PATCH bpf-next v1 1/7] bpf: Refactor and rename resource management Kumar Kartikeya Dwivedi
                   ` (6 more replies)
  0 siblings, 7 replies; 30+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2024-11-21  0:53 UTC (permalink / raw)
  To: bpf
  Cc: kkd, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Martin KaFai Lau, Eduard Zingerman, kernel-team

This set introduces support for managing IRQ state from BPF programs.
Two new kfuncs, bpf_local_irq_save, and bpf_local_irq_restore are
introduced to enable this functionality.

Intended use cases are writing IRQ safe data structures (e.g. memory
allocator) in BPF programs natively, and use in new spin locking
primitives intended to be introduced in the next few weeks.

The set begins with some refactoring patches before the actual
functionality is introduced. First, we rename bpf_reference_state to
bpf_resource_state, and stick to calling pointer resources as actual
references, as the meaning is right now mixed (with lock state
management functions calling acquire_reference_state and
check_reference_leak not considering lock resoures, causing confusion).

The first patch also takes this opportunity to eliminate code
duplication where possible. The second patch resolves an inconsistency
in the same set of functions for managing lock state, in preparation for
later patches that require passing bpf_func_state explicitly to find a
lock state.

Since we now manage locks in bpf_func_state alongside other resources,
this is a good opportunity to consolidate all other resources like RCU
read sections and preempt-disabled section tracking into bpf_func_state
as well, which is what patch 3 achieves.

After this, patch 4 refactors stack slot liveness marking logic to be
shared between dynptr, and iterators, in preparation for introducing
same logic for irq flag object on stack.

Finally, patch 5 and 7 introduce the new kfuncs and their selftests. For
more details, please inspect the patch commit logs. Patch 6 expands
coverage of existing preempt-disable selftest to cover sleepable kfuncs.

Kumar Kartikeya Dwivedi (7):
  bpf: Refactor and rename resource management
  bpf: Be consistent between {acquire,find,release}_lock_state
  bpf: Consolidate RCU and preempt locks in bpf_func_state
  bpf: Refactor mark_{dynptr,iter}_read
  bpf: Introduce support for bpf_local_irq_{save,restore}
  selftests/bpf: Expand coverage of preempt tests to sleepable kfunc
  selftests/bpf: Add IRQ save/restore tests

 include/linux/bpf_verifier.h                  |  47 +-
 kernel/bpf/helpers.c                          |  24 +
 kernel/bpf/log.c                              |  11 +-
 kernel/bpf/verifier.c                         | 540 ++++++++++++++----
 tools/testing/selftests/bpf/prog_tests/irq.c  |   9 +
 tools/testing/selftests/bpf/progs/irq.c       | 393 +++++++++++++
 .../selftests/bpf/progs/preempt_lock.c        |  12 +
 7 files changed, 889 insertions(+), 147 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/irq.c
 create mode 100644 tools/testing/selftests/bpf/progs/irq.c


base-commit: 2c8b09ac2537299511c898bc71b1a5f2756c831c
-- 
2.43.5


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

end of thread, other threads:[~2024-11-22  0:42 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21  0:53 [PATCH bpf-next v1 0/7] IRQ save/restore Kumar Kartikeya Dwivedi
2024-11-21  0:53 ` [PATCH bpf-next v1 1/7] bpf: Refactor and rename resource management Kumar Kartikeya Dwivedi
2024-11-21 16:57   ` Eduard Zingerman
2024-11-21 17:17     ` Kumar Kartikeya Dwivedi
2024-11-22  0:24   ` Alexei Starovoitov
2024-11-22  0:31     ` Kumar Kartikeya Dwivedi
2024-11-21  0:53 ` [PATCH bpf-next v1 2/7] bpf: Be consistent between {acquire,find,release}_lock_state Kumar Kartikeya Dwivedi
2024-11-21 17:54   ` Eduard Zingerman
2024-11-21  0:53 ` [PATCH bpf-next v1 3/7] bpf: Consolidate RCU and preempt locks in bpf_func_state Kumar Kartikeya Dwivedi
2024-11-21 18:09   ` Eduard Zingerman
2024-11-21 18:12     ` Kumar Kartikeya Dwivedi
2024-11-21 18:54       ` Eduard Zingerman
2024-11-21 22:04         ` Kumar Kartikeya Dwivedi
2024-11-21  0:53 ` [PATCH bpf-next v1 4/7] bpf: Refactor mark_{dynptr,iter}_read Kumar Kartikeya Dwivedi
2024-11-21 18:00   ` Eduard Zingerman
2024-11-21  0:53 ` [PATCH bpf-next v1 5/7] bpf: Introduce support for bpf_local_irq_{save,restore} Kumar Kartikeya Dwivedi
2024-11-21 20:21   ` Eduard Zingerman
2024-11-21 22:06     ` Kumar Kartikeya Dwivedi
2024-11-21 23:08       ` Eduard Zingerman
2024-11-21 23:12         ` Kumar Kartikeya Dwivedi
2024-11-22  0:30           ` Eduard Zingerman
2024-11-22  0:32       ` Alexei Starovoitov
2024-11-22  0:42         ` Kumar Kartikeya Dwivedi
2024-11-21 22:46   ` kernel test robot
2024-11-21  0:53 ` [PATCH bpf-next v1 6/7] selftests/bpf: Expand coverage of preempt tests to sleepable kfunc Kumar Kartikeya Dwivedi
2024-11-21 20:23   ` Eduard Zingerman
2024-11-21  0:53 ` [PATCH bpf-next v1 7/7] selftests/bpf: Add IRQ save/restore tests Kumar Kartikeya Dwivedi
2024-11-21 20:43   ` Eduard Zingerman
2024-11-21 22:07     ` Kumar Kartikeya Dwivedi
2024-11-21 23:09       ` Eduard Zingerman

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