mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/4] Add wakeup_source iterators
@ 2026-01-08 22:55 Samuel Wu
  2026-01-08 22:55 ` [PATCH bpf-next v2 1/4] bpf: Add wakeup_source iterator Samuel Wu
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Samuel Wu @ 2026-01-08 22:55 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: 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.

Changes in v2:
 - Guard BPF Makefile with CONFIG_PM_SLEEP to fix build errors
 - Update copyright from 2025 to 2026
 - v1 link: https://lore.kernel.org/all/20251204025003.3162056-1-wusamuel@google.com/

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                           |   3 +
 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, 589 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.457.g6b5491de43-goog


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

end of thread, other threads:[~2026-01-21 23:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-08 22:55 [PATCH bpf-next v2 0/4] Add wakeup_source iterators Samuel Wu
2026-01-08 22:55 ` [PATCH bpf-next v2 1/4] bpf: Add wakeup_source iterator Samuel Wu
2026-01-08 23:21   ` bot+bpf-ci
2026-01-08 22:55 ` [PATCH bpf-next v2 2/4] bpf: Open coded BPF for wakeup_sources Samuel Wu
2026-01-08 23:21   ` bot+bpf-ci
2026-01-08 22:55 ` [PATCH bpf-next v2 3/4] selftests/bpf: Add tests " Samuel Wu
2026-01-09 23:31   ` Andrii Nakryiko
2026-01-21 23:28     ` Samuel Wu
2026-01-08 22:55 ` [PATCH bpf-next v2 4/4] selftests/bpf: Open coded BPF wakeup_sources test Samuel Wu
2026-01-09 23:37 ` [PATCH bpf-next v2 0/4] Add wakeup_source iterators Andrii Nakryiko
2026-01-21 23:27   ` Samuel Wu

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

all inboxes | Powered by JetHome®