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

Probe instruction set #26

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

Conversation

erthalion
Copy link
Collaborator

@erthalion erthalion commented Jun 27, 2022

Kernel supports few instruction sets [1], and the default one (which is
apparently being used at the moment in falco) is going to be the
generic or v1, which has certain limitations and requires
workarounds. It's possible to instruct llc to search the latest
supported instruction set via -mcpu parameter, which generally
speaking should result in more compact and potentially more performant
generated instructions for the same code. For the support table see
great blog post [2] about the topic. The gist for the support is:

v2: Linux v4.14 [3], LLVM v6.0 [4]
v3: Linux v5.1 [5], LLVM [6]

Kernel supports few instruction sets [1], and the default one (which is
apparently being used at the moment in falco) is going to be the
`generic` or `v1`, which has certain limitations and requires
workarounds. It's possible to instruct `llc` to search the latest
supported instruction set via `-mcpu` parameter, which generally
speaking should result in more compact and potentially more performant
generated instructions for the same code. For the support table see
great blog post [2] about the topic. The gist for the support is:

v2: Linux v4.14 [3], LLVM v6.0 [4]
v3: Linux v5.1 [5], LLVM [6]

[1]: https://www.kernel.org/doc/html/latest/bpf/bpf_devel_QA.html#q-new-bpf-instruction-for-kernel-and-llvm
[2]: https://pchaigno.github.io/bpf/2021/10/20/ebpf-instruction-sets.html
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=92b31a9af73b3a3fc801899335d6c47966351830
[4]: https://reviews.llvm.org/rL311522
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=092ed0968bb648cd18e8a0430cd0a8a71727315c
[6]: https://reviews.llvm.org/rL353384
@Stringy
Copy link
Collaborator

Stringy commented Jun 28, 2022

This looks really cool. Now that we've got the custom probe, I think these changes should be in https://github.com/stackrox/collector/blob/8ba5dc88a2dd7d948e7308103b336a4369a2de31/kernel-modules/probe/Makefile instead (or we can mirror them here as well)

@erthalion
Copy link
Collaborator Author

This looks really cool. Now that we've got the custom probe, I think these changes should be in https://github.com/stackrox/collector/blob/8ba5dc88a2dd7d948e7308103b336a4369a2de31/kernel-modules/probe/Makefile instead (or we can mirror them here as well)

Here [1]. I guess it would have to be overridden based on the version we build for though, still need to look at this.

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.

None yet

2 participants