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

Refactor http2_grpc to leverage tail calls #1447

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rafaelroquetto
Copy link
Contributor

The latest kernel versions have changed the way the verifier deals with scalar spills, reducing its tolerance towards complex programs - for a comprehensive discussion, please refer to

https://lore.kernel.org/bpf/[email protected]/T/

Our http2 code therefore no longer passes the verifier, owing to mostly a complex for loop. This PR splits the code into different bpf programs that are now tail called, and changes the _for_ loop to be a hybrid of a recursive bpf_tail_call and a loop with less iterations. This approach was chosen because neither do we want to bpf_tail_call/recurse for each iteration, nor do we wish to use bpf_loop as constrains our program to kernel versions greater than 5.17.

@@ -0,0 +1,22 @@
#ifndef K_TRACER_TAILCALL_H
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was necessary to avoid a cyclic header dependency.

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.36%. Comparing base (85b6cdd) to head (d25b57a).

❗ There is a different number of reports uploaded between BASE (85b6cdd) and HEAD (d25b57a). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (85b6cdd) HEAD (d25b57a)
unittests 1 0
integration-test 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1447       +/-   ##
===========================================
- Coverage   76.86%   65.36%   -11.50%     
===========================================
  Files         149      148        -1     
  Lines       15252    15255        +3     
===========================================
- Hits        11723     9972     -1751     
- Misses       2911     4541     +1630     
- Partials      618      742      +124     
Flag Coverage Δ
integration-test ?
k8s-integration-test 59.33% <100.00%> (?)
oats-test 33.97% <100.00%> (+0.05%) ⬆️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

http2_grpc_request_t prev_info;
u8 has_prev_info;

int pos; //FIXME should be size_t equivalent
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This FIXME will be addressed separately - there are too many other places to check and tweak.

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

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

LGTM as long as test are fixed!

Also, could you add some extra commenting to the new C functions 🙏 ?

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.

2 participants