Skip to content

Avoid verifying tail call programs for disabled features #41421

Merged
ti-mo merged 3 commits intocilium:mainfrom
dylandreimerink:feature/improved-dead-tailcall-pruning
Sep 14, 2025
Merged

Avoid verifying tail call programs for disabled features #41421
ti-mo merged 3 commits intocilium:mainfrom
dylandreimerink:feature/improved-dead-tailcall-pruning

Conversation

@dylandreimerink
Copy link
Copy Markdown
Member

We already had logic to prune statically unreachable tail calls, tail calls which were unreachable due to compile time macros. However, we did not prune tail calls which were unreachable due to load time config.

This commit updates the existing logic to also prune tail calls which are unreachable due to load time config. This should allow us to migrate macros that control reachability of tail calls to load time config.

Fixes: #38378

Avoid loading / verifying tail calls for features which have been disabled using load time configuration

@dylandreimerink dylandreimerink added this to the clang-free milestone Aug 29, 2025
@dylandreimerink dylandreimerink added area/loader Impacts the loading of BPF programs into the kernel. release-note/misc This PR makes changes that have no direct user impact. labels Aug 29, 2025
@dylandreimerink dylandreimerink force-pushed the feature/improved-dead-tailcall-pruning branch 3 times, most recently from 2224b25 to cd1d41c Compare August 29, 2025 14:26
@dylandreimerink
Copy link
Copy Markdown
Member Author

/test

@dylandreimerink dylandreimerink marked this pull request as ready for review September 1, 2025 09:37
@dylandreimerink dylandreimerink requested review from a team as code owners September 1, 2025 09:37
@dylandreimerink dylandreimerink removed the release-note/misc This PR makes changes that have no direct user impact. label Sep 1, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Sep 1, 2025
@dylandreimerink dylandreimerink added the release-note/misc This PR makes changes that have no direct user impact. label Sep 1, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Sep 1, 2025
We already had logic to prune statically unreachable tail calls, tail
calls which were unreachable due to compile time macros. However, we
did not prune tail calls which were unreachable due to load time config.

This commit updates the existing logic to also prune tail calls which
are unreachable due to load time config. This should allow us to migrate
macros that control reachability of tail calls to load time config.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Move the logic for pruning unused tail calls from collection.go to
a new file.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
The `LoadCollectionSpec` function was a wrapper around
`ebpf.LoadCollectionSpec` that additionally did the unused tail call
pruning. Now that this functionality has been moved into the
`LoadCollection` function, this wrapper is no longer needed.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
@ti-mo ti-mo force-pushed the feature/improved-dead-tailcall-pruning branch from cd1d41c to f66f746 Compare September 11, 2025 12:17
Copy link
Copy Markdown
Contributor

@ti-mo ti-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've removed map entrypoints and map window, I think the latter kept appending to the backing array, which is fairly costly per-insn.

I'll do some refactoring on this per #41628, but let's get this merged so the clang-free work on the bpf codebase can start.

@ti-mo
Copy link
Copy Markdown
Contributor

ti-mo commented Sep 11, 2025

/test

@ti-mo ti-mo enabled auto-merge September 11, 2025 12:38
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Sep 14, 2025
@ti-mo ti-mo added this pull request to the merge queue Sep 14, 2025
Merged via the queue into cilium:main with commit 322d465 Sep 14, 2025
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/loader Impacts the loading of BPF programs into the kernel. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.

Projects

No open projects
Status: Released

Development

Successfully merging this pull request may close these issues.

bpf: avoid verifying tail call programs for disabled features

4 participants