mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/3] Add wakeup_source iterators
@ 2026-01-24  1:21 Samuel Wu
  2026-01-24  1:21 ` [PATCH bpf-next v3 1/3] PM: wakeup: Handle empty list in wakeup_sources_walk Samuel Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Samuel Wu @ 2026-01-24  1:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
	Danilo Krummrich, 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, linux-pm, 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.

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

Changes in v3:
 - Update wakeup_sources_walk_start() to handle an empty list per bpf-ci
 - Simplify read of a struct's field in BPF program selftest per Andrii
 - Drop open coded iterators for wakeup_sources
 - Fix condition from !get_ws_iter_stream to get_ws_iter_stream in selftest
 - Read event_count instead of wakeup_count in selftest
 - v2 link: https://lore.kernel.org/all/20260108225523.3268383-1-wusamuel@google.com/

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 (3):
  PM: wakeup: Handle empty list in wakeup_sources_walk
  bpf: Add wakeup_source iterator
  selftests/bpf: Add tests for wakeup_sources

 drivers/base/power/wakeup.c                   |   4 +-
 kernel/bpf/Makefile                           |   3 +
 kernel/bpf/wakeup_source_iter.c               | 103 +++++++
 tools/testing/selftests/bpf/config            |   1 +
 .../bpf/prog_tests/wakeup_source_iter.c       | 281 ++++++++++++++++++
 .../selftests/bpf/progs/wakeup_source_iter.c  |  60 ++++
 6 files changed, 449 insertions(+), 3 deletions(-)
 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-02-02 20:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-24  1:21 [PATCH bpf-next v3 0/3] Add wakeup_source iterators Samuel Wu
2026-01-24  1:21 ` [PATCH bpf-next v3 1/3] PM: wakeup: Handle empty list in wakeup_sources_walk Samuel Wu
2026-01-27 16:15   ` Rafael J. Wysocki
2026-02-02 20:23     ` Samuel Wu
2026-02-02 20:40       ` Rafael J. Wysocki
2026-01-24  1:21 ` [PATCH bpf-next v3 2/3] bpf: Add wakeup_source iterator Samuel Wu
2026-01-24  1:50   ` bot+bpf-ci
2026-02-02 20:33     ` Samuel Wu
2026-01-24  1:21 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add tests for wakeup_sources Samuel Wu
2026-01-24  1:50   ` bot+bpf-ci
2026-02-02 20: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®