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

Set up mapid -> mapfd relocation #1861

merged 5 commits into from Jun 3, 2021

Set up mapid -> mapfd relocation #1861

merged 5 commits into from Jun 3, 2021


Copy link

@danobi danobi commented May 27, 2021

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.

  • Language changes are updated in docs/
  • User-visible and non-trivial changes updated in
  • The new behaviour is covered by tests

@danobi danobi marked this pull request as ready for review May 27, 2021 20:16
Copy link

fbs commented Jun 1, 2021

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

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.
@danobi danobi merged commit 6683ad5 into iovisor:master Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants