ietf-wg-bpf / ebpf-docs

eBPF Standard Documentation
40 stars 5 forks source link

bpf, docs: Add initial BPF ELF profile draft #4

Closed dthaler closed 6 months ago

dthaler commented 1 year ago

Add initial BPF ELF profile draft

Signed-off-by: Dave Thaler dthaler@microsoft.com

dthaler commented 1 year ago

@qmonnet Can you review? Also, this draft uses IETF RFC format for structs rather than the style used in instruction-set.rst, any comments on whether this is a better or worse direction?

qmonnet commented 1 year ago

I'll look at it next week, quickly browsing through the doc I noticed that some of the conventions do not reflect the changes acted in libbpf v1.0 (see dropping support for maps section in favour of .maps (Andrii's blog), switching to fixed section names for program types instead of longest prefix match (Andrii's blog again)). Not sure what should be the "official" convention, but libbpf v1 should likely remain compliant.

dthaler commented 1 year ago

I'll look at it next week, quickly browsing through the doc I noticed that some of the conventions do not reflect the changes acted in libbpf v1.0 (see dropping support for maps section in favour of .maps (Andrii's blog), switching to fixed section names for program types instead of longest prefix match (Andrii's blog again)). Not sure what should be the "official" convention, but libbpf v1 should likely remain compliant.

Thanks for the pointers! Is there a spec for or description of the ".maps" section somewhere? Or just the code in libbpf.c?

qmonnet commented 1 year ago

Thanks for the pointers! Is there a spec for or description of the ".maps" section somewhere?

Not that I know of :/.

Or just the code in libbpf.c?

Sounds likely, unless some of the other libraries (cilium/ebpf, Aya) has more docs, but I haven't checked so far. Also not sure what's their status regarding section names conventions or maps vs. .maps for example.

dthaler commented 1 year ago

Thanks for the pointers! Is there a spec for or description of the ".maps" section somewhere?

Not that I know of :/.

Or just the code in libbpf.c?

Sounds likely, unless some of the other libraries (cilium/ebpf, Aya) has more docs, but I haven't checked so far. Also not sure what's their status regarding section names conventions or maps vs. .maps for example.

cilium/ebpf seems to read both types (and also data sections), which seems reasonable behavior: https://github.com/cilium/ebpf/blob/master/elf_reader.go#L125

Aya also seems to read both types: https://github.com/aya-rs/aya/blob/main/aya/src/obj/mod.rs#L1024

redbpf (which unlike Aya is listed as Major) only supports "maps": https://github.com/foniod/redbpf/blob/main/redbpf/src/lib.rs#L1544

dthaler commented 6 months ago

Replacing this PR with PR #95