-
Notifications
You must be signed in to change notification settings - Fork 95
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
feat: add AttachStructOps() #476
base: main
Are you sure you want to change the base?
Conversation
@ianchen0119 that's awesome. Tks for the contribution. Would you mind creating a selftest to this feature? As soon as possible I'm returning to review it. Anything, just ask. |
Hi @geyslan Sure, I will add the selftest in next few days. Thank you. |
Hi @geyslan I just added the selftest for struct_ops, please help to reivew PR when you feel free. Thank you! |
@ianchen0119 thanks. Would you mind rebasing it? I believe you added not expected files. Regarding the Makefile, you can reuse the common, just copying the link to the folder of the new selftest. |
Hi @geyslan Thanks for the comment. I will rebase the PR later. |
Any new type or definition you can add to https://github.com/aquasecurity/libbpfgo/blob/main/selftest/common/vmlinux.h. We keep it to minimal to reduce building time etc. Try adding only what's required to bpf_map__attach_struct_ops which is being wrapped by libbpfgo. In your bpf.c include vmlinux and the helpers (e.g.: spinlocks), so I believe it'll be ok. |
3d2f698
to
198318a
Compare
Hi @geyslan , I just updated my PR based on your comments. Thank you! |
I think your vmlinux.h is still commited, see the LOC changed: +151,024. |
Hi @geyslan I added the needed definition for compiling the scx program in vmlinux.h in the latest commit. Thanks! |
I believe we're almost there. Please, check these: |
Hi @geyslan It seems like the kernel version of the ci runner is v6.8. Do you have any suggestions on this? Thanks! |
@geyslan |
Well, we can offload a runner (with newest kernel) for testing new features like it - we'll be able to do that in a few days. libbpfgo/selftest/common/run-5.8.sh Line 15 in c0ac603
selftest/struct-ops/run.sh to it.
You're currently bringing in the |
The file run-6.12.sh has been added, thanks for your advice.
No problem, I will open the new PR for support user_ring_buffer once the current PR merged. |
JFYI, for the sched_ext selftests we use virtme-ng (https://github.com/arighi/virtme-ng). We also recompile the kernel, but in this case it'd be proobably easier to use a precompiled 6.12, for example:
This would download a v6.12.2 from the Ubuntu mainline kernel builds, run the command CMD inside a guest with that kernel and print the stdout/stderr of the command back to the host, so you can catch potential errors. And you can run this also as a github action. |
@arighi That's awesome! @ianchen0119 perhaps you just need to change the specific run.sh to use vng. |
No problem, I will do in next few day. |
@@ -14,12 +14,14 @@ runs: | |||
go-version: "${{ inputs.go-version }}" | |||
- name: Install Compilers & Formatters | |||
run: | | |||
sudo add-apt-repository ppa:arighi/virtme-ng -y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not maintaining this ppa anymore (the version of virtme-ng there is pretty old). You could simply apt install virtme-ng
if you're using at least an Ubuntu Noble (24.04) image, or, even better, install vng via pip, pip install --break-system-packages virtme-ng
. This is probably a safer / more reliable approach.
Hi @geyslan
The sched_ext gives the flexibility for customizing the os scheduler.
I'm trying to offload the scheduler behaviors from kernel space to user space in golang(The idea is inspired by the @arighi 's presentation).
Therefore, I made the PR for supporting the SCX eBPF program attachment.
The result shows below:
sameple code: