-
Notifications
You must be signed in to change notification settings - Fork 382
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
bpf: replace arch-specific pt_regs assumptions with bpf co-re macros #209
Conversation
22e8291
to
523cd26
Compare
Take a look at this https://elixir.bootlin.com/linux/latest/source/tools/lib/bpf/bpf_tracing.h#L140 it shows the differences between the targets. |
@jrfastab I'm not sure if this is what you want. The original But now we have to declare the |
There are some "Missing or malformed SPDX-License-Identifier tag in line 1" errors in the Check pull request commits. But I don't know which license should be added to these headers. :) (Now, they are set to |
07535e3
to
5921a98
Compare
Thanks @Forsworns I'll review this tomorrow. |
The CI checkpatch provides some suggestions on But they are not applicable, e.g. Maybe we can simply neglect them... |
@jrfastab Feel free to discard the second commit if you think we don't need |
Hey @Forsworns, let me provide some thoughts on this. First, regarding the header, instead of
similar to what other files have (i.e. Regarding In the commit message you also mention: The reason that I am saying that is that we don't introduce Finally, the use of these macros in the other files, seems fine to me. |
Thanks! @tpapagian Most of your comments are valuable to me But here are two points:
I revised the In the second commit, I mentioned that
Maybe my commit descriptions mislead you. And in your new comment
This is not right. Just as shown in the link you provided,
|
Sorry @Forsworns , I maybe misread the comment in you commit. I created a diff of this and this but still there are some differences. For example this and this are missing from the file that you have submitted. I can understand that maybe we don't care about these but I am just trying to understand why there are differences (do we need the in order to compile?). If they are needed in order to compile we are fine. |
The first one, yes. I missed this architecture. Maybe I deleted it unconsciously... I forget it. It has been added. The second one, we don't need it, since our target (indicated by Clang) will always be |
I replace the license in the
as you mentioned. But I guess tetragon/bpf/libbpf/bpf_core_read.h Line 1 in 4bd5619
|
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 believe that now it's good to be approved. Thanks for addressing my comments.
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.
so what's your usecase, do you need tetragon to be built on another arch or you need CORE functionality? I think we should support both, but I'm curious how you will use the change
I reset this PR and re-split the committed changes. |
@Forsworns Thanks! Some of the comments from @olsajiri are marked as resolved but it's not clear to me how they were actually resolved. Could you please reply in each of them how they were resolved? |
@kkourt Some of them are solved after reorganizing the original two commits. Because I once was not sure whether following advice from @tpapagian or not. So @olsajiri felt confused that part of "unnecessary" codes are supplemented in the original second commit. The discussion has been too long, I paste the @tpapagian's advice here again.
|
@kkourt feel free to reopen the comments you feel not resolved |
Thanks for adding the comments! I'd like to have an ACK from @olsajiri before we merge this, and I think a response on how each issue was resolved will help this. |
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.
looks good, added few nits
Rebased and now it passes the go tests :) |
@Forsworns could you please rebase to the latest main, it might be the reason for the 'generated files check' fail, thanks |
1. Add libbpf header bpf_tracing.h 2. Add inline keyword before always_inline attribute to compile in bpf_tracing.h 3. Remove compiler arch target in bpf_tracing.h. Signed-off-by: Peihao Yang <[email protected]>
Add missing licenses for headers to please CI tests on format Signed-off-by: Peihao Yang <[email protected]>
1. replace probe_read to CORE macros on pt_regs 2. add a new configuration item in bpf/Makefile to assign arch 3. revise kprobes' signature with co-re macros Signed-off-by: Peihao Yang <[email protected]>
@olsajiri Have rebased :) |
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.
Thanks!
PS: checkpatch issues seem to be a file found in libbpf,. so it does not make sense to address them.
@Forsworns thank you! Maybe it makes sense to add a checkpatch rule to catch future direct registers usage... cc @kkourt |
__VMLINUX_
in vmlinux.h to__VMLINUX_H__
, which is the standard definition generated via bpftoolSigned-off-by: Peihao Yang [email protected]