[PATCH bpf-next v2 0/2] Document some recent core kfunc additions

From: David Vernet
Date: Mon Dec 05 2022 - 17:02:20 EST


A series of recent patch sets introduced kfuncs that allowed struct
task_struct and struct cgroup objects to be used as kptrs. These were
introduced in [0], [1], and [2].

[0]: https://lore.kernel.org/lkml/20221120051004.3605026-1-void@xxxxxxxxxxxxx/
[1]: https://lore.kernel.org/lkml/20221122145300.251210-2-void@xxxxxxxxxxxxx/T/
[2]: https://lore.kernel.org/lkml/20221122055458.173143-1-void@xxxxxxxxxxxxx/

These are "core" kfuncs, in that they may be used by a wide variety of
possible BPF tracepoint or struct_ops programs, and are defined in
kernel/bpf/helpers.c. Even though as kfuncs they have no ABI stability
guarantees, they should still be properly documented. This patch set
adds that documentation.

Some other kfuncs were added recently as well, such as
bpf_rcu_read_lock() and bpf_rcu_read_unlock(). Those could and should be
added to this "Core kfuncs" section as well in other patch sets.

--
Changelog:
v1 -> v2:
- Expand comment to specify that a map holds a reference to a task kptr
if we don't end up releasing it (Alexei)
- Just read task->pid instead of using a probed read (Alexei)

David Vernet (2):
bpf/docs: Document struct task_struct * kfuncs
bpf/docs: Document struct cgroup * kfuncs

Documentation/bpf/kfuncs.rst | 197 +++++++++++++++++++++++++++++++++++
kernel/bpf/helpers.c | 10 +-
2 files changed, 202 insertions(+), 5 deletions(-)

--
2.38.1