Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registrating struct_ops types from modules #5668

Closed

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: Registrating struct_ops types from modules
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=783659

Move most of code to bpf_struct_ops_init_one() that can be use to
initialize new struct_ops types registered dynamically.
Provide registration functions to add/remove struct_ops types.

Currently, it does linear search to find a struct_ops type. It should be
fine for now since we don't have many struct_ops types.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Every struct_ops type should has an associated module BTF to provide type
information since we are going to allow modules to define and register new
struct_ops types. New types may exist only in module itself, and the kernel
BTF (vmlinux) doesn't know it at all. The attached module BTF here will be
used to resolve type IDs of a struct_ops map.
The signatures may be declared in the module defining the structs type.
So, we need to know which module BTF to look for type information.  The
later patches will make libbpf to attach module BTFs to programs. This
patch tries to use the attached BTF if there is.
Ensure a module doesn't go away when a struct_ops map is still alive with a
struct_ops type defined by the module.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Find module BTFs for struct_ops maps and progs and pass them to the kernel.
It ensures the kernel resolve type IDs from correct module BTFs.
btf_ctx_access() is needed by module to call bpf_tracing_btf_ctx_access().
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 5bbb9e1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=783659
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=783659 expired. Closing PR.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/783659=>bpf-next branch September 15, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant