Skip to content
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

elf_reader: support value BTF on ringbuf and perf array maps #1628

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

ti-mo
Copy link
Collaborator

@ti-mo ti-mo commented Dec 16, 2024

elf_reader: support value BTF on ringbuf and perf array maps 

While reviewing https://github.com/cilium/ebpf/pull/1610, I noticed we were generating VariableSpecs for variables
named 'unused' in our examples. There had to be a better way to get their BTF
info into the ELF.

I thoroughly checked all map types present in Linux 6.12 for any validation code
on attr->value_size, and only RingBuf and Arena maps require value_size to be
zero at all times. Special-case PerfEventArray so type annotations aren't limited
to 4 bytes.
examples: annotate ringbuf and perf event arrays with value type information

This obviates the need for declaring these unused variables, which would otherwise
get included in bpf2go-generated Go code in a follow-up commit.

cc @smagnani96 This should clean up the bpf2go output a bit. I'll rebase your PR when this is merged.

While reviewing cilium#1610, I noticed we were generating VariableSpecs for variables
named 'unused' in our examples. There had to be a better way to get their BTF
info into the ELF.

I thoroughly checked all map types present in Linux 6.12 for any validation code
on attr->value_size, and only RingBuf and Arena maps require value_size to be
zero at all times. Special-case PerfEventArray so type annotations aren't limited
to 4 bytes.

Signed-off-by: Timo Beckers <timo@isovalent.com>
…rmation

This obviates the need for declaring these unused variables, which would otherwise
get included in bpf2go-generated Go code in a follow-up commit.

Signed-off-by: Timo Beckers <timo@isovalent.com>
@ti-mo ti-mo requested a review from a team as a code owner December 16, 2024 12:30
@ti-mo ti-mo merged commit 60405bb into cilium:main Dec 16, 2024
17 checks passed
@ti-mo ti-mo deleted the tb/ringbuf-perf-value-types branch December 16, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant