Set up mapid -> mapfd relocation - #1861
Merged
Merged
Conversation
danobi
marked this pull request as ready for review
May 27, 2021 20:16
Member
|
looks good :) |
Setup code for relocation helper. The relocator will fixup each probe's bytecode with information better available at runtime (as opposed to during codegen).
We will need every map to have an ID in order to relocate map ID -> map FD in BPF_PSUEDO_MAP_FD loads.
Before it could return Some(nullptr) if the map wasn't actually present
This commit relocates map id -> map fd. This is desirable for multiple reasons: 1) Codegen should be independent as possible from runtime state such as which FD a map gets. The more independent it is, the easier it is to test codegen b/c we won't have to mock as much stuff out or configure the testing environment as much. 2) This is necessary to enable ahead of time compile bpftrace scripts as a map FD is not guaranteed to be the same value on another host. Thus, the runtime must relocate map ID -> map FD at load time.
This is no longer necessary as the mapid is placed into bytecode now. This is nicer b/c now tests can't forget to set next_mapfd_ = 1 before running the test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR begins the work on ahead-of-time (AOT) compiled bpftrace
scripts. More details on AOT are available here.
Details on relocation are in individual commit messages.
Checklist
docs/reference_guide.mdCHANGELOG.md