diff options
| author | Tejun Heo <tj@kernel.org> | 2026-05-22 07:22:15 -1000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-05-23 01:50:33 -0700 |
| commit | 7c48a28c1bbe26e272bc978a42adb757fc6aa639 (patch) | |
| tree | ae527453c7b040a88660940fdb891bde2e4a06d8 /include/linux/debugobjects.h | |
| parent | f211c81ddc368e5cc6ad69d171bca0fa52e71ad7 (diff) | |
bpf: Add bpf_struct_ops_for_each_prog()
Add a helper that walks the member progs of the struct_ops map
containing a given @kdata vmtable. struct_ops ->reg() callbacks (and
similar) sometimes need to inspect the loaded BPF programs, e.g. to
discover maps they reference via prog->aux->used_maps.
The implementation mirrors bpf_struct_ops_id(): container_of @kdata
to recover the bpf_struct_ops_map, then iterate st_map->links[i]->prog
for i in [0, funcs_cnt). Same access pattern, no new locking - by the
time ->reg() fires st_map is fully populated and stable.
A sched_ext follow-up walks the member progs of a cid-form scheduler's
struct_ops map, reads prog->aux->arena directly, and requires all member
progs to reference exactly one arena, without requiring the BPF program
to call a registration kfunc.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260522172219.1423324-5-tj@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions
