Fix "BPF program too large" error in kernel release 6.4 and greater #1908
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1880, which contains more details, but the summary is that this commit and greater prevent our code to load.
I am not super sure of all the effects of that commit above, but it seems that perhaps the verifier is accounting for more execution paths, increasing the number of instructions that's analysing, making it go over the threshold.
This is remediated by reducing the number of instructions we have per program. Before we packed as many iterations of the main loop as we could, which now we have to reduce.
A possible side-effect is that for very large stacks we'll have to run more tail-calls, which while they are cheap, they aren't zero-cost. There might be some other performance implications, but we need to make this change for newer kernels, so let's benchmark this later on, but I don't expect the performance impact to be huge.
Test Plan
Compiled a custom kernel 6.4.7 off 4e382c2b468348d6208e5a18dbf1591a18170889 0 and run our cpu tests without any issues, while before we were seeing a failure.
Will add this kernel to our kernel tests in some weeks.