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

[WIP] Enable bpf-next tree build and test #2064

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

Conversation

yurinnick
Copy link
Contributor

I'd like to enable bpf-next tree build and testing on KernelCI.

BPF subsystem requires cutting edge llvm (comes with clang) and pahole (added) to maximize passing tests. I added most of the parts required for build, not sure if I tie them together correctly though.

Progress

  • Configure bpf-next tree checkout
  • Add llvm + pahole build image
  • Add bpf-next build config
  • Test bpf-next build configuration with kci_build
  • Configure bpf-next kselftest
  • Test bpf-next kselftest configuration with kci_test

Testing

  1. Build clang-17 + pahole image
$ ./kci docker build clang-17 pahole kselftest kernelci --prefix=yurinnick/
$ docker images
REPOSITORY                       TAG                         IMAGE ID       CREATED              SIZE
yurinnick/clang-17               pahole-kselftest-kernelci   50697711d09e   36 seconds ago       1.4GB
  1. Add kernelci.toml config
$ cat kernelci.toml
...
[kci_build]
mirror = "bpf-next.git"
kdir = "linux-bpf"
output = "linux-bpf/build-x86"
build_env = "gcc-10"
build_config = "bpf-next"
arch = "x86_64"
j = 13
install = true
...
  1. Following kci_build docs build bpf-next kernel
$ ./kci_build update_mirrot
$ ./kci_build update_repo
$ ./kci_build generate_fragments
$ ./kci_build init_bmeta
$ docker run -it -v $PWD:/home/kernelci yurinnick/clang-17:pahole-kselftest-kernelci /bin/bash
./kci_build make_config --defconfig=x86_64_defconfig+bpf
./kci_build fetch_firmware
./kci_build make_kernel
./kci_build make_modules

Signed-off-by: Nikolay Yurin <yurinnick@meta.com>
Copy link
Contributor

@gctucker gctucker left a comment

Choose a reason for hiding this comment

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

I believe we're going to face practical issues with this due to the LLVM version requirements. Does the bpf fragment already require this or can we use a standard LLVM 17 toolchain?

bpf-next:
tree: bpf-next
branch: 'for-next'
variants: *bpf_variants
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to directly declare the variants here rather than elsewhere in the file with an anchor as it's only used with the BPF tree.

Comment on lines +288 to +292
kselftest-bpf:
<<: *kselftest
params:
job_timeout: '10'
kselftest_collections: "bpf"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we can actually do this because, like you mentioned, BPF requires an unreasonably cutting-edge toolchain. It's actually one of the reasons why it got disabled by default:

commit 7a6eb7c34a78498742b5f82543b7a68c1c443329 (tag: linux-kselftest-fixes-5.11-rc4)
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Dec 10 18:52:33 2020 +0000

    selftests: Skip BPF seftests by default

So a prerequisite before being able to run this test automatically would be to have a dedicated job to build a custom toolchain Docker image. This sounds like something to do with the new API, at some point in 2024 I guess.

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