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
Support tracing XDP #339
base: main
Are you sure you want to change the base?
Support tracing XDP #339
Conversation
Thanks! I found it may be a technical obstacle for us to trace a frame's lifetime, it seems no way to link an xdp_buff to an skb: the "skb addr" is different, we can't know which skb an xdp_buff has turned to. |
There is a possible approach to link an I'll do a POC to confirm it later. |
It seems great to use
Let me apply this diff. |
5ec35e9
to
7b97571
Compare
Thanks! I've just tried running, and got:
Maybe we could ignore such progs instead of panic? |
Are you saying that both point to the same in the case XDP moves to the host (e.g., TC)? OT: could you drop the last commit, and just do |
Yes. As the output in previous reply. When to build xdp_buff from data: xdp_prepare_buff
Oh, sorry for my bad "merge". I will rebase it later. |
With these changes
|
It seems it does not remove the skb addr from Did it log I'd like to fix this code logic bug in #340. |
Noup, it didn't log. Shall I give it a go #340? |
Sure. |
Indeed, adding #340 to this branch resolved the last traces hiccup. Thanks! However, I still miss some traces when running this PR with #340. E.g., |
In bpf verifier, it denies that FENTRY/FEXIT cannot trace BTF-not-annotated bpf progs. Or, an error "FENTRY/FEXIT program can only be attached to another program annotated with BTF" occurs. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
It's to trace XDP progs in future commits. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Add an option --filter-trace-xdp to trace all XDP progs on host by fentry-ing on the progs, like the way of tracing tc-bpf 2347755. The diff from tracing tc-bpf: 1. Not support to filter mark. 2. No mark in meta output. 3. No proto in meta output. 4. Not support --output-skb. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
As we know, the hard start of packet data is same between `struct sk_buff` and `struct xdp_buff`. So, we can track skb by it, and output it as skb address. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Fix #239
Support tracing XDP
Add an option --filter-trace-xdp to trace all XDP progs on host by
fentry-ing on the progs, like the way tracing tc-bpf
Asphaltt@2347755.
The diff from tracing tc-bpf:
Example with
--filter-trace-xdp --filter-trace-tc
: