-
Notifications
You must be signed in to change notification settings - Fork 699
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
add support for struct_ops maps and programs #1603
Conversation
This commit introduces the ability for users to define and use struct_ops maps and associated programs. With this addition, eBPF programs can implement and register kernel structures, enabling struct_ops functionalities like `sched_ext`. Example Usage: Users can now define struct_ops maps and associated programs like this: ```c SEC("struct_ops/dummy_test_1") int dummy_test_1(void *arg) { return 0; } SEC("struct_ops.s/dummy_test_sleepable") int dummy_test_sleepable(void *arg) { return 0; } SEC(".struct_ops.link") struct bpf_dummy_ops dummy_ops = { .test_1 = dummy_test_1, .test_sleepable = dummy_test_sleepable, }; ``` In this example, the program defines a `bpf_dummy_ops` struct with function pointers and registers implementations of these functions. The `.struct_ops.link` section indicates that the struct should be linked with the kernel. Signed-off-by: shun159 <[email protected]>
097b9bf
to
c1d69f6
Compare
3aa0d1d
to
54d1a2f
Compare
54d1a2f
to
49546a8
Compare
Hi @shun159, this PR clearly represents a significant amount of work, so first of all, thank you for the time investment. Unfortunately, given the size of this change, we need to discuss architecture first. Maybe you intended to drive this conversation through this PR, but understand that it's a lot of code and quite a few adjustments will be needed to make things fit. In the future, it would be ideal if the initial conversation, like we had in the issue, goes a bit more in-depth. If this would be a contribution from a colleague, this is the kind of change I'd ask a code walk for. Having skimmed the PR (on mobile 😢), a few observations:
Note: I'll be off next week, so I may take some time to respond. Thanks again! |
Hi @ti-mo, Thank you for your feedback.
Also, I'd like to discuss the architecture, so let's discuss it here. Let me close this PR. Have a good vacation! |
This commit introduces the ability for users to define and use struct_ops maps and associated programs. With this addition, eBPF programs can implement and register kernel structures, enabling struct_ops functionalities like
sched_ext
.Example Usage:
Users can now define struct_ops maps and associated programs like this:
In this example, the program defines a
bpf_dummy_ops
struct with function pointers and registers implementations of these functions. The.struct_ops.link
section indicates that the struct should be linked with the kernel.