Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v1 0/4] bpf: Add wakeup_source iterators
@ 2025-12-04  2:49 Samuel Wu
  2025-12-04  2:49 ` [PATCH v1 1/4] bpf: Add wakeup_source iterator Samuel Wu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Samuel Wu @ 2025-12-04  2:49 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Shuah Khan
  Cc: rafael.j.wysocki, Samuel Wu, kernel-team, linux-kernel, bpf,
	linux-kselftest

This patch series introduces BPF iterators for wakeup_source, enabling
BPF programs to efficiently traverse a device's wakeup sources.

Currently, inspecting wakeup sources typically involves reading interfaces
like /sys/class/wakeup/* or debugfs. The repeated syscalls to query the
sysfs nodes is inefficient, as there can be hundreds of wakeup_sources, and
each wakeup source have multiple stats, with one sysfs node per stat.
debugfs is unstable and insecure.

This series implements two types of iterators:
1. Standard BPF Iterator: Allows creating a BPF link to iterate over
   wakeup sources
2. Open-coded Iterator: Enables the use of wakeup_source iterators directly
   within BPF programs

Both iterators utilize pre-existing APIs wakeup_sources_walk_* to traverse
over the SRCU that backs the list of wakeup_sources.

Samuel Wu (4):
  bpf: Add wakeup_source iterator
  bpf: Open coded BPF for wakeup_sources
  selftests/bpf: Add tests for wakeup_sources
  selftests/bpf: Open coded BPF wakeup_sources test

 kernel/bpf/Makefile                           |   1 +
 kernel/bpf/helpers.c                          |   3 +
 kernel/bpf/wakeup_source_iter.c               | 137 ++++++++
 .../testing/selftests/bpf/bpf_experimental.h  |   5 +
 tools/testing/selftests/bpf/config            |   1 +
 .../bpf/prog_tests/wakeup_source_iter.c       | 323 ++++++++++++++++++
 .../selftests/bpf/progs/wakeup_source_iter.c  | 117 +++++++
 7 files changed, 587 insertions(+)
 create mode 100644 kernel/bpf/wakeup_source_iter.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/wakeup_source_iter.c
 create mode 100644 tools/testing/selftests/bpf/progs/wakeup_source_iter.c

-- 
2.52.0.177.g9f829587af-goog

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

end of thread, other threads:[~2025-12-05  3:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04  2:49 [PATCH v1 0/4] bpf: Add wakeup_source iterators Samuel Wu
2025-12-04  2:49 ` [PATCH v1 1/4] bpf: Add wakeup_source iterator Samuel Wu
2025-12-04 21:23   ` kernel test robot
2025-12-05  3:17   ` kernel test robot
2025-12-04  2:49 ` [PATCH v1 2/4] bpf: Open coded BPF for wakeup_sources Samuel Wu
2025-12-04  2:50 ` [PATCH v1 3/4] selftests/bpf: Add tests " Samuel Wu
2025-12-04  2:50 ` [PATCH v1 4/4] selftests/bpf: Open coded BPF wakeup_sources test Samuel Wu

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