diff options
| author | Martin KaFai Lau <martin.lau@kernel.org> | 2025-08-06 13:39:59 -0700 |
|---|---|---|
| committer | Martin KaFai Lau <martin.lau@kernel.org> | 2025-08-06 16:01:58 -0700 |
| commit | 911c0359d8f6da3ffdeee52886f820fbf1c7fa5c (patch) | |
| tree | bd0accb31af9e24c738fc8a6eb259781a61bd69a /scripts/gdb/linux/timerlist.py | |
| parent | f3af62b6cee8af9f07012051874af2d2a451f0e5 (diff) | |
| parent | ba7000f1c360f34286f48bd5e670cefbab77ce8f (diff) | |
Merge branch 'allow-struct_ops-to-create-map-id-to'
Amery Hung says:
====================
This patchset allows struct_ops implementors to get map id from kdata in
reg(), unreg() and update() so that they create an id to struct_ops
instance mapping. This in turn allows struct_ops kfuncs to refer to the
calling instance without passing a pointer to the struct_ops. The selftest
provides an end-to-end example.
Some struct_ops users extend themselves with other bpf programs, which
also need to call struct_ops kfuncs. For example, scx_layered uses
syscall bpf programs as a scx_layered specific control plane and uses
tracing programs to get additional information for scheduling [0].
The kfuncs may need to refer to the struct_ops instance and perform
jobs accordingly. To allow calling struct_ops kfuncs referring to
specific instances from different program types and context (e.g.,
struct_ops, tracing, async callbacks), the traditional way is to pass
the struct_ops pointer to kfuncs.
This patchset provides an alternative way, through a combination of
bpf map id and global variable. First, a struct_ops implementor will
use the map id of the struct_ops map as the id of an instance. Then,
it needs to maintain an id to instance mapping: inserting a new mapping
during reg() and removing it during unreg(). The map id can be acquired
by calling bpf_struct_ops_id().
v1 -> v2
Add bpf_struct_ops_id() instead of using bpf_struct_ops_get()
[0] https://github.com/sched-ext/scx/blob/main/scheds/rust/scx_layered/src/bpf/main.bpf.c
====================
Link: https://patch.msgid.link/20250806162540.681679-1-ameryhung@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'scripts/gdb/linux/timerlist.py')
0 files changed, 0 insertions, 0 deletions
