-
Notifications
You must be signed in to change notification settings - Fork 110
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
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>
Upstream branch: 5bbb9e1 |
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=783659 expired. Closing PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: Registrating struct_ops types from modules
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=783659